diff options
Diffstat (limited to 'cmpen472hw12_McDonnell')
| -rw-r--r-- | cmpen472hw12_McDonnell/Full_Chip_Simulation.ini | 2 | ||||
| -rw-r--r-- | cmpen472hw12_McDonnell/Sources/main.asm | 119 | ||||
| -rw-r--r-- | cmpen472hw12_McDonnell/bin/Project.abs | bin | 9806 -> 9930 bytes | |||
| -rw-r--r-- | cmpen472hw12_McDonnell/bin/Project.abs.s19 | 107 | ||||
| -rw-r--r-- | cmpen472hw12_McDonnell/bin/main.dbg | 119 | ||||
| -rw-r--r-- | cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o | bin | 9806 -> 9930 bytes | |||
| -rw-r--r-- | cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx | 107 | ||||
| -rw-r--r-- | cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt | bin | 66972 -> 67011 bytes |
8 files changed, 335 insertions, 119 deletions
diff --git a/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini index bac998b..1cc384b 100644 --- a/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini +++ b/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini @@ -10,7 +10,7 @@ Target=sim Layout=ASM_layout.hwl LoadDialogOptions=AUTOERASEANDFLASH NORUNAFTERLOAD CPU=HC12 -MainFrame=2,3,-1,-1,-1,-1,14,61,1834,1050 +MainFrame=0,1,-1,-1,-1,-1,14,61,1834,1050 Configuration=Full_Chip_Simulation.hwc Statusbar=1 ShowToolbar=1 diff --git a/cmpen472hw12_McDonnell/Sources/main.asm b/cmpen472hw12_McDonnell/Sources/main.asm index b2b5d0d..2e2b5e6 100644 --- a/cmpen472hw12_McDonnell/Sources/main.asm +++ b/cmpen472hw12_McDonnell/Sources/main.asm @@ -2,11 +2,11 @@ * * Title: Memory Monitor * -* Objective: CMPEN 472 Homework 6 +* Objective: CMPEN 472 Homework 12 * * Revision: V1.0 * -* Date: Feb. 28, 2025 +* Date: APR. 25, 2025 * * Programmer: Jacob McDonnell * @@ -29,8 +29,10 @@ * * Observation: This program will prompt the user to print the contents of a * memory location and to modify the location with hexadecimal or -* decimal data. If the user wishes, they can type 'QUIT' to exit -* the memory monitor and enter the type writer program. +* decimal data. The user can also load in chunks of data and +* print chunks of memory. If the user wishes, they can type +* 'QUIT' to exit the memory monitor and enter the type writer +* program. * * Note: ON CSM-12C128 board, * @@ -61,6 +63,7 @@ CR equ $0d ; carriage return, ASCII 'Return' key LF equ $0a ; line feed, ASCII 'next line' character NULL equ $00 ; NULL Terminator character +* ************************************************************************** * Data Section: address used [ $3000 to $30FF ] RAM Memory * @@ -77,6 +80,8 @@ buffer2 ds.b $0010 ; Array of 16 bytes for reading and reve dc.b NULL ; NULL terminated lenBuf2 dc.w $0010 ; length of buffer2 +charCount dc.b $00 ; Number of characters read by ReadHex + * * There is a section Data Section at the end of the file ************************************************************************** @@ -311,9 +316,15 @@ ReadHex pshd ; Save D to the stack ldy #0 ; Clear Y register ldab 1,x+ ; Read character from X into B, add 1 to X + clra ; clear A accumulator + staa charCount ; Clear charCount cmpb #'$' ; Compare B to '$' bne rHError ; If B != '$', jump to error, not hex data -rHLoop ldab 1,x+ ; Read Next character from X +rHLoop inc charCount ; Increment charCount by 1 + ldab charCount ; Load charCount into B + cmpb #5 ; At most 4 hex digits to read + bhi rHError ; If charCount > 5, error + ldab 1,x+ ; Read Next character from X beq rHDone ; If B == 0, exit loop cmpb #' ' ; Compare B to space character beq rHDone ; If B == ' ', exit loop @@ -343,6 +354,7 @@ rHAlpha cmpb #'A' ; Compare B to 'A' character aby ; Add B to Y bra rHLoop ; Branch always to rHLoop rHDone clra ; clear A accumulator + staa charCount ; Clear charCount tap ; Transfer A into CCR to clear zero bit puld ; Restore D from the stack rts ; Return to caller @@ -351,6 +363,23 @@ rHError ldaa #4 ; Load 4 into A to set zero bit in CCR puld ; Restore D from the stack rts ; Return to caller +;************************************************************************* +; MDCommand subroutine +; +; This subroutine is the MD command for the user. This subroutine will take in +; a memory address and a length of bytes, and will print the bytes starting at +; that memory location in 16 byte line segments. +; +; Input: A memory address in register X & a length of bytes in Y +; Output: The data in memory starting at the address in X in 16 +; byte line segments on the serial console. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine Requires PrintHexWord & PrintHexByte. +; + MDCommand pshx ; Save X to the stack pshy ; Save Y to the stack @@ -407,6 +436,25 @@ MDDone ldaa #CR ; Load CR into A pulx ; Restore X from the stack rts ; Return +;************************************************************************* +; LDCommand subroutine +; +; This subroutine is the LD command for the user. This subroutine will take in +; a memory address and a length of bytes, and will take bytes entered by the +; user and write them to memory. +; +; Input: A memory address in register X & a length of bytes in Y +; Bytes of data entered by the user on the serial console. +; Output: The data inputted into memory starting at the address in X. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine Requires PrintHexWord, ReadHexByte, & PrintHexByte. +; This subroutine will stop reading once the inputted number of bytes +; is read. +; + LDCommand pshx ; Save X to the stack pshy ; Save Y to the stack @@ -467,11 +515,38 @@ LDInvalid ldaa #CR ; Load CR into A pulx ; Restore X from the stack rts ; Return +;************************************************************************* +; GetCharLoop subroutine +; +; This subroutine will read a byte from input and will block until there is data +; to read. +; +; Input: A byte entered on the serial console. +; Output: That byte in register A. +; Registers in use: A for the byte inputted by the user. +; Memory locations in use: Memory Address for serial line +; +; Comments: This subroutine will block until the user inputs data. +; + GetCharLoop jsr getchar ; Read character from serial beq GetCharLoop ; If 0, loop rts ; Return +;************************************************************************* +; IsValidHex subroutine +; +; This subroutine set the zero bit if the given character is not valid hex. +; +; Input: An ASCII character in register A. +; Output: Zero bit set if invalid hex. (Valid if '0' <= A <= '9' or 'A' <= A <= 'F') +; Registers in use: A for the given character, CCR for output. +; Memory locations in use: No memory locations used. +; +; Comments: This subroutine only validates upper case hex. +; + IsValidHex cmpa #'0' ; Compare A to '0' blo InvalidHex ; A < '0', invalid @@ -506,7 +581,13 @@ InvalidHex orcc #%00000100 ; Set the Zero Bit ReadDecimal pshd ; Save D to the stack ldy #0 ; Clear Y register -dHLoop ldab 1,x+ ; Read Next character from X + clrb ; Clear B + stab charCount ; Clear charCount +dHLoop inc charCount ; Increment charCount by 1 + ldab charCount ; Load charCount into B + cmpb #6 ; Compare to B to 6 + bhi dHError ; B > 6, bad too many characters. + ldab 1,x+ ; Read Next character from X beq dHDone ; If B == 0, exit loop cmpb #' ' ; Compare B to space character beq dHDone ; If B == ' ', exit loop @@ -655,6 +736,19 @@ bPrintDone puld ; Restore D (A:B) from the stack pulx ; Restore X from the stack rts ; Return to caller +;************************************************************************* +; PrintHexByte subroutine +; +; This subroutine will print a given byte to serial in Hex format. +; +; Input: 1 byte of data in B +; Output: Hex representation in ASCII on serial console +; Registers in use: X for division, A and B for characters. +; Memory locations in use: Memory addresses for serial. +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + PrintHexByte pshd ; Save D to the stack pshy ; Save Y to the stack @@ -685,6 +779,19 @@ PrintDone jsr putchar ; Print character to serial puld ; Restore D from the stack rts ; Return +;************************************************************************* +; ReadHexByte subroutine +; +; This subroutine will read a hex byte from serial console into A. +; +; Input: 2 ASCII characters of Hex format on serial console. +; Output: The data in register A. +; Registers in use: A for characters and B for multiplication. +; Memory locations in use: Memory addresses for serial. +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + ReadHexByte cmpa #'A' ; Compare A to 'A' blo RHBNotHex ; If A < 'A', decimal number diff --git a/cmpen472hw12_McDonnell/bin/Project.abs b/cmpen472hw12_McDonnell/bin/Project.abs Binary files differindex 38ecb85..3945048 100644 --- a/cmpen472hw12_McDonnell/bin/Project.abs +++ b/cmpen472hw12_McDonnell/bin/Project.abs diff --git a/cmpen472hw12_McDonnell/bin/Project.abs.s19 b/cmpen472hw12_McDonnell/bin/Project.abs.s19 index 9e8e6c0..4b837f4 100644 --- a/cmpen472hw12_McDonnell/bin/Project.abs.s19 +++ b/cmpen472hw12_McDonnell/bin/Project.abs.s19 @@ -1,60 +1,61 @@ S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731325F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731C S1233000000500000000000000000000000000000000000010000000000000000000000097 -S10B3020000000000000001094 -S1233100CF310086FF5A03860C5ACBCC00015CC8CE369D1635C5CE3002FD30131635B686A9 -S12331203E1635F486201635F4CE3002FD30131635D1CE300216314C20DCCE364C1635C5DE -S12331401635FB27FB1635F45A0120F4343BA6308157182700D181511827011A814D274DBA +S10C302000000000000000100093 +S1233100CF310086FF5A03860C5ACBCC00015CC8CE36BC1635E4CE3002FD30131635D5864C +S12331203E1636138620163613CE3002FD30131635F0CE300216314C20DCCE366B1635E441 +S123314016361A27FB1636135A0120F4343BA6308157182700D181511827011A814D274D7A S1233160814C1827008C814727268153182600FDA6008124182600F516328F182700DBB769 -S1233180E534CE3002FD30131635B630182000C4A630814F182600D5A6008124182600CD96 +S1233180E534CE3002FD30131635D530182000C4A630814F182600D5A6008124182600CD77 S12331A016328F182700B31540182000AAA6308144182600B8A6008124182600B016328F6A S12331C018270096B7E43BA6301827009681201827FFF481241826008A0916328F18270036 -S12331E0823AB7C53B8D000225793A1632DA18200065A63081442675A6008124266F1632D4 +S12331E0823AB7C53B8D000225793A1632EB18200065A63081442675A6008124266F1632C3 S12332008F2757B7E43BA6302759812027F8812426510916328F274B3AB7C53B8D0001259F -S1233220423A16334A2030A6008124264016328F2728B7E43BA630272A812027F8812427CB -S123324008091633E6271C20060916328F27143AB7C56D001634133A303DCE36041635C567 -S12332603A303DCE361D1635C53A3A303DCE36331635C53A303DA630815526F1A630814940 -S123328026EBA630815426E5A63026E106313A3BCD0000E630C124263BE6302732C120273A -S12332A02EC1302D2FC139220EC03037CC001013B7C63319ED20E2C1412D19C1462215C051 -S12332C041CB0A37CC001013B7C63319ED20CA87B7023A3D8604B7023A3D34353B3435B7D9 -S12332E054CE3002FD30131635B6CD30021634F286201635F43130CC00008D0000273D03F4 -S123330003E6301634A4E6301634A4B760840F26E9860D1635F4860A1635F48D0000271C74 -S12333203435B754CE3002FD30131635B6CD30021634F286201635F4313020BE860D163597 -S1233340F4860A1635F43A31303D34353B020406571633CA810D26061635F41633CA810A1D -S1233360260D1635F41633CA810D26031633CA1635F41633D0273F180E1633CA810D260649 -S12333801635F41633CA810A260D1635F41633CA810D26031633CA1635F41633D02717B7B0 -S12333A0811634D86A3020A6860D1635F4860A1635F43A31303D860D1635F4860A1635F4EC -S12333C0CE361D1635C53A31303D1635FB27FB3D8130250F81392308814125078146220397 -S12333E010FB3D14043D3BCD0000E630271AC1202716C1302D17C1392213C03037CC000A4E -S123340013B7C63319ED20E287B7023A3D8604B7023A3D353BB7D4CD30021634F2B7C58634 -S12334203D1635F4863E1635F4EC00CE3002FD30131635B616347F3686201635F41635F4B9 -S123344032CD30021634F23686201635F41635F432CE3002FD30131635B6CD300216356480 -S1233460860D1635F4860A1635F43A313D343536A67F27056A3020F8876A303231303D3438 -S12334803B37180E86251635F4CE001055B72084018B301635F40405088E000826EE33200F -S12334A0EB3A303D3B353487CE00101810B750810A24048B3020048B41800A1635F4180FF0 -S12334C0810A24048B3020048B41800A1635F486201635F430313A3D8141250280078030E4 -S12334E037C61012180F33C1412502C007C03018063D343B358C000027533635348630CE47 -S12335003015CD00051635BF3031876A4032CE001018108E00002716C10A2D0ACB41C00A19 -S12335206B60B7D420E8CB306B60B7D420E08C000026E586246A60CE301516346D1635C5F3 -S1233540FD3026CE30151635B6313A303D86241635F486301635F41635F41635F41635F48D -S1233560313A303D343B358C000027413635348630CE3015CD00051635BF3031876A4032CF -S1233580CE000A18108E00002708CB306B60B7D420EE8C000026F3CE301516346D1635C58C -S12335A0FD3026CE30151635B6313A303D86301635F4313A303D36876A300436FB323D6A96 -S12335C0300436FB3D36A63027051635F420F7323D3635341635FB27FB810D270E810A27CC -S12335E00A6A301635F403270220E9860A1635F43031323D4FCC80FC5ACF3D4FCC2003963F -S1233600CF3D873D696E76616C696420696E7075742C20616464726573730D0A00696E7609 -S1233620616C696420696E7075742C20646174610D0A00696E76616C696420696E70757468 -S12336402C20636F6D6D616E640D0A0057656C636F6D6520746F20547970652057726974CD -S123366065722C20796F75206D617920747970652062656C6F772E0D0A526573746172741A -S123368020746F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A2039 -S12336A0202020202053686F772074686520636F6E74656E7473206F66206D656D6F727928 -S12336C0206C6F636174696F6E20696E20776F72640D0A573A202020202020577269746527 -S12336E020746865206461746120776F726420286E6F7420627974652920746F206D656DD7 -S12337006F7279206C6F636174696F6E0D0A4D443A2020202020446973706C61792074687E -S12337206520636F6E74656E7473206F6620636F6E74696E756F7573206D656D6F7279204D -S12337406C6F636174696F6E730D0A4C443A20202020204C6F6164206120626C6F636B20CC -S12337606F66206461746120746F20636F6E74696E756F7573206D656D6F7279206C6F6325 -S12337806174696F6E730D0A474F3A202020202052756E207468652070726F6772616D2042 -S12337A061742074686520737065636966696564206D656D6F7279206C6F636174696F6ED1 -S12337C00D0A515549543A2020205175697420746865206D61696E2070726F6772616D2CE4 -S11F37E02072756E2054797065207772697465722070726F6772616D2E0D0A0078 +S1233220423A16335B2030A6008124264016328F2728B7E43BA630272A812027F8812427BA +S123324008091633F7271C20060916328F27143AB7C56D001634323A303DCE36231635E4F9 +S12332603A303DCE363C1635E43A3A303DCE36521635E43A303DA630815526F1A6308149C4 +S123328026EBA630815426E5A63026E106313A3BCD0000E630877A3028C124264872302881 +S12332A0F63028C105223EE6302732C120272EC1302D32C139220EC03037CC001013B7C6E4 +S12332C03319ED20D8C1412D1CC1462218C041CB0A37CC001013B7C63319ED20C0877A306A +S12332E028B7023A3D8604B7023A3D34353B3435B754CE3002FD30131635D5CD30021635F6 +S12333001186201636133130CC00008D0000273D0303E6301634C3E6301634C3B760840F7F +S123332026E9860D163613860A1636138D0000271C3435B754CE3002FD30131635D5CD30F8 +S1233340021635118620163613313020BE860D163613860A1636133A31303D34353B020464 +S123336006571633DB810D26061636131633DB810A260D1636131633DB810D26031633DB6F +S12333801636131633E1273F180E1633DB810D26061636131633DB810A260D16361316334D +S12333A0DB810D26031633DB1636131633E12717B7811634F76A3020A6860D163613860A31 +S12333C01636133A31303D860D163613860A163613CE363C1635E43A31303D16361A27FB02 +S12333E03D8130250F81392308814125078146220310FB3D14043D3BCD0000C77B30287237 +S12334003028F63028C1062223E630271AC1202716C1302D17C1392213C03037CC000A130D +S1233420B7C63319ED20D887B7023A3D8604B7023A3D353BB7D4CD3002163511B7C5863DD4 +S1233440163613863E163613EC00CE3002FD30131635D516349E36862016361316361332E6 +S1233460CD300216351136862016361316361332CE3002FD30131635D5CD3002163583866E +S12334800D163613860A1636133A313D343536A67F27056A3020F8876A303231303D343B23 +S12334A037180E8625163613CE001055B72084018B301636130405088E000826EE3320EBFF +S12334C03A303D3B353487CE00101810B750810A24048B3020048B41800A163613180F811A +S12334E00A24048B3020048B41800A163613862016361330313A3D814125028007803037CE +S1233500C61012180F33C1412502C007C03018063D343B358C000027533635348630CE302D +S123352015CD00051635DE3031876A4032CE001018108E00002716C10A2D0ACB41C00A6B9F +S123354060B7D420E8CB306B60B7D420E08C000026E586246A60CE301516348C1635E4FD03 +S12335603026CE30151635D5313A303D86241636138630163613163613163613163613317A +S12335803A303D343B358C000027413635348630CE3015CD00051635DE3031876A4032CEF3 +S12335A0000A18108E00002708CB306B60B7D420EE8C000026F3CE301516348C1635E4FDFF +S12335C03026CE30151635D5313A303D8630163613313A303D36876A300436FB323D6A3004 +S12335E00436FB3D36A630270516361320F7323D36353416361A27FB810D270E810A270A92 +S12336006A3016361303270220E9860A1636133031323D4FCC80FC5ACF3D4FCC200396CF19 +S12336203D873D696E76616C696420696E7075742C20616464726573730D0A00696E766157 +S12336406C696420696E7075742C20646174610D0A00696E76616C696420696E7075742C7D +S123366020636F6D6D616E640D0A0057656C636F6D6520746F205479706520577269746574 +S1233680722C20796F75206D617920747970652062656C6F772E0D0A52657374617274203F +S12336A0746F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A202019 +S12336C02020202053686F772074686520636F6E74656E7473206F66206D656D6F72792008 +S12336E06C6F636174696F6E20696E20776F72640D0A573A20202020202057726974652007 +S1233700746865206461746120776F726420286E6F7420627974652920746F206D656D6F67 +S12337207279206C6F636174696F6E0D0A4D443A2020202020446973706C61792074686568 +S123374020636F6E74656E7473206F6620636F6E74696E756F7573206D656D6F7279206C26 +S12337606F636174696F6E730D0A4C443A20202020204C6F6164206120626C6F636B206FA9 +S123378066206461746120746F20636F6E74696E756F7573206D656D6F7279206C6F636113 +S12337A074696F6E730D0A474F3A202020202052756E207468652070726F6772616D206122 +S12337C0742074686520737065636966696564206D656D6F7279206C6F636174696F6E0D05 +S12337E00A515549543A2020205175697420746865206D61696E2070726F6772616D2C20B1 +S11E380072756E2054797065207772697465722070726F6772616D2E0D0A0078 S9030000FC diff --git a/cmpen472hw12_McDonnell/bin/main.dbg b/cmpen472hw12_McDonnell/bin/main.dbg index 612030a..c62f7ac 100644 --- a/cmpen472hw12_McDonnell/bin/main.dbg +++ b/cmpen472hw12_McDonnell/bin/main.dbg @@ -2,11 +2,11 @@ * * Title: Memory Monitor * -* Objective: CMPEN 472 Homework 6 +* Objective: CMPEN 472 Homework 12 * * Revision: V1.0 * -* Date: Feb. 28, 2025 +* Date: APR. 25, 2025 * * Programmer: Jacob McDonnell * @@ -29,8 +29,10 @@ * * Observation: This program will prompt the user to print the contents of a * memory location and to modify the location with hexadecimal or -* decimal data. If the user wishes, they can type 'QUIT' to exit -* the memory monitor and enter the type writer program. +* decimal data. The user can also load in chunks of data and +* print chunks of memory. If the user wishes, they can type +* 'QUIT' to exit the memory monitor and enter the type writer +* program. * * Note: ON CSM-12C128 board, * @@ -61,6 +63,7 @@ CR equ $0d ; carriage return, ASCII 'Return' key LF equ $0a ; line feed, ASCII 'next line' character NULL equ $00 ; NULL Terminator character +* ************************************************************************** * Data Section: address used [ $3000 to $30FF ] RAM Memory * @@ -77,6 +80,8 @@ buffer2 ds.b $0010 ; Array of 16 bytes for reading and reve dc.b NULL ; NULL terminated lenBuf2 dc.w $0010 ; length of buffer2 +charCount dc.b $00 ; Number of characters read by ReadHex + * * There is a section Data Section at the end of the file ************************************************************************** @@ -311,9 +316,15 @@ ReadHex pshd ; Save D to the stack ldy #0 ; Clear Y register ldab 1,x+ ; Read character from X into B, add 1 to X + clra ; clear A accumulator + staa charCount ; Clear charCount cmpb #'$' ; Compare B to '$' bne rHError ; If B != '$', jump to error, not hex data -rHLoop ldab 1,x+ ; Read Next character from X +rHLoop inc charCount ; Increment charCount by 1 + ldab charCount ; Load charCount into B + cmpb #5 ; At most 4 hex digits to read + bhi rHError ; If charCount > 5, error + ldab 1,x+ ; Read Next character from X beq rHDone ; If B == 0, exit loop cmpb #' ' ; Compare B to space character beq rHDone ; If B == ' ', exit loop @@ -343,6 +354,7 @@ rHAlpha cmpb #'A' ; Compare B to 'A' character aby ; Add B to Y bra rHLoop ; Branch always to rHLoop rHDone clra ; clear A accumulator + staa charCount ; Clear charCount tap ; Transfer A into CCR to clear zero bit puld ; Restore D from the stack rts ; Return to caller @@ -351,6 +363,23 @@ rHError ldaa #4 ; Load 4 into A to set zero bit in CCR puld ; Restore D from the stack rts ; Return to caller +;************************************************************************* +; MDCommand subroutine +; +; This subroutine is the MD command for the user. This subroutine will take in +; a memory address and a length of bytes, and will print the bytes starting at +; that memory location in 16 byte line segments. +; +; Input: A memory address in register X & a length of bytes in Y +; Output: The data in memory starting at the address in X in 16 +; byte line segments on the serial console. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine Requires PrintHexWord & PrintHexByte. +; + MDCommand pshx ; Save X to the stack pshy ; Save Y to the stack @@ -407,6 +436,25 @@ MDDone ldaa #CR ; Load CR into A pulx ; Restore X from the stack rts ; Return +;************************************************************************* +; LDCommand subroutine +; +; This subroutine is the LD command for the user. This subroutine will take in +; a memory address and a length of bytes, and will take bytes entered by the +; user and write them to memory. +; +; Input: A memory address in register X & a length of bytes in Y +; Bytes of data entered by the user on the serial console. +; Output: The data inputted into memory starting at the address in X. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine Requires PrintHexWord, ReadHexByte, & PrintHexByte. +; This subroutine will stop reading once the inputted number of bytes +; is read. +; + LDCommand pshx ; Save X to the stack pshy ; Save Y to the stack @@ -467,11 +515,38 @@ LDInvalid ldaa #CR ; Load CR into A pulx ; Restore X from the stack rts ; Return +;************************************************************************* +; GetCharLoop subroutine +; +; This subroutine will read a byte from input and will block until there is data +; to read. +; +; Input: A byte entered on the serial console. +; Output: That byte in register A. +; Registers in use: A for the byte inputted by the user. +; Memory locations in use: Memory Address for serial line +; +; Comments: This subroutine will block until the user inputs data. +; + GetCharLoop jsr getchar ; Read character from serial beq GetCharLoop ; If 0, loop rts ; Return +;************************************************************************* +; IsValidHex subroutine +; +; This subroutine set the zero bit if the given character is not valid hex. +; +; Input: An ASCII character in register A. +; Output: Zero bit set if invalid hex. (Valid if '0' <= A <= '9' or 'A' <= A <= 'F') +; Registers in use: A for the given character, CCR for output. +; Memory locations in use: No memory locations used. +; +; Comments: This subroutine only validates upper case hex. +; + IsValidHex cmpa #'0' ; Compare A to '0' blo InvalidHex ; A < '0', invalid @@ -506,7 +581,13 @@ InvalidHex orcc #%00000100 ; Set the Zero Bit ReadDecimal pshd ; Save D to the stack ldy #0 ; Clear Y register -dHLoop ldab 1,x+ ; Read Next character from X + clrb ; Clear B + stab charCount ; Clear charCount +dHLoop inc charCount ; Increment charCount by 1 + ldab charCount ; Load charCount into B + cmpb #6 ; Compare to B to 6 + bhi dHError ; B > 6, bad too many characters. + ldab 1,x+ ; Read Next character from X beq dHDone ; If B == 0, exit loop cmpb #' ' ; Compare B to space character beq dHDone ; If B == ' ', exit loop @@ -655,6 +736,19 @@ bPrintDone puld ; Restore D (A:B) from the stack pulx ; Restore X from the stack rts ; Return to caller +;************************************************************************* +; PrintHexByte subroutine +; +; This subroutine will print a given byte to serial in Hex format. +; +; Input: 1 byte of data in B +; Output: Hex representation in ASCII on serial console +; Registers in use: X for division, A and B for characters. +; Memory locations in use: Memory addresses for serial. +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + PrintHexByte pshd ; Save D to the stack pshy ; Save Y to the stack @@ -685,6 +779,19 @@ PrintDone jsr putchar ; Print character to serial puld ; Restore D from the stack rts ; Return +;************************************************************************* +; ReadHexByte subroutine +; +; This subroutine will read a hex byte from serial console into A. +; +; Input: 2 ASCII characters of Hex format on serial console. +; Output: The data in register A. +; Registers in use: A for characters and B for multiplication. +; Memory locations in use: Memory addresses for serial. +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + ReadHexByte cmpa #'A' ; Compare A to 'A' blo RHBNotHex ; If A < 'A', decimal number diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o Binary files differindex 38ecb85..3945048 100644 --- a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o +++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx index da89c39..e53f5b0 100644 --- a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx +++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx @@ -1,60 +1,61 @@ S0860000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731325F4D63446F6E6E656C6C5C636D70656E343732687731325F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726D71 S1233000000500000000000000000000000000000000000010000000000000000000000097 -S10B3020000000000000001094 -S1233100CF310086FF5A03860C5ACBCC00015CC8CE369D1635C5CE3002FD30131635B686A9 -S12331203E1635F486201635F4CE3002FD30131635D1CE300216314C20DCCE364C1635C5DE -S12331401635FB27FB1635F45A0120F4343BA6308157182700D181511827011A814D274DBA +S10C302000000000000000100093 +S1233100CF310086FF5A03860C5ACBCC00015CC8CE36BC1635E4CE3002FD30131635D5864C +S12331203E1636138620163613CE3002FD30131635F0CE300216314C20DCCE366B1635E441 +S123314016361A27FB1636135A0120F4343BA6308157182700D181511827011A814D274D7A S1233160814C1827008C814727268153182600FDA6008124182600F516328F182700DBB769 -S1233180E534CE3002FD30131635B630182000C4A630814F182600D5A6008124182600CD96 +S1233180E534CE3002FD30131635D530182000C4A630814F182600D5A6008124182600CD77 S12331A016328F182700B31540182000AAA6308144182600B8A6008124182600B016328F6A S12331C018270096B7E43BA6301827009681201827FFF481241826008A0916328F18270036 -S12331E0823AB7C53B8D000225793A1632DA18200065A63081442675A6008124266F1632D4 +S12331E0823AB7C53B8D000225793A1632EB18200065A63081442675A6008124266F1632C3 S12332008F2757B7E43BA6302759812027F8812426510916328F274B3AB7C53B8D0001259F -S1233220423A16334A2030A6008124264016328F2728B7E43BA630272A812027F8812427CB -S123324008091633E6271C20060916328F27143AB7C56D001634133A303DCE36041635C567 -S12332603A303DCE361D1635C53A3A303DCE36331635C53A303DA630815526F1A630814940 -S123328026EBA630815426E5A63026E106313A3BCD0000E630C124263BE6302732C120273A -S12332A02EC1302D2FC139220EC03037CC001013B7C63319ED20E2C1412D19C1462215C051 -S12332C041CB0A37CC001013B7C63319ED20CA87B7023A3D8604B7023A3D34353B3435B7D9 -S12332E054CE3002FD30131635B6CD30021634F286201635F43130CC00008D0000273D03F4 -S123330003E6301634A4E6301634A4B760840F26E9860D1635F4860A1635F48D0000271C74 -S12333203435B754CE3002FD30131635B6CD30021634F286201635F4313020BE860D163597 -S1233340F4860A1635F43A31303D34353B020406571633CA810D26061635F41633CA810A1D -S1233360260D1635F41633CA810D26031633CA1635F41633D0273F180E1633CA810D260649 -S12333801635F41633CA810A260D1635F41633CA810D26031633CA1635F41633D02717B7B0 -S12333A0811634D86A3020A6860D1635F4860A1635F43A31303D860D1635F4860A1635F4EC -S12333C0CE361D1635C53A31303D1635FB27FB3D8130250F81392308814125078146220397 -S12333E010FB3D14043D3BCD0000E630271AC1202716C1302D17C1392213C03037CC000A4E -S123340013B7C63319ED20E287B7023A3D8604B7023A3D353BB7D4CD30021634F2B7C58634 -S12334203D1635F4863E1635F4EC00CE3002FD30131635B616347F3686201635F41635F4B9 -S123344032CD30021634F23686201635F41635F432CE3002FD30131635B6CD300216356480 -S1233460860D1635F4860A1635F43A313D343536A67F27056A3020F8876A303231303D3438 -S12334803B37180E86251635F4CE001055B72084018B301635F40405088E000826EE33200F -S12334A0EB3A303D3B353487CE00101810B750810A24048B3020048B41800A1635F4180FF0 -S12334C0810A24048B3020048B41800A1635F486201635F430313A3D8141250280078030E4 -S12334E037C61012180F33C1412502C007C03018063D343B358C000027533635348630CE47 -S12335003015CD00051635BF3031876A4032CE001018108E00002716C10A2D0ACB41C00A19 -S12335206B60B7D420E8CB306B60B7D420E08C000026E586246A60CE301516346D1635C5F3 -S1233540FD3026CE30151635B6313A303D86241635F486301635F41635F41635F41635F48D -S1233560313A303D343B358C000027413635348630CE3015CD00051635BF3031876A4032CF -S1233580CE000A18108E00002708CB306B60B7D420EE8C000026F3CE301516346D1635C58C -S12335A0FD3026CE30151635B6313A303D86301635F4313A303D36876A300436FB323D6A96 -S12335C0300436FB3D36A63027051635F420F7323D3635341635FB27FB810D270E810A27CC -S12335E00A6A301635F403270220E9860A1635F43031323D4FCC80FC5ACF3D4FCC2003963F -S1233600CF3D873D696E76616C696420696E7075742C20616464726573730D0A00696E7609 -S1233620616C696420696E7075742C20646174610D0A00696E76616C696420696E70757468 -S12336402C20636F6D6D616E640D0A0057656C636F6D6520746F20547970652057726974CD -S123366065722C20796F75206D617920747970652062656C6F772E0D0A526573746172741A -S123368020746F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A2039 -S12336A0202020202053686F772074686520636F6E74656E7473206F66206D656D6F727928 -S12336C0206C6F636174696F6E20696E20776F72640D0A573A202020202020577269746527 -S12336E020746865206461746120776F726420286E6F7420627974652920746F206D656DD7 -S12337006F7279206C6F636174696F6E0D0A4D443A2020202020446973706C61792074687E -S12337206520636F6E74656E7473206F6620636F6E74696E756F7573206D656D6F7279204D -S12337406C6F636174696F6E730D0A4C443A20202020204C6F6164206120626C6F636B20CC -S12337606F66206461746120746F20636F6E74696E756F7573206D656D6F7279206C6F6325 -S12337806174696F6E730D0A474F3A202020202052756E207468652070726F6772616D2042 -S12337A061742074686520737065636966696564206D656D6F7279206C6F636174696F6ED1 -S12337C00D0A515549543A2020205175697420746865206D61696E2070726F6772616D2CE4 -S11F37E02072756E2054797065207772697465722070726F6772616D2E0D0A0078 +S1233220423A16335B2030A6008124264016328F2728B7E43BA630272A812027F8812427BA +S123324008091633F7271C20060916328F27143AB7C56D001634323A303DCE36231635E4F9 +S12332603A303DCE363C1635E43A3A303DCE36521635E43A303DA630815526F1A6308149C4 +S123328026EBA630815426E5A63026E106313A3BCD0000E630877A3028C124264872302881 +S12332A0F63028C105223EE6302732C120272EC1302D32C139220EC03037CC001013B7C6E4 +S12332C03319ED20D8C1412D1CC1462218C041CB0A37CC001013B7C63319ED20C0877A306A +S12332E028B7023A3D8604B7023A3D34353B3435B754CE3002FD30131635D5CD30021635F6 +S12333001186201636133130CC00008D0000273D0303E6301634C3E6301634C3B760840F7F +S123332026E9860D163613860A1636138D0000271C3435B754CE3002FD30131635D5CD30F8 +S1233340021635118620163613313020BE860D163613860A1636133A31303D34353B020464 +S123336006571633DB810D26061636131633DB810A260D1636131633DB810D26031633DB6F +S12333801636131633E1273F180E1633DB810D26061636131633DB810A260D16361316334D +S12333A0DB810D26031633DB1636131633E12717B7811634F76A3020A6860D163613860A31 +S12333C01636133A31303D860D163613860A163613CE363C1635E43A31303D16361A27FB02 +S12333E03D8130250F81392308814125078146220310FB3D14043D3BCD0000C77B30287237 +S12334003028F63028C1062223E630271AC1202716C1302D17C1392213C03037CC000A130D +S1233420B7C63319ED20D887B7023A3D8604B7023A3D353BB7D4CD3002163511B7C5863DD4 +S1233440163613863E163613EC00CE3002FD30131635D516349E36862016361316361332E6 +S1233460CD300216351136862016361316361332CE3002FD30131635D5CD3002163583866E +S12334800D163613860A1636133A313D343536A67F27056A3020F8876A303231303D343B23 +S12334A037180E8625163613CE001055B72084018B301636130405088E000826EE3320EBFF +S12334C03A303D3B353487CE00101810B750810A24048B3020048B41800A163613180F811A +S12334E00A24048B3020048B41800A163613862016361330313A3D814125028007803037CE +S1233500C61012180F33C1412502C007C03018063D343B358C000027533635348630CE302D +S123352015CD00051635DE3031876A4032CE001018108E00002716C10A2D0ACB41C00A6B9F +S123354060B7D420E8CB306B60B7D420E08C000026E586246A60CE301516348C1635E4FD03 +S12335603026CE30151635D5313A303D86241636138630163613163613163613163613317A +S12335803A303D343B358C000027413635348630CE3015CD00051635DE3031876A4032CEF3 +S12335A0000A18108E00002708CB306B60B7D420EE8C000026F3CE301516348C1635E4FDFF +S12335C03026CE30151635D5313A303D8630163613313A303D36876A300436FB323D6A3004 +S12335E00436FB3D36A630270516361320F7323D36353416361A27FB810D270E810A270A92 +S12336006A3016361303270220E9860A1636133031323D4FCC80FC5ACF3D4FCC200396CF19 +S12336203D873D696E76616C696420696E7075742C20616464726573730D0A00696E766157 +S12336406C696420696E7075742C20646174610D0A00696E76616C696420696E7075742C7D +S123366020636F6D6D616E640D0A0057656C636F6D6520746F205479706520577269746574 +S1233680722C20796F75206D617920747970652062656C6F772E0D0A52657374617274203F +S12336A0746F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A202019 +S12336C02020202053686F772074686520636F6E74656E7473206F66206D656D6F72792008 +S12336E06C6F636174696F6E20696E20776F72640D0A573A20202020202057726974652007 +S1233700746865206461746120776F726420286E6F7420627974652920746F206D656D6F67 +S12337207279206C6F636174696F6E0D0A4D443A2020202020446973706C61792074686568 +S123374020636F6E74656E7473206F6620636F6E74696E756F7573206D656D6F7279206C26 +S12337606F636174696F6E730D0A4C443A20202020204C6F6164206120626C6F636B206FA9 +S123378066206461746120746F20636F6E74696E756F7573206D656D6F7279206C6F636113 +S12337A074696F6E730D0A474F3A202020202052756E207468652070726F6772616D206122 +S12337C0742074686520737065636966696564206D656D6F7279206C6F636174696F6E0D05 +S12337E00A515549543A2020205175697420746865206D61696E2070726F6772616D2C20B1 +S11E380072756E2054797065207772697465722070726F6772616D2E0D0A0078 S9033100CB diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt Binary files differindex 966f494..21bc32d 100644 --- a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt +++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt |
