summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-20 21:12:37 -0500
committerJacob McDonnell <jacob@jacobmcdonnell.com>2025-02-20 21:12:37 -0500
commit7b229a479e8951d6ef4a738ac22ef46ca33808eb (patch)
treec02d0c5d4085e02a20c298ee61d91daeec7e4813
parent2ed987d75b46bac8457b2836b3bd64dcc77ea90c (diff)
HW 5 Rewrite
-rw-r--r--cmpen472hw5_McDonnell/Sources/main.asm193
-rw-r--r--cmpen472hw5_McDonnell/bin/Project.absbin7222 -> 6442 bytes
-rw-r--r--cmpen472hw5_McDonnell/bin/Project.abs.s1952
-rw-r--r--cmpen472hw5_McDonnell/bin/main.dbg181
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.obin7222 -> 6442 bytes
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx52
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdtbin64875 -> 64353 bytes
7 files changed, 165 insertions, 313 deletions
diff --git a/cmpen472hw5_McDonnell/Sources/main.asm b/cmpen472hw5_McDonnell/Sources/main.asm
index 7991c58..1ca3e7e 100644
--- a/cmpen472hw5_McDonnell/Sources/main.asm
+++ b/cmpen472hw5_McDonnell/Sources/main.asm
@@ -131,8 +131,8 @@ twReadLoop jsr getchar ; Read Character from Serial
;
; Input: Address of null terminated string in X.
; Output: No Output, Control flow changed to proper subroutine.
-; Registers in use: X for the address of the string, Y for the address of the
-; option to compare against, and A for the return value of strcmp
+; Registers in use: X for the address of the string, A & B to read characters from
+; from the string.
; 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
@@ -140,81 +140,60 @@ twReadLoop jsr getchar ; Read Character from Serial
;
CheckInput
- pshy ; Save Y to the stack
- psha ; Save A to the stack
- ldy #option1 ; Load address of option1 string into Y
- jsr strcmp ; Compare input string and option1 string
- bne check2 ; If not equal, branch to next check
- ldaa #1 ; Load 1 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 1
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check2 ldy #option2 ; Load address of option2 string into Y
- jsr strcmp ; Compare input string and option2 string
- bne check3 ; If not equal, branch to next check
- ldaa #1 ; Load 1 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn on LED 1
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check3 ldy #option3 ; Load address of option3 string into Y
- jsr strcmp ; Compare input string and option3 string
- bne check4 ; If not equal, branch to next check
- ldaa #2 ; Load 2 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 2
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check4 ldy #option4 ; Load address of option4 string into Y
- jsr strcmp ; Compare input string and option4 string
- bne check5 ; If not equal, branch to next check
- ldaa #2 ; Load 2 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn on LED 2
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check5 ldy #option5 ; Load address of option5 string into Y
- jsr strcmp ; Compare input string and option5 string
- bne check6 ; If not equal, branch to next check
- ldaa #3 ; Load 3 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 3
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check6 ldy #option6 ; Load address of option6 string into Y
- jsr strcmp ; Compare input string and option6 string
- bne check7 ; If not equal, branch to next check
- ldaa #3 ; Load 3 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn off LED 3
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check7 ldy #option7 ; Load address of option7 string into Y
- jsr strcmp ; Compare input string and option7 string
- bne check8 ; If not equal, branch to next check
- jsr LowToHigh ; Jump to LowToHigh to dim LED 4 from 0% to 100%
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check8 ldy #option8 ; Load address of option8 string into Y
- jsr strcmp ; Compare input string and option8 string
- bne check9 ; If not equal, branch to next check
- jsr HighToLow ; Jump to LowToHigh to dim LED 4 from 100% to 0%
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check9 ldy #option9 ; Load address of option9 string into Y
- jsr strcmp ; Compare input string and option9 string
- bne none ; If not equal, branch to unknown result
- jmp TypeWriter ; Jump to TypeWriter portion of main routine
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
+ psha ; Save A to the Stack
+ pshb ; Save B to the Stack
+ ldab 1,x+ ; Load Character from string in X to B
+ cmpb #'Q' ; Compare Character in A to 'Q'
+ beq quitCheck ; If B == 'Q', branch to quitCheck
+ cmpb #'L' ; Compare Character in A to 'L'
+ bne FCheck ; If A != 'L', branch to FCheck
+ ldaa 1,x+ ; Load Next character from string into A
+ ldab 1,x+ ; Load Next character from string into B
+ bne none ; If B != 0, then branch to none (unknown string)
+ cmpa #'4' ; Compare Character in A to '4'
+ beq L4Check ; If A == '4', branch to L4Check
+ suba #'0' ; Subtract character '0' from A
+ ; This allows the number in A to be the LED number (if correct)
+ ble none ; If A < '0', branch to none (unknown string)
+ cmpa #4 ; Compare A to 4
+ bhs none ; Branch to None if A > 3
+ jsr TurnOnLED ; Jump to TurnOnLED
+ bra doneCheck ; Branch always to doneCheck
+L4Check jsr LowToHigh ; Jump to LowToHigh subroutine
+ bra doneCheck ; Branch always to doneCheck
+FCheck cmpb #'F' ; Compare Character in A to 'L'
+ bne none ; If A != 'F', branch to none (unknown string)
+ ldaa 1,x+ ; Load Next character from string into A
+ ldab 1,x+ ; Load Next character from string into B
+ bne none ; If B != 0, then branch to none (unknown string)
+ cmpa #'4' ; Compare Character in A to '4'
+ beq F4Check ; If A == '4', branch to F4Check
+ suba #'0' ; Subtract character '0' from A
+ ble none ; If A < '0', branch to none (unknown string)
+ cmpa #4 ; Compare A to 4
+ bhs none ; Branch to None if A > 3
+ jsr TurnOffLED ; Jump to TurnOffLED
+ bra doneCheck ; Branch always to doneCheck
+F4Check jsr HighToLow ; Jump to HighToLow subroutine
+ bra doneCheck ; Branch always to doneCheck
+quitCheck ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'U' ; Compare A to 'U'
+ bne none ; If A != 'U', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'I' ; Compare A to 'I'
+ bne none ; If A != 'I', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'T' ; Compare A to 'T'
+ bne none ; If A != 'T', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ bne none ; If A != 0, branch to none (unknown string)
+ jmp TypeWriter ; Jump to TypeWriter portion of main routine.
+ ; NOTE: Jumping to TypeWriter will not return
+ ; as it is an infinite loop.
none ldx #unknown ; Load address of uknown command string into X
jsr WriteString ; Write unknown command string to serial
+doneCheck pulb ; Restore B from the stack
pula ; Restore A from the stack
- puly ; Restore Y from the stack
rts ; Return to caller
;*************************************************************************
@@ -239,47 +218,6 @@ zerosLoop staa 1,x+ ; Load A into byte at X
rts ; Return to caller
;*************************************************************************
-; strcmp subroutine
-;
-; This subroutine will compare two null terminated strings.
-;
-; Input: Address of 2 null terminated strings in X & Y
-; Output: 0 or 1 in accumulator A to signal same and different respectively
-; Registers in use: X & Y for the address of the strings and A & B for the current bytes
-; Memory locations in use: Memory Address for serial line, address of the strings
-;
-; Comments: This subroutine requires null terminated strings otherwise it will not work.
-;
-
-strcmp
- pshb ; Save A to the Stack
- pshx ; Save X to the Stack
- pshy ; Save Y to the Stack
-cmpLoop ldaa 1,x+ ; Load byte at X into A
- beq diffX ; If A == 0, branch to diffX
- ldab 1,y+ ; Load byte at Y into B
- beq diffY ; If B == 0, branch to diffY
- sba ; Subtract B from A and store in A
- beq cmpLoop ; If zero Loop, the characters are the same
- ldaa #1 ; Load 1 into A to signal difference
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the Stack
- rts ; Return to Caller
-diffX ldaa y ; Load character at Y into A
- beq equal ; If A == 0, Y and X are the same, branch to equal
-diffY ldaa #1 ; Load 1 into A to signal difference
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the stack
- rts ; Return to caller
-equal clra ; Clear A to signal similarity
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the stack
- rts ; Return to caller
-
-;*************************************************************************
; WriteString subroutine
;
; This subroutine will write a given null terminated string to the serial.
@@ -408,14 +346,15 @@ doneDec pula ; Restore A from the stack
rts ; Return to caller
;*************************************************************************
-; HighToLow subroutine
+; LowToHigh subroutine
;
-; This subroutine will dim LED4 from 100% to 0% in 400ms
+; This subroutine will dim LED4 from 0% to 100% in 400ms
;
; Input: No Input, all parameters are hard coded
-; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles
+; Output: LED4 dimmed from 0% to 100% in 400ms, wasted cycles
; Registers in use: A accumulator to control the light level of the LED
; Memory locations in use: PORTB memory location associated with PORTB on the chip
+; LEVEL memory location for byte of light level.
;
; Comments: This subroutine requires dimmer subroutine
;
@@ -444,7 +383,8 @@ doneInc pula ; Restore A from the stack
; LED4 should be on and off for.
; Output: LED4 dimmed to a given level, wasted cycles
; Registers in use: A accumulator to counter number of times looped
-; Memory locations in use: Two bytes ONN and OFF used to dim the LED4 to a given level
+; Memory locations in use: PORTB memory location associated with PORTB on the chip
+; LEVEL memory location for byte of light level.
;
; Comments: This subroutine requires delay10usec subroutine
;
@@ -536,18 +476,8 @@ getchar7 clra ; Set A to 0
unknown dc.b 'Error: Unknown Command',CR,LF,NULL
; twMsg: welcome message when type writer loads
-twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF,NULL
-
-; Below are strings of the options to compare in CheckInput
-option1 dc.b 'L1',NULL
-option2 dc.b 'F1',NULL
-option3 dc.b 'L2',NULL
-option4 dc.b 'F2',NULL
-option5 dc.b 'L3',NULL
-option6 dc.b 'F3',NULL
-option7 dc.b 'L4',NULL
-option8 dc.b 'F4',NULL
-option9 dc.b 'QUIT',NULL
+twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF
+ dc.b 'Restart to enter main menu again.',CR,LF,NULL
; msg: this is the main option menu string
msg dc.b 'L1: Turn on LED1',CR,LF
@@ -562,4 +492,3 @@ msg dc.b 'L1: Turn on LED1',CR,LF
end ; last line of the file
-
diff --git a/cmpen472hw5_McDonnell/bin/Project.abs b/cmpen472hw5_McDonnell/bin/Project.abs
index fcca2ff..f21f859 100644
--- a/cmpen472hw5_McDonnell/bin/Project.abs
+++ b/cmpen472hw5_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw5_McDonnell/bin/Project.abs.s19 b/cmpen472hw5_McDonnell/bin/Project.abs.s19
index ffd9990..4326354 100644
--- a/cmpen472hw5_McDonnell/bin/Project.abs.s19
+++ b/cmpen472hw5_McDonnell/bin/Project.abs.s19
@@ -1,30 +1,28 @@
S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162734B
S10E3000003605000000000000000581
-S1233100CF310086F15A03860C5ACBCC00015CC8CE3329163201CE3003FD30091631D4CE9C
-S1233120300316320DCE300316313F20E3CE32DE1632011632BC27FB1632B55A0120F4358B
-S123314036CD330C1631DD2608860116322732313DCD330F1631DD2608860116323D323171
-S12331603DCD33121631DD2608860216322732313DCD33151631DD2608860216323D32313C
-S12331803DCD33181631DD2608860316322732313DCD331B1631DD2608860316323D32310E
-S12331A03DCD331E1631DD260616326D32313DCD33211631DD260616325332313DCD33243B
-S12331C01631DD260606312D32313DCE32C516320132313D36876A300436FB323D3734354E
-S12331E0A630270EE670270E181627F486013130333DA640270686013130333D873130330E
-S12332003D36A63027051632B520F7323D36341632BC27FB810D27076A301632B520F08639
-S12332200A1632B530323D810126054C0110200C810226054C012020034C01403D810126FE
-S1233240054D0110200C810226054D012020034D01403D3686640440127A300216328816C9
-S123326032881632881632884320EB323D368600816427127A30021632881632881632883D
-S12332801632884220EA323D4C018036B630020440061632AB4320F74D01808664B0300283
-S12332A00440061632AB4320F7323D34FE30000926FD30A73D4FCC80FC5ACF3D4FCC200327
-S12332C096CF3D873D4572726F723A20556E6B6E6F776E20436F6D6D616E640D0A0057657E
-S12332E06C636F6D6520746F2054797065205772697465722C20796F75206D61792074793B
-S123330070652062656C6F772E0D0A004C31004631004C32004632004C33004633004C34F4
-S12333200046340051554954004C313A205475726E206F6E204C4544310D0A46313A2054ED
-S123334075726E206F6666204C4544310D0A4C323A205475726E206F6E204C4544320D0AC0
-S123336046323A205475726E206F6666204C4544320D0A4C333A205475726E206F6E204C4A
-S12333804544330D0A46333A205475726E206F6666204C4544330D0A4C343A204C4544345D
-S12333A020676F65732066726F6D203025206C69676874206C6576656C20746F20313030CE
-S12333C025206C69676874206C6576656C20696E20302E34207365636F6E64730D0A46340B
-S12333E03A204C45443420676F65732066726F6D2031303025206C69676874206C657665EA
-S12334006C20746F203025206C69676874206C6576656C20696E20302E34207365636F6E73
-S123342064730D0A515549543A2051756974206D656E752070726F6772616D2C2072756ECC
-S11B34402054797065207772697465722070726F6772616D2E0D0A0094
+S1233100CF310086F15A03860C5ACBCC00015CC8CE32E01631B2CE3003FD30091631A9CE61
+S123312030031631BECE300316313F20E3CE328F1631B216326D27FB1632665A0120F43617
+S123314037E630C1512740C14C261CA630E630264F8134270D80302F47810424431631D8DB
+S1233160204416321E203FC1462635A630E630262F8134270D80302F27810424231631EE8F
+S12331802024163204201FA63081552613A6308149260DA63081542607A630260306312D69
+S12331A0CE32761631B233323D36876A300436FB323D36A630270516326620F7323D363429
+S12331C016326D27FB810D27076A3016326620F0860A16326630323D810126054C011020F9
+S12331E00C810226054C012020034C01403D810126054D0110200C810226054D0120200341
+S12332004D01403D3686640440127A30021632391632391632391632394320EB323D368640
+S123322000816427127A30021632391632391632391632394220EA323D4C018036B6300216
+S123324004400616325C4320F74D01808664B0300204400616325C4320F7323D34FE30006F
+S12332600926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6BD7
+S12332806E6F776E20436F6D6D616E640D0A0057656C636F6D6520746F205479706520576A
+S12332A072697465722C20796F75206D617920747970652062656C6F772E0D0A52657374D6
+S12332C061727420746F20656E746572206D61696E206D656E7520616761696E2E0D0A0063
+S12332E04C313A205475726E206F6E204C4544310D0A46313A205475726E206F6666204CCF
+S12333004544310D0A4C323A205475726E206F6E204C4544320D0A46323A205475726E2081
+S12333206F6666204C4544320D0A4C333A205475726E206F6E204C4544330D0A46333A207F
+S12333405475726E206F6666204C4544330D0A4C343A204C45443420676F65732066726F0E
+S12333606D203025206C69676874206C6576656C20746F2031303025206C69676874206C5A
+S12333806576656C20696E20302E34207365636F6E64730D0A46343A204C45443420676FDB
+S12333A065732066726F6D2031303025206C69676874206C6576656C20746F203025206C13
+S12333C069676874206C6576656C20696E20302E34207365636F6E64730D0A515549543AB9
+S12333E02051756974206D656E752070726F6772616D2C2072756E20547970652077726944
+S11234007465722070726F6772616D2E0D0A0011
S9030000FC
diff --git a/cmpen472hw5_McDonnell/bin/main.dbg b/cmpen472hw5_McDonnell/bin/main.dbg
index b4bf1c4..92a558c 100644
--- a/cmpen472hw5_McDonnell/bin/main.dbg
+++ b/cmpen472hw5_McDonnell/bin/main.dbg
@@ -131,8 +131,8 @@ twReadLoop jsr getchar ; Read Character from Serial
;
; Input: Address of null terminated string in X.
; Output: No Output, Control flow changed to proper subroutine.
-; Registers in use: X for the address of the string, Y for the address of the
-; option to compare against, and A for the return value of strcmp
+; Registers in use: X for the address of the string, A & B to read characters from
+; from the string.
; 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
@@ -140,81 +140,59 @@ twReadLoop jsr getchar ; Read Character from Serial
;
CheckInput
- pshy ; Save Y to the stack
- psha ; Save A to the stack
- ldy #option1 ; Load address of option1 string into Y
- jsr strcmp ; Compare input string and option1 string
- bne check2 ; If not equal, branch to next check
- ldaa #1 ; Load 1 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 1
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check2 ldy #option2 ; Load address of option2 string into Y
- jsr strcmp ; Compare input string and option2 string
- bne check3 ; If not equal, branch to next check
- ldaa #1 ; Load 1 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn on LED 1
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check3 ldy #option3 ; Load address of option3 string into Y
- jsr strcmp ; Compare input string and option3 string
- bne check4 ; If not equal, branch to next check
- ldaa #2 ; Load 2 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 2
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check4 ldy #option4 ; Load address of option4 string into Y
- jsr strcmp ; Compare input string and option4 string
- bne check5 ; If not equal, branch to next check
- ldaa #2 ; Load 2 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn on LED 2
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check5 ldy #option5 ; Load address of option5 string into Y
- jsr strcmp ; Compare input string and option5 string
- bne check6 ; If not equal, branch to next check
- ldaa #3 ; Load 3 into A to specify LED number
- jsr TurnOnLED ; Jump to TurnOnLED to turn on LED 3
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check6 ldy #option6 ; Load address of option6 string into Y
- jsr strcmp ; Compare input string and option6 string
- bne check7 ; If not equal, branch to next check
- ldaa #3 ; Load 3 into A to specify LED number
- jsr TurnOffLED ; Jump to TurnOffLED to turn off LED 3
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check7 ldy #option7 ; Load address of option7 string into Y
- jsr strcmp ; Compare input string and option7 string
- bne check8 ; If not equal, branch to next check
- jsr LowToHigh ; Jump to LowToHigh to dim LED 4 from 0% to 100%
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check8 ldy #option8 ; Load address of option8 string into Y
- jsr strcmp ; Compare input string and option8 string
- bne check9 ; If not equal, branch to next check
- jsr HighToLow ; Jump to LowToHigh to dim LED 4 from 100% to 0%
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
-check9 ldy #option9 ; Load address of option9 string into Y
- jsr strcmp ; Compare input string and option9 string
- bne none ; If not equal, branch to unknown result
- jmp TypeWriter ; Jump to TypeWriter portion of main routine
- pula ; Restore A from the stack
- puly ; Restore Y from the stack
- rts ; Return to caller
+ psha ; Save A to the Stack
+ pshb ; Save B to the Stack
+ ldab 1,x+ ; Load Character from string in X to B
+ cmpb #'Q' ; Compare Character in A to 'Q'
+ beq quitCheck ; If B == 'Q', branch to quitCheck
+ cmpb #'L' ; Compare Character in A to 'L'
+ bne FCheck ; If A != 'L', branch to FCheck
+ ldaa 1,x+ ; Load Next character from string into A
+ ldab 1,x+ ; Load Next character from string into B
+ bne none ; If B != 0, then branch to none (unknown string)
+ cmpa #'4' ; Compare Character in A to '4'
+ beq L4Check ; If A == '4', branch to L4Check
+ suba #'0' ; Subtract character '0' from A
+ ble none ; If A < '0', branch to none (unknown string)
+ cmpa #4 ; Compare A to 4
+ bhs none ; Branch to None if A > 3
+ jsr TurnOnLED ; Jump to TurnOnLED
+ bra doneCheck ; Branch always to doneCheck
+L4Check jsr LowToHigh ; Jump to LowToHigh subroutine
+ bra doneCheck ; Branch always to doneCheck
+FCheck cmpb #'F' ; Compare Character in A to 'L'
+ bne none ; If A != 'F', branch to none (unknown string)
+ ldaa 1,x+ ; Load Next character from string into A
+ ldab 1,x+ ; Load Next character from string into B
+ bne none ; If B != 0, then branch to none (unknown string)
+ cmpa #'4' ; Compare Character in A to '4'
+ beq F4Check ; If A == '4', branch to F4Check
+ suba #'0' ; Subtract character '0' from A
+ ble none ; If A < '0', branch to none (unknown string)
+ cmpa #4 ; Compare A to 4
+ bhs none ; Branch to None if A > 3
+ jsr TurnOffLED ; Jump to TurnOffLED
+ bra doneCheck ; Branch always to doneCheck
+F4Check jsr HighToLow ; Jump to HighToLow subroutine
+ bra doneCheck ; Branch always to doneCheck
+quitCheck ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'U' ; Compare A to 'U'
+ bne none ; If A != 'U', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'I' ; Compare A to 'I'
+ bne none ; If A != 'I', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ cmpa #'T' ; Compare A to 'T'
+ bne none ; If A != 'T', branch to none (unknown string)
+ ldaa 1,x+ ; Load next character from string in X to A
+ bne none ; If A != 0, branch to none (unknown string)
+ jmp TypeWriter ; Jump to TypeWriter portion of main routine.
+ ; NOTE: Jumping to TypeWriter will not return
+ ; as it is an infinite loop.
none ldx #unknown ; Load address of uknown command string into X
jsr WriteString ; Write unknown command string to serial
+doneCheck pulb ; Restore B from the stack
pula ; Restore A from the stack
- puly ; Restore Y from the stack
rts ; Return to caller
;*************************************************************************
@@ -239,47 +217,6 @@ zerosLoop staa 1,x+ ; Load A into byte at X
rts ; Return to caller
;*************************************************************************
-; strcmp subroutine
-;
-; This subroutine will compare two null terminated strings.
-;
-; Input: Address of 2 null terminated strings in X & Y
-; Output: 0 or 1 in accumulator A to signal same and different respectively
-; Registers in use: X & Y for the address of the strings and A & B for the current bytes
-; Memory locations in use: Memory Address for serial line, address of the strings
-;
-; Comments: This subroutine requires null terminated strings otherwise it will not work.
-;
-
-strcmp
- pshb ; Save A to the Stack
- pshx ; Save X to the Stack
- pshy ; Save Y to the Stack
-cmpLoop ldaa 1,x+ ; Load byte at X into A
- beq diffX ; If A == 0, branch to diffX
- ldab 1,y+ ; Load byte at Y into B
- beq diffY ; If B == 0, branch to diffY
- sba ; Subtract B from A and store in A
- beq cmpLoop ; If zero Loop, the characters are the same
- ldaa #1 ; Load 1 into A to signal difference
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the Stack
- rts ; Return to Caller
-diffX ldaa y ; Load character at Y into A
- beq equal ; If A == 0, Y and X are the same, branch to equal
-diffY ldaa #1 ; Load 1 into A to signal difference
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the stack
- rts ; Return to caller
-equal clra ; Clear A to signal similarity
- puly ; Restore Y from the Stack
- pulx ; Restore X from the Stack
- pulb ; Restore B from the stack
- rts ; Return to caller
-
-;*************************************************************************
; WriteString subroutine
;
; This subroutine will write a given null terminated string to the serial.
@@ -536,18 +473,8 @@ getchar7 clra ; Set A to 0
unknown dc.b 'Error: Unknown Command',CR,LF,NULL
; twMsg: welcome message when type writer loads
-twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF,NULL
-
-; Below are strings of the options to compare in CheckInput
-option1 dc.b 'L1',NULL
-option2 dc.b 'F1',NULL
-option3 dc.b 'L2',NULL
-option4 dc.b 'F2',NULL
-option5 dc.b 'L3',NULL
-option6 dc.b 'F3',NULL
-option7 dc.b 'L4',NULL
-option8 dc.b 'F4',NULL
-option9 dc.b 'QUIT',NULL
+twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF
+ dc.b 'Restart to enter main menu again.',CR,LF,NULL
; msg: this is the main option menu string
msg dc.b 'L1: Turn on LED1',CR,LF
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
index fcca2ff..f21f859 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
index 75a580d..0edfa2c 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -1,30 +1,28 @@
S0840000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C636D70656E3437326877355F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726DCF
S10E3000003605000000000000000581
-S1233100CF310086F15A03860C5ACBCC00015CC8CE3329163201CE3003FD30091631D4CE9C
-S1233120300316320DCE300316313F20E3CE32DE1632011632BC27FB1632B55A0120F4358B
-S123314036CD330C1631DD2608860116322732313DCD330F1631DD2608860116323D323171
-S12331603DCD33121631DD2608860216322732313DCD33151631DD2608860216323D32313C
-S12331803DCD33181631DD2608860316322732313DCD331B1631DD2608860316323D32310E
-S12331A03DCD331E1631DD260616326D32313DCD33211631DD260616325332313DCD33243B
-S12331C01631DD260606312D32313DCE32C516320132313D36876A300436FB323D3734354E
-S12331E0A630270EE670270E181627F486013130333DA640270686013130333D873130330E
-S12332003D36A63027051632B520F7323D36341632BC27FB810D27076A301632B520F08639
-S12332200A1632B530323D810126054C0110200C810226054C012020034C01403D810126FE
-S1233240054D0110200C810226054D012020034D01403D3686640440127A300216328816C9
-S123326032881632881632884320EB323D368600816427127A30021632881632881632883D
-S12332801632884220EA323D4C018036B630020440061632AB4320F74D01808664B0300283
-S12332A00440061632AB4320F7323D34FE30000926FD30A73D4FCC80FC5ACF3D4FCC200327
-S12332C096CF3D873D4572726F723A20556E6B6E6F776E20436F6D6D616E640D0A0057657E
-S12332E06C636F6D6520746F2054797065205772697465722C20796F75206D61792074793B
-S123330070652062656C6F772E0D0A004C31004631004C32004632004C33004633004C34F4
-S12333200046340051554954004C313A205475726E206F6E204C4544310D0A46313A2054ED
-S123334075726E206F6666204C4544310D0A4C323A205475726E206F6E204C4544320D0AC0
-S123336046323A205475726E206F6666204C4544320D0A4C333A205475726E206F6E204C4A
-S12333804544330D0A46333A205475726E206F6666204C4544330D0A4C343A204C4544345D
-S12333A020676F65732066726F6D203025206C69676874206C6576656C20746F20313030CE
-S12333C025206C69676874206C6576656C20696E20302E34207365636F6E64730D0A46340B
-S12333E03A204C45443420676F65732066726F6D2031303025206C69676874206C657665EA
-S12334006C20746F203025206C69676874206C6576656C20696E20302E34207365636F6E73
-S123342064730D0A515549543A2051756974206D656E752070726F6772616D2C2072756ECC
-S11B34402054797065207772697465722070726F6772616D2E0D0A0094
+S1233100CF310086F15A03860C5ACBCC00015CC8CE32E01631B2CE3003FD30091631A9CE61
+S123312030031631BECE300316313F20E3CE328F1631B216326D27FB1632665A0120F43617
+S123314037E630C1512740C14C261CA630E630264F8134270D80302F47810424431631D8DB
+S1233160204416321E203FC1462635A630E630262F8134270D80302F27810424231631EE8F
+S12331802024163204201FA63081552613A6308149260DA63081542607A630260306312D69
+S12331A0CE32761631B233323D36876A300436FB323D36A630270516326620F7323D363429
+S12331C016326D27FB810D27076A3016326620F0860A16326630323D810126054C011020F9
+S12331E00C810226054C012020034C01403D810126054D0110200C810226054D0120200341
+S12332004D01403D3686640440127A30021632391632391632391632394320EB323D368640
+S123322000816427127A30021632391632391632391632394220EA323D4C018036B6300216
+S123324004400616325C4320F74D01808664B0300204400616325C4320F7323D34FE30006F
+S12332600926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6BD7
+S12332806E6F776E20436F6D6D616E640D0A0057656C636F6D6520746F205479706520576A
+S12332A072697465722C20796F75206D617920747970652062656C6F772E0D0A52657374D6
+S12332C061727420746F20656E746572206D61696E206D656E7520616761696E2E0D0A0063
+S12332E04C313A205475726E206F6E204C4544310D0A46313A205475726E206F6666204CCF
+S12333004544310D0A4C323A205475726E206F6E204C4544320D0A46323A205475726E2081
+S12333206F6666204C4544320D0A4C333A205475726E206F6E204C4544330D0A46333A207F
+S12333405475726E206F6666204C4544330D0A4C343A204C45443420676F65732066726F0E
+S12333606D203025206C69676874206C6576656C20746F2031303025206C69676874206C5A
+S12333806576656C20696E20302E34207365636F6E64730D0A46343A204C45443420676FDB
+S12333A065732066726F6D2031303025206C69676874206C6576656C20746F203025206C13
+S12333C069676874206C6576656C20696E20302E34207365636F6E64730D0A515549543AB9
+S12333E02051756974206D656E752070726F6772616D2C2072756E20547970652077726944
+S11234007465722070726F6772616D2E0D0A0011
S9033100CB
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
index 1a420fc..1253cd2 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ