summaryrefslogtreecommitdiff
path: root/cmpen472hw6_McDonnell/bin
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-22 16:37:23 -0500
committerJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-22 16:37:23 -0500
commitaf63abc10dbbe56586513b090b044d6c345b56e7 (patch)
treeeb2ff09fda7d96525d98d3b28061d432748febb2 /cmpen472hw6_McDonnell/bin
parent608e76a2a7031713290720c23411bad182570a96 (diff)
HW6 Finished (Needs Testing)
Diffstat (limited to 'cmpen472hw6_McDonnell/bin')
-rw-r--r--cmpen472hw6_McDonnell/bin/Project.absbin7090 -> 7674 bytes
-rw-r--r--cmpen472hw6_McDonnell/bin/Project.abs.s1967
-rw-r--r--cmpen472hw6_McDonnell/bin/main.dbg147
3 files changed, 120 insertions, 94 deletions
diff --git a/cmpen472hw6_McDonnell/bin/Project.abs b/cmpen472hw6_McDonnell/bin/Project.abs
index 45904b8..7b911f3 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 e6448e5..01ad9e1 100644
--- a/cmpen472hw6_McDonnell/bin/Project.abs.s19
+++ b/cmpen472hw6_McDonnell/bin/Project.abs.s19
@@ -3,37 +3,38 @@ S1233000003605000000000000000000000000000000000000100000000000000000000061
S1233020000000000000000010696E76616C696420696E7075742C20616464726573730D06
S12330400A00696E76616C696420696E7075742C20646174610D0A00696E76616C69642027
S1143060696E7075742C20636F6D6D616E640D0A00E9
-S1233100CF310086F15A03860C5ACBCC00015CC88612C6CDCD30031632B5CE3003FD3014C5
-S1233120163327860D16335B860A16335B86FFC6FFCD30031632F7CE3003FD301416332775
-S1233140860D16335B860A16335BCE3000163227CE3003FD3014163327CE3003FD30141689
-S1233160333CCE30031631F120A6CE33D5163330CE3003FD3014163327CE3003FD30141684
-S1233180333CCE300316319C2086CE338416333016336227FB16335B5A0120F43D343BCDDB
-S12331A00000E630C124263CE6302732C120272EC1302D30C139220EC03037CC001013B7C4
-S12331C0C63319ED20E2C1412D1AC1462216C041CB0A37CC001013B7C63319ED20CA87B788
-S12331E0023A303DCE30291633308604B7023A303D343BCD0000E630271AC1202716C130F6
-S12332002D18C1392214C03037CC000A13B7C63319ED20E287B7023A303DCE3029163330E6
-S12332208604B7023A303D353BB7D4CD30031632B5B7C5863D16335B863E16335BEC00CEA3
-S12332403003FD301416332716329036862016335B16335B32CD30031632B5368620163336
-S12332605B16335B32CE3003FD3014163327CD30031632F7860D16335B860A16335B3A3152
-S12332803D343536A67F27046A3020F83231303D343B37180E862516335BCE001055B72057
-S12332A084018B3016335B0405088E000826EE3320EB3A303D343B35CE001018108E00004E
-S12332C02716C10A2D0ACB41C00A6B60B7D420E8CB306B60B7D420E08C000026E586246A7B
-S12332E060CE3016163281163330FD3027CE3016163327313A303D343B35CE000A18108E32
-S123330000002708CB306B60B7D420EE8C000026F3CE3016163281163330FD3027CE3016B8
-S1233320163327313A303D36876A300436FB323D36A630270516335B20F7323D363534162F
-S1233340336227FB810D270A6A3016335B03270220ED860A16335B3031323D4FCC80FC5A87
-S1233360CF3D4FCC200396CF3D873D4572726F723A20556E6B6E6F776E20436F6D6D616ECA
-S1233380640D0A0057656C636F6D6520746F2054797065205772697465722C20796F7520B7
-S12333A06D617920747970652062656C6F772E0D0A5265737461727420746F20656E7465AE
-S12333C072206D61696E206D656E7520616761696E2E0D0A004C313A205475726E206F6EFB
-S12333E0204C4544310D0A46313A205475726E206F6666204C4544310D0A4C323A205475D9
-S1233400726E206F6E204C4544320D0A46323A205475726E206F6666204C4544320D0A4C2D
-S1233420333A205475726E206F6E204C4544330D0A46333A205475726E206F6666204C458E
-S123344044330D0A4C343A204C45443420676F65732066726F6D203025206C696768742088
-S12334606C6576656C20746F2031303025206C69676874206C6576656C20696E20302E343E
-S1233480207365636F6E64730D0A46343A204C45443420676F65732066726F6D20313030D2
-S12334A025206C69676874206C6576656C20746F203025206C69676874206C6576656C206B
-S12334C0696E20302E34207365636F6E64730D0A515549543A2051756974206D656E752004
-S12334E070726F6772616D2C2072756E2054797065207772697465722070726F6772616D98
-S10735002E0D0A007E
+S1233100CF310086F15A03860C5ACBCC00015CC8CE3003FD3014163352863E163386862019
+S1233120163386CE3003FD3014163367CE300316314620DCCE33AF16335B16338D27FB16DE
+S123314033865A0120F4343BA630815727258151276F81532662A6008124265C1631DA2701
+S123316044B7E534CE3003FD301416335230163252202FA6008124263F1631DA2727B7E487
+S12331803BA6302729812027F88124270809163225271B2006091631DA27133AB7C56D00D1
+S12331A020003A303DCE302916335B3A303DCE304216335B3A3A303DCE305816335B3A30A9
+S12331C03DA630815526F1A630814926EBA630815426E5A63026E10631343BCD0000E6301E
+S12331E0C124263BE6302732C120272EC1302D2FC139220EC03037CC001013B7C63319ED9D
+S123320020E2C1412D19C1462215C041CB0A37CC001013B7C63319ED20CA87B7023A3D8649
+S123322004B7023A3D3BCD0000E630271AC1202716C1302D17C1392213C03037CC000A1365
+S1233240B7C63319ED20E287B7023A3D8604B7023A3D353BB7D4CD30031632E0B7C5863DDF
+S1233260163386863E163386EC00CE3003FD30141633521632BB3686201633861633863270
+S1233280CD30031632E036862016338616338632CE3003FD3014163352CD30031633228688
+S12332A00D163386860A1633863A313D343536A67F27046A3020F83231303D343B37180EEA
+S12332C08625163386CE001055B72084018B301633860405088E000826EE3320EB3A303DB7
+S12332E0343B35CE001018108E00002716C10A2D0ACB41C00A6B60B7D420E8CB306B60B7A2
+S1233300D420E08C000026E586246A60CE30161632AC16335BFD3027CE3016163352313AB0
+S1233320303D343B35CE000A18108E00002708CB306B60B7D420EE8C000026F3CE3016168D
+S123334032AC16335BFD3027CE3016163352313A303D36876A300436FB323D36A6302705D9
+S123336016338620F7323D36353416338D27FB810D270A6A3016338603270220ED860A1656
+S123338033863031323D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6B6D
+S12333A06E6F776E20436F6D6D616E640D0A0057656C636F6D6520746F2054797065205749
+S12333C072697465722C20796F75206D617920747970652062656C6F772E0D0A52657374B5
+S12333E061727420746F20656E746572206D61696E206D656E7520616761696E2E0D0A0042
+S12334004C313A205475726E206F6E204C4544310D0A46313A205475726E206F6666204CAD
+S12334204544310D0A4C323A205475726E206F6E204C4544320D0A46323A205475726E2060
+S12334406F6666204C4544320D0A4C333A205475726E206F6E204C4544330D0A46333A205E
+S12334605475726E206F6666204C4544330D0A4C343A204C45443420676F65732066726FED
+S12334806D203025206C69676874206C6576656C20746F2031303025206C69676874206C39
+S12334A06576656C20696E20302E34207365636F6E64730D0A46343A204C45443420676FBA
+S12334C065732066726F6D2031303025206C69676874206C6576656C20746F203025206CF2
+S12334E069676874206C6576656C20696E20302E34207365636F6E64730D0A515549543A98
+S12335002051756974206D656E752070726F6772616D2C2072756E20547970652077726922
+S11235207465722070726F6772616D2E0D0A00F0
S9030000FC
diff --git a/cmpen472hw6_McDonnell/bin/main.dbg b/cmpen472hw6_McDonnell/bin/main.dbg
index 3cd2193..34c58c5 100644
--- a/cmpen472hw6_McDonnell/bin/main.dbg
+++ b/cmpen472hw6_McDonnell/bin/main.dbg
@@ -110,63 +110,21 @@ pgstart lds #$3100 ; initialize the stack pointer
mainLoop
- ldaa #$12
- ldab #$CD
- ldy #buffer
- jsr PrintHexWord
-
- ldx #buffer
- ldy lenBuf
- jsr Zeros
-
- ldaa #CR
- jsr putchar
- ldaa #LF
- jsr putchar
-
- ldaa #$FF
- ldab #$FF
- ldy #buffer
- jsr PrintDecimalWord
-
- ldx #buffer
- ldy lenBuf
- jsr Zeros
-
- ldaa #CR
- jsr putchar
- ldaa #LF
- jsr putchar
-
- ldx #Counter
- jsr PrintMem
-
ldx #buffer
ldy lenBuf
jsr Zeros
+
+ ldaa #'>' ; Load '>' into A
+ jsr putchar ; Jump to putchar to write to console
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Jump to putchar to write to console
ldx #buffer
ldy lenBuf
jsr ReadString
ldx #buffer
- jsr ReadDecimal
-
- bra mainLoop
-
- ldx #msg ; Load the address of msg into X
- jsr WriteString ; Jump to WriteString to output message on serial
-
- ldx #buffer ; Load the address of buffer into X
- ldy lenBuf ; Load length of buffer into Y
- jsr Zeros ; jump to Zeros to zero out buffer
-
- ldx #buffer ; Reload address of buffer into X
- ldy lenBuf ; Load the length of the buffer into Y
- jsr ReadString ; Jump to ReadString to read user input into buffer
-
- ldx #buffer ; Reload Address of buffer into X
- jsr CheckInput ; Jump to CheckInput to handle user input
+ jsr CheckInput
bra mainLoop ; Loop back to mainLoop always
TypeWriter ldx #twMsg ; Load Type Writer welcome message address
jsr WriteString ; Jump to WriteString to write message to serial
@@ -192,11 +150,88 @@ twReadLoop jsr getchar ; Read Character from Serial
; Memory locations in use: Memory Address for serial line, address of the string
;
; Comments: This subroutine will not return a value, it will jump to the proper subroutine
-; based on the input given.
+; based on the input given. If "QUIT" is the command, this subroutine will jump
+; to TypeWriter which will not return and needs to be restarted to exit.
;
CheckInput
+ pshx ; Save X to the stack
+ pshd ; Save D to the stack
+ ldaa 1,x+ ; Read Character from the string in X
+ cmpa #'W' ; Compare Character to 'W'
+ beq cWrite ; If A == 'W', branch to cWrite
+ cmpa #'Q' ; Compare A to 'Q'
+ beq cTypeWrite ; If A == 'Q', branch to cTypeWrite
+ cmpa #'S' ; Compare A to 'S'
+ bne cUnknownCMD ; If A != 'S', Command unknown
+ ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,X ; Exchange Y for X
+ pshx ; Save X to the stack
+ ldx #buffer ; Load address of buffer into X
+ ldy lenBuf ; Loadd length of the buffer into Y
+ jsr Zeros ; Fill buffer with Zeros
+ pulx ; Restore X from the stack
+ jsr PrintMem ; Print the data at the memory address
+ bra cDone ; branch always to cDone
+cWrite ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,D ; Exchange Y and D
+ pshd ; Save D to the stack
+skipSpaces ldaa 1,x+ ; Load next character into A
+ beq cBadData ; If A == 0, branch to bad Data (no data given)
+ cmpa #' ' ; Compare A to space character
+ beq skipSpaces ; While A == ' ', loop to skip spaces
+ cmpa #'$' ; Compare A to '$'
+ beq cHexData ; If A == '$', branch to cHexData
+ dex ; Decrement X by 1
+ jsr ReadDecimal ; Jump to ReadDecimal
+ beq cBadData ; If Z == 1, branch to cBadData
+ bra cWriteData ; Branch always to cWriteData
+cHexData dex ; Decrement X by 1
+ jsr ReadHex ; Jump to ReadHex to read hex data
+ beq cBadData ; If Z == 1, branch to cBadData
+cWriteData puld ; Restore D from the stack
+ exg D,X ; Exchange D and X
+ sty x ; Write data in Y to memory in X
+ bra cDone ; Branch always to cDone
+cDone puld ; Restore D from the stack
+ pulx ; Restore X from the stack
rts ; Return to caller
+cBadAddr ldx #badAddr ; Load the address of badAddr into X
+ jsr WriteString ; Write badAddr to seriel console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadData ldx #badData ; Load the address of badData into X
+ jsr WriteString ; Write badData to seriel console
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cUnknownCMD ldx #badCom ; Load the address of badCom into X
+ jsr WriteString ; Write badCom to the serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cTypeWrite ldaa 1,x+ ; Load next character from X
+ cmpa #'U' ; Compare A to 'U'
+ bne cUnknownCMD ; If A != 'U', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'I' ; Compare A to 'I'
+ bne cUnknownCMD ; If A != 'I', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'T' ; Compare A to 'T'
+ bne cUnknownCMD ; If A != 'T', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ bne cUnknownCMD ; If A != 0, branch to unknown command
+ jmp TypeWriter ; Jump to TypeWriter
;*************************************************************************
; ReadHex subroutine
@@ -216,7 +251,6 @@ CheckInput
;
ReadHex
- pshx ; Save X to the stack
pshd ; Save D to the stack
ldy #0 ; Clear Y register
ldab 1,x+ ; Read character from X into B, add 1 to X
@@ -254,14 +288,10 @@ rHAlpha cmpb #'A' ; Compare B to 'A' character
rHDone clra ; clear A accumulator
tap ; Transfer A into CCR to clear zero bit
puld ; Restore D from the stack
- pulx ; Restore X from the stack
rts ; Return to caller
-rHError ldx #badAddr ; Load address of bad address string into X
- jsr WriteString ; Write string to seriel output
- ldaa #4 ; Load 4 into A to set zero bit in CCR
+rHError ldaa #4 ; Load 4 into A to set zero bit in CCR
tap ; Transfer A into CCR to set zero bit and warn error
puld ; Restore D from the stack
- pulx ; Restore X from the stack
rts ; Return to caller
;*************************************************************************
@@ -282,7 +312,6 @@ rHError ldx #badAddr ; Load address of bad address string int
;
ReadDecimal
- pshx ; Save X to the stack
pshd ; Save D to the stack
ldy #0 ; Clear Y register
dHLoop ldab 1,x+ ; Read Next character from X
@@ -304,14 +333,10 @@ dHLoop ldab 1,x+ ; Read Next character from X
dHDone clra ; clear A accumulator
tap ; Transfer A into CCR to clear zero bit
puld ; Restore D from the stack
- pulx ; Restore X from the stack
rts ; Return to caller
-dHError ldx #badAddr ; Load address of bad address string into X
- jsr WriteString ; Write string to seriel output
- ldaa #4 ; Load 4 into A to set zero bit in CCR
+dHError ldaa #4 ; Load 4 into A to set zero bit in CCR
tap ; Transfer A into CCR to set zero bit and warn error
puld ; Restore D from the stack
- pulx ; Restore X from the stack
rts ; Return to caller
;*************************************************************************