summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-21 20:55:34 -0500
committerJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-21 20:55:34 -0500
commit7ba4aa87ce49cecae80a7f1a5b88168ec9d77a4c (patch)
tree169df18f3ed75fc0ef8c99e998b92ae7af63be0f
parentf8fee6a63422a85bfee5fe2d903bf5c1316241a6 (diff)
PrintMem and bug fixes
-rw-r--r--cmpen472hw6_McDonnell/Sources/main.asm136
-rw-r--r--cmpen472hw6_McDonnell/bin/Project.absbin5578 -> 6230 bytes
-rw-r--r--cmpen472hw6_McDonnell/bin/Project.abs.s1955
-rw-r--r--cmpen472hw6_McDonnell/bin/main.dbg136
-rw-r--r--cmpen472hw6_McDonnell/cmpen472hw6_McDonnell.mcpbin57065 -> 57065 bytes
-rw-r--r--cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.obin5578 -> 6230 bytes
-rw-r--r--cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.sx55
-rw-r--r--cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/TargetDataWindows.tdtbin63880 -> 64174 bytes
8 files changed, 250 insertions, 132 deletions
diff --git a/cmpen472hw6_McDonnell/Sources/main.asm b/cmpen472hw6_McDonnell/Sources/main.asm
index 923c8b9..62592ce 100644
--- a/cmpen472hw6_McDonnell/Sources/main.asm
+++ b/cmpen472hw6_McDonnell/Sources/main.asm
@@ -77,9 +77,13 @@ Counter dc.w $0036 ; X register count number for time Delay
LEVEL dc.b $0005 ; Light Level that the LED should be
-buffer ds.b $000F ; Array of 16 bytes to read a string
- dc.b NULL
-lenBuf dc.w $000F ; Length of str array
+buffer ds.b $0010 ; Array of 16 bytes to read a string
+ dc.b NULL ; NULL terminated
+lenBuf dc.w $0010 ; Length of buffer array
+
+buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal
+ dc.b NULL ; NULL terminated
+lenBuf2 dc.w $0010 ; length of buffer2
* There is a second Data Section at the end of the file.
*
**************************************************************************
@@ -127,6 +131,9 @@ mainLoop
ldaa #LF
jsr putchar
+ ldx #Counter
+ jsr PrintMem
+
bra mainLoop
ldx #msg ; Load the address of msg into X
@@ -172,6 +179,61 @@ twReadLoop jsr getchar ; Read Character from Serial
CheckInput
rts ; Return to caller
+
+
+PrintMem
+ pshy ; Save Y to the Stack
+ pshd ; Save D to the Stack
+ exg x,d ; Copy Address from X to D to print
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintHexWord ; Print the Address in Hex
+ exg d,x ; Copy Address from D to X
+ ldaa #'=' ; Load the '=' character into A
+ jsr putchar ; Print the character to the seriel
+ ldaa #'>' ; Load the '>' character into A
+ jsr putchar ; Print the character to the seriel
+ ldd x ; Load data from address in X into D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ jsr PrintBinaryWord ; Print the binary word to the seriel
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the seriel
+ jsr putchar ; Print Space character to the seriel
+ pula ; Restore A from the stack
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Prin the hex representation of the word to seriel
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the seriel
+ jsr putchar ; Print Space character to the seriel
+ pula ; Restore A from the stack
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintDecimalWord; Prin the decimal representation of the word to seriel
+ ldaa #CR ; Load the carriage return character into A
+ jsr putchar ; Print the character to seriel
+ ldaa #LF ; Load the line feed character into A
+ jsr putchar ; Print the character to seriel
+ puld ; Restore D from the stack
+ puly ; Restore Y from the stack
+ rts ; Return to caller
+
+strrev
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ psha ; Save A to the stack
+revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y
+ beq revDone ; If Character is 0, exit loop
+ staa 1,x+ ; Save character in address in X, increment X
+ bra revLoop ; Loop back always
+revDone pula ; Restore A from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
;*************************************************************************
; PrintBinaryWord subroutine
@@ -227,47 +289,43 @@ PrintHexWord
pshx ; Save X to the stack
pshd ; Save D (A:B) to the stack
pshy ; Save Y to the stack
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- ldx #5 ; Load 5 into X since we have at most 4 digits
-hPrintLoop dex ; Decrement X by 1
- beq hPrintDone ; If X == 0, exit Loop
- pshx ; Save X to the stack
- ldx #16 ; Load 16 in X for division
+hPrintLoop ldx #16 ; Load 16 in X for division
idiv ; Divide D / 16 to get Hex Digit
- cpd #0 ; Compare D to 0
- beq hPrintDone ; If D == 0, exit loop
- cmpb #$0A ; Compare A to $0A
+ cpx #0 ; Compare X to 0
+ beq hCheck ; If X == 0, branch to check D is zero
+hDNotZero cmpb #$0A ; Compare A to $0A
blt hex10 ; If B < $A, branch to hex10
addb #'A' ; Add 'A' to B to get ASCII Character
subb #$0A ; Subtract $A to adjust characters
- stab 1,-y ; Save character from B to Y
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra hPrintLoop ; loop to hPrintLoop
hex10 addb #'0' ; Add '0' to B to get ASCII Character
- stab 1,-y ; Save character from B to Y
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra hPrintLoop ; Loop to hPrintLoop
-hPrintDone ldaa #'$' ; Load '$' into A
- jsr putchar ; Print '$' to denote Hex Number
- exg Y,X ; Move Address from Y to X
+hCheck cpd #0 ; Compare D to 0
+ bne hDNotZero ; If D != 0, branch back to hDNotZero
+hPrintDone ldaa #'$' ; Load '$' into
+ staa 1,+y ; Save '$' into buffer in Y to denote Hex
+ ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
puly ; Restore Y from the stack
puld ; Restore D (A:B) from the stack
pulx ; Restore X from the stack
rts ; Return to caller
;*************************************************************************
-; PrintHexWord subroutine
+; PrintDecimalWord subroutine
;
; This subroutine will print a given word of data to the serial in binary.
;
; Input: 1 word of data in register D, Buffer Address in Y
-; Output: Hexadecimal representation of the data on the serial console
+; Output: Decimal representation of the data on the serial console
; Registers in use: Y for the address of the buffer, X to count the number of bits
; written and for division, D for the input, A for characters.
; Memory locations in use: Memory addresses for serial.
@@ -279,26 +337,22 @@ PrintDecimalWord
pshx ; Save X to the stack
pshd ; Save D (A:B) to the stack
pshy ; Save Y to the stack
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- ldx #6 ; Load 5 into X since we have at most 5 digits
-dPrintLoop dex ; Decrement X by 1
- beq dPrintDone ; If X == 0, exit Loop
- pshx ; Save X to the stack
- ldx #10 ; Load 10 in X for division
- idiv ; Divide D / 16 to get Hex Digit
- cpd #0 ; Compare D to 0
- beq dPrintDone ; If D == 0, exit loop
- addb #'0' ; Add '0' to B to get ASCII Character
- stab 1,-y ; Save character from B to Y
+dPrintLoop ldx #10 ; Load 10 in X for division
+ idiv ; Divide D / 10 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq dCheck ; If X == 0, branch to check D is zero
+dDNotZero addb #'0' ; Add '0' to B to get ASCII Character
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra dPrintLoop ; Loop to hPrintLoop
-dPrintDone exg Y,X ; Move Address from Y to X
+dCheck cpd #0 ; Compare D to 0
+ bne dDNotZero ; If D != 0, branch back to hDNotZero
+dPrintDone ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
puly ; Restore Y from the stack
puld ; Restore D (A:B) from the stack
pulx ; Restore X from the stack
diff --git a/cmpen472hw6_McDonnell/bin/Project.abs b/cmpen472hw6_McDonnell/bin/Project.abs
index 68eb469..c48cb9d 100644
--- a/cmpen472hw6_McDonnell/bin/Project.abs
+++ b/cmpen472hw6_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw6_McDonnell/bin/Project.abs.s19 b/cmpen472hw6_McDonnell/bin/Project.abs.s19
index 3c4bd30..55fba26 100644
--- a/cmpen472hw6_McDonnell/bin/Project.abs.s19
+++ b/cmpen472hw6_McDonnell/bin/Project.abs.s19
@@ -1,27 +1,32 @@
S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877365F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162734A
-S118300000360500000000000000000000000000000000000F6D
-S1233100CF310086F15A03860C5ACBCC00015CC88612C6CDCD30031631A4CE3003FD3013D8
-S123312016320D860D163241860A16324186FFC6FFCD30031631E2CE3003FD301316320DF8
-S1233140860D163241860A16324120C4CE32BB163216CE3003FD301316320DCE3003FD3075
-S123316013163222CE300316317E20A4CE326A16321616324827FB1632415A0120F43D3461
-S12331803B37180E8625163241CE001055B72084018B301632410405088E000826EE33207E
-S12331A0EB3A303D343B3502020202CE000509272334CE001018108C00002718C10A2D0B9F
-S12331C0CB41C00A6B6FB7D43020E3CB306B6FB7D43020DA8624163241B7E5163216313A5B
-S12331E0303D343B350202020202CE000609271434CE000A18108C00002709CB306B6FB71C
-S1233200D43020E9B7E5163216313A303D36876A300436FB323D36A630270516324120F7F8
-S1233220323D36353416324827FB810D270A6A3016324103270220ED860A16324130313203
-S12332403D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6B6E6F776E2018
-S1233260436F6D6D616E640D0A0057656C636F6D6520746F20547970652057726974657246
-S12332802C20796F75206D617920747970652062656C6F772E0D0A52657374617274207441
-S12332A06F20656E746572206D61696E206D656E7520616761696E2E0D0A004C313A205433
-S12332C075726E206F6E204C4544310D0A46313A205475726E206F6666204C4544310D0A49
-S12332E04C323A205475726E206F6E204C4544320D0A46323A205475726E206F6666204CCC
-S12333004544320D0A4C333A205475726E206F6E204C4544330D0A46333A205475726E207D
-S12333206F6666204C4544330D0A4C343A204C45443420676F65732066726F6D20302520F5
-S12333406C69676874206C6576656C20746F2031303025206C69676874206C6576656C20B0
-S1233360696E20302E34207365636F6E64730D0A46343A204C45443420676F6573206672F7
-S12333806F6D2031303025206C69676874206C6576656C20746F203025206C696768742037
-S12333A06C6576656C20696E20302E34207365636F6E64730D0A515549543A2051756974E2
-S12333C0206D656E752070726F6772616D2C2072756E20547970652077726974657220704C
-S10D33E0726F6772616D2E0D0A0012
+S1233000003605000000000000000000000000000000000000100000000000000000000061
+S10C302000000000000000001093
+S1233100CF310086F15A03860C5ACBCC00015CC88612C6CDCD3003163213CE3003FD301467
+S1233120163285860D1632B9860A1632B986FFC6FFCD3003163255CE3003FD3014163285A3
+S1233140860D1632B9860A1632B9CE300016318520BECE333316328ECE3003FD301416320A
+S123316085CE3003FD301416329ACE3003163184209ECE32E216328E1632C027FB1632B935
+S12331805A0120F43D353BB7D4CD3003163213B7C5863D1632B9863E1632B9EC00CE300337
+S12331A0FD30141632851631EE3686201632B91632B932CD30031632133686201632B9166A
+S12331C032B932CE3003FD3014163285CD3003163255860D1632B9860A1632B93A313D3421
+S12331E03536A67F27046A3020F83231303D343B37180E86251632B9CE001055B720840187
+S12332008B301632B90405088E000826EE3320EB3A303D343B35CE001018108E00002716D9
+S1233220C10A2D0ACB41C00A6B60B7D420E8CB306B60B7D420E08C000026E586246A60CE2A
+S123324030161631DF16328EFD3027CE3016163285313A303D343B35CE000A18108E0000E9
+S12332602708CB306B60B7D420EE8C000026F3CE30161631DF16328EFD3027CE3016163257
+S123328085313A303D36876A300436FB323D36A63027051632B920F7323D3635341632C06C
+S12332A027FB810D270A6A301632B903270220ED860A1632B93031323D4FCC80FC5ACF3DF7
+S12332C04FCC200396CF3D873D4572726F723A20556E6B6E6F776E20436F6D6D616E640D06
+S12332E00A0057656C636F6D6520746F2054797065205772697465722C20796F75206D61FB
+S12333007920747970652062656C6F772E0D0A5265737461727420746F20656E746572208A
+S12333206D61696E206D656E7520616761696E2E0D0A004C313A205475726E206F6E204CC1
+S12333404544310D0A46313A205475726E206F6666204C4544310D0A4C323A205475726E05
+S1233360206F6E204C4544320D0A46323A205475726E206F6666204C4544320D0A4C333A41
+S1233380205475726E206F6E204C4544330D0A46333A205475726E206F6666204C45443325
+S12333A00D0A4C343A204C45443420676F65732066726F6D203025206C69676874206C65CF
+S12333C076656C20746F2031303025206C69676874206C6576656C20696E20302E3420731D
+S12333E065636F6E64730D0A46343A204C45443420676F65732066726F6D203130302520C1
+S12334006C69676874206C6576656C20746F203025206C69676874206C6576656C20696E79
+S123342020302E34207365636F6E64730D0A515549543A2051756974206D656E7520707299
+S12334406F6772616D2C2072756E2054797065207772697465722070726F6772616D2E0DDF
+S10534600A005C
S9030000FC
diff --git a/cmpen472hw6_McDonnell/bin/main.dbg b/cmpen472hw6_McDonnell/bin/main.dbg
index eae7f5a..58fa190 100644
--- a/cmpen472hw6_McDonnell/bin/main.dbg
+++ b/cmpen472hw6_McDonnell/bin/main.dbg
@@ -77,9 +77,13 @@ Counter dc.w $0036 ; X register count number for time Delay
LEVEL dc.b $0005 ; Light Level that the LED should be
-buffer ds.b $000F ; Array of 16 bytes to read a string
- dc.b NULL
-lenBuf dc.w $000F ; Length of str array
+buffer ds.b $0010 ; Array of 16 bytes to read a string
+ dc.b NULL ; NULL terminated
+lenBuf dc.w $0010 ; Length of buffer array
+
+buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal
+ dc.b NULL ; NULL terminated
+lenBuf2 dc.w $0010 ; length of buffer2
* There is a second Data Section at the end of the file.
*
**************************************************************************
@@ -127,6 +131,9 @@ mainLoop
ldaa #LF
jsr putchar
+ ldx #Counter
+ jsr PrintMem
+
bra mainLoop
ldx #msg ; Load the address of msg into X
@@ -172,6 +179,61 @@ twReadLoop jsr getchar ; Read Character from Serial
CheckInput
rts ; Return to caller
+
+
+PrintMem
+ pshy ; Save Y to the Stack
+ pshd ; Save D to the Stack
+ exg x,d ; Copy Address from X to D to print
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintHexWord ; Print the Address in Hex
+ exg d,x ; Copy Address from D to X
+ ldaa #'=' ; Load the '=' character into A
+ jsr putchar ; Print the character to the seriel
+ ldaa #'>' ; Load the '>' character into A
+ jsr putchar ; Print the character to the seriel
+ ldd x ; Load data from address in X into D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ jsr PrintBinaryWord ; Print the binary word to the seriel
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the seriel
+ jsr putchar ; Print Space character to the seriel
+ pula ; Restore A from the stack
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Prin the hex representation of the word to seriel
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the seriel
+ jsr putchar ; Print Space character to the seriel
+ pula ; Restore A from the stack
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintDecimalWord; Prin the decimal representation of the word to seriel
+ ldaa #CR ; Load the carriage return character into A
+ jsr putchar ; Print the character to seriel
+ ldaa #LF ; Load the line feed character into A
+ jsr putchar ; Print the character to seriel
+ puld ; Restore D from the stack
+ puly ; Restore Y from the stack
+ rts ; Return to caller
+
+strrev
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ psha ; Save A to the stack
+revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y
+ beq revDone ; If Character is 0, exit loop
+ staa 1,x+ ; Save character in address in X, increment X
+ bra revLoop ; Loop back always
+revDone pula ; Restore A from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
;*************************************************************************
; PrintBinaryWord subroutine
@@ -227,47 +289,43 @@ PrintHexWord
pshx ; Save X to the stack
pshd ; Save D (A:B) to the stack
pshy ; Save Y to the stack
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- ldx #5 ; Load 5 into X since we have at most 4 digits
-hPrintLoop dex ; Decrement X by 1
- beq hPrintDone ; If X == 0, exit Loop
- pshx ; Save X to the stack
- ldx #16 ; Load 16 in X for division
+hPrintLoop ldx #16 ; Load 16 in X for division
idiv ; Divide D / 16 to get Hex Digit
- cpd #0 ; Compare D to 0
- beq hPrintDone ; If D == 0, exit loop
- cmpb #$0A ; Compare A to $0A
+ cpx #0 ; Compare X to 0
+ beq hCheck ; If X == 0, branch to check D is zero
+hDNotZero cmpb #$0A ; Compare A to $0A
blt hex10 ; If B < $A, branch to hex10
addb #'A' ; Add 'A' to B to get ASCII Character
subb #$0A ; Subtract $A to adjust characters
- stab 1,-y ; Save character from B to Y
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra hPrintLoop ; loop to hPrintLoop
hex10 addb #'0' ; Add '0' to B to get ASCII Character
- stab 1,-y ; Save character from B to Y
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra hPrintLoop ; Loop to hPrintLoop
-hPrintDone ldaa #'$' ; Load '$' into A
- jsr putchar ; Print '$' to denote Hex Number
- exg Y,X ; Move Address from Y to X
+hCheck cpd #0 ; Compare D to 0
+ bne hDNotZero ; If D != 0, branch back to hDNotZero
+hPrintDone ldaa #'$' ; Load '$' into
+ staa 1,+y ; Save '$' into buffer in Y to denote Hex
+ ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
puly ; Restore Y from the stack
puld ; Restore D (A:B) from the stack
pulx ; Restore X from the stack
rts ; Return to caller
;*************************************************************************
-; PrintHexWord subroutine
+; PrintDecimalWord subroutine
;
; This subroutine will print a given word of data to the serial in binary.
;
; Input: 1 word of data in register D, Buffer Address in Y
-; Output: Hexadecimal representation of the data on the serial console
+; Output: Decimal representation of the data on the serial console
; Registers in use: Y for the address of the buffer, X to count the number of bits
; written and for division, D for the input, A for characters.
; Memory locations in use: Memory addresses for serial.
@@ -279,26 +337,22 @@ PrintDecimalWord
pshx ; Save X to the stack
pshd ; Save D (A:B) to the stack
pshy ; Save Y to the stack
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- iny ; Increment Y by 1
- ldx #6 ; Load 5 into X since we have at most 5 digits
-dPrintLoop dex ; Decrement X by 1
- beq dPrintDone ; If X == 0, exit Loop
- pshx ; Save X to the stack
- ldx #10 ; Load 10 in X for division
- idiv ; Divide D / 16 to get Hex Digit
- cpd #0 ; Compare D to 0
- beq dPrintDone ; If D == 0, exit loop
- addb #'0' ; Add '0' to B to get ASCII Character
- stab 1,-y ; Save character from B to Y
+dPrintLoop ldx #10 ; Load 10 in X for division
+ idiv ; Divide D / 10 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq dCheck ; If X == 0, branch to check D is zero
+dDNotZero addb #'0' ; Add '0' to B to get ASCII Character
+ stab 1,+y ; Save character from B to Y
exg X,D ; Swap values in X and D
- pulx ; Restore Count from stack to X
bra dPrintLoop ; Loop to hPrintLoop
-dPrintDone exg Y,X ; Move Address from Y to X
+dCheck cpd #0 ; Compare D to 0
+ bne dDNotZero ; If D != 0, branch back to hDNotZero
+dPrintDone ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
puly ; Restore Y from the stack
puld ; Restore D (A:B) from the stack
pulx ; Restore X from the stack
diff --git a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell.mcp b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell.mcp
index b0cc7cb..4bff8b3 100644
--- a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell.mcp
+++ b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell.mcp
Binary files differ
diff --git a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.o
index 68eb469..c48cb9d 100644
--- a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.o
+++ b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.sx
index d5adbf0..25b5dc8 100644
--- a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.sx
+++ b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -1,27 +1,32 @@
S0840000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877365F4D63446F6E6E656C6C5C636D70656E3437326877365F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726DCD
-S118300000360500000000000000000000000000000000000F6D
-S1233100CF310086F15A03860C5ACBCC00015CC88612C6CDCD30031631A4CE3003FD3013D8
-S123312016320D860D163241860A16324186FFC6FFCD30031631E2CE3003FD301316320DF8
-S1233140860D163241860A16324120C4CE32BB163216CE3003FD301316320DCE3003FD3075
-S123316013163222CE300316317E20A4CE326A16321616324827FB1632415A0120F43D3461
-S12331803B37180E8625163241CE001055B72084018B301632410405088E000826EE33207E
-S12331A0EB3A303D343B3502020202CE000509272334CE001018108C00002718C10A2D0B9F
-S12331C0CB41C00A6B6FB7D43020E3CB306B6FB7D43020DA8624163241B7E5163216313A5B
-S12331E0303D343B350202020202CE000609271434CE000A18108C00002709CB306B6FB71C
-S1233200D43020E9B7E5163216313A303D36876A300436FB323D36A630270516324120F7F8
-S1233220323D36353416324827FB810D270A6A3016324103270220ED860A16324130313203
-S12332403D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6B6E6F776E2018
-S1233260436F6D6D616E640D0A0057656C636F6D6520746F20547970652057726974657246
-S12332802C20796F75206D617920747970652062656C6F772E0D0A52657374617274207441
-S12332A06F20656E746572206D61696E206D656E7520616761696E2E0D0A004C313A205433
-S12332C075726E206F6E204C4544310D0A46313A205475726E206F6666204C4544310D0A49
-S12332E04C323A205475726E206F6E204C4544320D0A46323A205475726E206F6666204CCC
-S12333004544320D0A4C333A205475726E206F6E204C4544330D0A46333A205475726E207D
-S12333206F6666204C4544330D0A4C343A204C45443420676F65732066726F6D20302520F5
-S12333406C69676874206C6576656C20746F2031303025206C69676874206C6576656C20B0
-S1233360696E20302E34207365636F6E64730D0A46343A204C45443420676F6573206672F7
-S12333806F6D2031303025206C69676874206C6576656C20746F203025206C696768742037
-S12333A06C6576656C20696E20302E34207365636F6E64730D0A515549543A2051756974E2
-S12333C0206D656E752070726F6772616D2C2072756E20547970652077726974657220704C
-S10D33E0726F6772616D2E0D0A0012
+S1233000003605000000000000000000000000000000000000100000000000000000000061
+S10C302000000000000000001093
+S1233100CF310086F15A03860C5ACBCC00015CC88612C6CDCD3003163213CE3003FD301467
+S1233120163285860D1632B9860A1632B986FFC6FFCD3003163255CE3003FD3014163285A3
+S1233140860D1632B9860A1632B9CE300016318520BECE333316328ECE3003FD301416320A
+S123316085CE3003FD301416329ACE3003163184209ECE32E216328E1632C027FB1632B935
+S12331805A0120F43D353BB7D4CD3003163213B7C5863D1632B9863E1632B9EC00CE300337
+S12331A0FD30141632851631EE3686201632B91632B932CD30031632133686201632B9166A
+S12331C032B932CE3003FD3014163285CD3003163255860D1632B9860A1632B93A313D3421
+S12331E03536A67F27046A3020F83231303D343B37180E86251632B9CE001055B720840187
+S12332008B301632B90405088E000826EE3320EB3A303D343B35CE001018108E00002716D9
+S1233220C10A2D0ACB41C00A6B60B7D420E8CB306B60B7D420E08C000026E586246A60CE2A
+S123324030161631DF16328EFD3027CE3016163285313A303D343B35CE000A18108E0000E9
+S12332602708CB306B60B7D420EE8C000026F3CE30161631DF16328EFD3027CE3016163257
+S123328085313A303D36876A300436FB323D36A63027051632B920F7323D3635341632C06C
+S12332A027FB810D270A6A301632B903270220ED860A1632B93031323D4FCC80FC5ACF3DF7
+S12332C04FCC200396CF3D873D4572726F723A20556E6B6E6F776E20436F6D6D616E640D06
+S12332E00A0057656C636F6D6520746F2054797065205772697465722C20796F75206D61FB
+S12333007920747970652062656C6F772E0D0A5265737461727420746F20656E746572208A
+S12333206D61696E206D656E7520616761696E2E0D0A004C313A205475726E206F6E204CC1
+S12333404544310D0A46313A205475726E206F6666204C4544310D0A4C323A205475726E05
+S1233360206F6E204C4544320D0A46323A205475726E206F6666204C4544320D0A4C333A41
+S1233380205475726E206F6E204C4544330D0A46333A205475726E206F6666204C45443325
+S12333A00D0A4C343A204C45443420676F65732066726F6D203025206C69676874206C65CF
+S12333C076656C20746F2031303025206C69676874206C6576656C20696E20302E3420731D
+S12333E065636F6E64730D0A46343A204C45443420676F65732066726F6D203130302520C1
+S12334006C69676874206C6576656C20746F203025206C69676874206C6576656C20696E79
+S123342020302E34207365636F6E64730D0A515549543A2051756974206D656E7520707299
+S12334406F6772616D2C2072756E2054797065207772697465722070726F6772616D2E0DDF
+S10534600A005C
S9033100CB
diff --git a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/TargetDataWindows.tdt
index 686cab1..df5641b 100644
--- a/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/TargetDataWindows.tdt
+++ b/cmpen472hw6_McDonnell/cmpen472hw6_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ