summaryrefslogtreecommitdiff
path: root/cmpen472hw9_McDonnell/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'cmpen472hw9_McDonnell/Sources')
-rw-r--r--cmpen472hw9_McDonnell/Sources/main.asm31
1 files changed, 20 insertions, 11 deletions
diff --git a/cmpen472hw9_McDonnell/Sources/main.asm b/cmpen472hw9_McDonnell/Sources/main.asm
index cab5646..70443e6 100644
--- a/cmpen472hw9_McDonnell/Sources/main.asm
+++ b/cmpen472hw9_McDonnell/Sources/main.asm
@@ -133,6 +133,8 @@ pgstart lds #$3100 ; initialize the stack pointer
jsr Zeros ; Zero out inputBuffer
cli ; Enable interrupts
jsr PrintTime ; Jump to PrintTime to write to serial console
+ ldx #spacer ; Load the address of spacer into X
+ jsr WriteString ; Write the spacer string to the output
jsr PrintPrompt ; Jump to PrintPrompt to write to serial console
mainLoop
ldx #inputBuffer ; Load the address of inputBuffer into X
@@ -150,6 +152,8 @@ mainLoop
sei ; Disable interrupts
jsr PrintTime ; Jump to PrintTime to print new time
+ ldx #spacer ; Load the address of spacer into X
+ jsr WriteString ; Write the spacer string to the output
jsr PrintPrompt ; Jump to PrintPrompt to write to serial console
cli ; Enable interrupts
@@ -219,6 +223,8 @@ rtiisr bset CRGFLG,%10000000; Clear RTI Interrupt Flag
ldx #0 ; Reset the hours
stx hours ; Save the updated hours
rtidone jsr PrintTime ; Jump to PrintTime
+ ldx #spacer ; Load the address of spacer into X
+ jsr WriteString ; Write the spacer string to the output
jsr PrintPrompt ; Jump to PrintPrompt
rtiSkip RTI ; Return from RTI ISR
@@ -281,11 +287,6 @@ goodMins ldy #buffer ; Load the address of buffer into Y
pula ; Restore A from the stack
goodSecs ldy #buffer ; Load the address of buffer into Y
jsr PrintDecimalWord; Print the number to the serial
- ldaa #' ' ; Load ' ' character into A
- jsr putchar ; Write the character to the serial console
- jsr putchar ; Write the character to the serial console
- jsr putchar ; Write the character to the serial console
- jsr putchar ; Write the character to the serial console
ldaa outputBuf ; Load outputBuf into A
cmpa #'h' ; Compare A to 'h'
bne pTimeIsM ; If A != 'h', branch to pTimeIsM
@@ -535,6 +536,13 @@ sDone cpd #9999 ; Compare D to 9999 (Max output)
blt sOverflow ; Branch to sOverflow if D < -9999
sei ; Disable Interrupts
jsr PrintTime ; Print Time to serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load the space character into A
+ jsr putchar ; Print the space character to the serial console
+ jsr putchar ; Print the space character to the serial console
+ jsr putchar ; Print the space character to the serial console
+ jsr putchar ; Print the space character to the serial console
+ pula ; Restore A from the stack
pulx ; Restore X from the stack
pshx ; Save X to the stack
jsr WriteString ; Write original equation to serial console
@@ -547,14 +555,12 @@ sDone cpd #9999 ; Compare D to 9999 (Max output)
pula ; Restore A from the stack
ldy #buffer ; Load address of buffer into Y
jsr PrintDecimalWord; Print the answer to the Serial console
- ldaa #' ' ; Load a space character into A
- jsr putchar ; Write space character to serial
- jsr putchar ; Write space character to serial
- jsr putchar ; Write space character to serial
- jsr putchar ; Write space character to serial
- jsr PrintPrompt ; Write CMD prompt to serial
clra ; Clear A
staa operator ; Clear operator
+ jsr PrintTime ; Print the time to the serial console
+ ldx #spacer ; Load the address of spacer into X
+ jsr WriteString ; Write the spacer string to the output
+ jsr PrintPrompt ; Write CMD prompt to serial
cli ; Enable Interrupts
puld ; Restore D from the stack
puly ; Restore Y from the stack
@@ -954,6 +960,9 @@ overflow dc.b 'Overflow Error',NULL ; Overflow error message
twMsg dc.b CR,LF,'Clock stopped and Typewrite program started.',CR,LF
dc.b 'You may type below.',CR,LF,NULL
+; spacer: the white space between time and cmd prompt
+spacer dc.b ' ',NULL
+
; msg: this is the main option menu string
msg dc.b 'Commands:',CR,LF
dc.b 't: Set the time in format HH:MM:SS',CR,LF