diff options
Diffstat (limited to 'cmpen472hw12_McDonnell/Sources/main.asm')
| -rw-r--r-- | cmpen472hw12_McDonnell/Sources/main.asm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmpen472hw12_McDonnell/Sources/main.asm b/cmpen472hw12_McDonnell/Sources/main.asm index a102cf5..b2b5d0d 100644 --- a/cmpen472hw12_McDonnell/Sources/main.asm +++ b/cmpen472hw12_McDonnell/Sources/main.asm @@ -415,26 +415,32 @@ LDCommand LDLoop dbeq y,LDDone ; Decrement y, y == 0, done jsr GetCharLoop ; Read Character from serial cmpa #CR ; Compare to CR - bne NotNewline ; If A != CR, not newline + bne NotCR ; If A != CR, not CR jsr putchar ; Echo to serial jsr GetCharLoop ; Read Character from serial - cmpa #LF ; Compare to LF +NotCR cmpa #LF ; Compare to LF bne NotNewline ; If not LF, skip next read jsr putchar ; Echo to serial jsr GetCharLoop ; Read Character from serial + cmpa #CR ; Compare to CR + bne NotNewline ; If not CR, skip next read + jsr GetCharLoop ; Read Character from serial NotNewline jsr putchar ; Echo to serial jsr IsValidHex ; Check if valid hex beq LDInvalid ; If Z == 1, invalid tab ; Transfer A to B jsr GetCharLoop ; Read Character from serial cmpa #CR ; Compare to CR - bne NotNewline2 ; If A != CR, not newline + bne NotCR2 ; If A != CR, not CR jsr putchar ; Echo to serial jsr GetCharLoop ; Read Character from serial - cmpa #LF ; Compare to LF +NotCR2 cmpa #LF ; Compare to LF bne NotNewline2 ; If not LF, skip next read jsr putchar ; Echo to serial jsr GetCharLoop ; Read Character from serial + cmpa #CR ; Compare to CR + bne NotNewline2 ; If not CR, skip next read + jsr GetCharLoop ; Read Character from serial NotNewline2 jsr putchar ; Echo to serial jsr IsValidHex ; Check if valid hex beq LDInvalid ; If Z == 1, invalid @@ -911,6 +917,8 @@ readLoop jsr getchar ; Jump to putchar to write byte to seria beq readLoop ; While A == 0, loop cmpa #CR ; If A == CR, exit loop beq doneRead ; Branch to doneRead if A == CR + cmpa #LF ; If A == LF, exit loop + beq doneRead ; Branch to doneRead if A == CR staa 1,x+ ; Save the byte to the addr in X, then add 1 jsr putchar ; Write Character back to the terminal dey ; Decrement Y by 1 |
