diff options
Diffstat (limited to 'cmpen472hw9_McDonnell/bin/main.dbg')
| -rw-r--r-- | cmpen472hw9_McDonnell/bin/main.dbg | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/cmpen472hw9_McDonnell/bin/main.dbg b/cmpen472hw9_McDonnell/bin/main.dbg index 5a7a005..bc272cf 100644 --- a/cmpen472hw9_McDonnell/bin/main.dbg +++ b/cmpen472hw9_McDonnell/bin/main.dbg @@ -133,6 +133,7 @@ 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 + jsr PrintPrompt ; Jump to PrintPrompt to write to serial console mainLoop ldx #inputBuffer ; Load the address of inputBuffer into X ldy lenInput ; Load the length of inputBuffer into Y @@ -142,11 +143,14 @@ mainLoop jsr ExecuteCommand ; Jump to ExecuteCommand ldx #inputBuffer ; Load the address of inputBuffer into X + ldaa 0,x ; Load first character from inputBuffer into A + beq mainLoop ; If A == 0, branch to mainLoop, only zero if Solve was called ldy lenInput ; Load the length of inputBuffer into Y jsr Zeros ; Zero out inputBuffer sei ; Disable interrupts jsr PrintTime ; Jump to PrintTime to print new time + jsr PrintPrompt ; Jump to PrintPrompt to write to serial console cli ; Enable interrupts bra mainLoop ; Loop back to mainLoop always @@ -215,6 +219,7 @@ 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 + jsr PrintPrompt ; Jump to PrintPrompt rtiSkip RTI ; Return from RTI ISR ;************************************************************************* @@ -281,10 +286,6 @@ goodSecs ldy #buffer ; Load the address of buffer into Y 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 - ldx #CMD ; Load the address of CMD into X - jsr WriteString ; Write the string to the serial - ldx #inputBuffer ; Load the address of the inputBuffer into X - jsr WriteString ; Write the string to the serial ldaa outputBuf ; Load outputBuf into A cmpa #'h' ; Compare A to 'h' bne pTimeIsM ; If A != 'h', branch to pTimeIsM @@ -302,6 +303,28 @@ skipRest jsr TimeOnPortB ; Call TimeOnPortB to output time rts ; Return to caller ;************************************************************************* +; PrintPrompt subroutine +; +; This subroutine will output the CMD prompt and any current input to the serial console +; +; Input: No Input +; Output: The CMD prompt and any input onto the serial console +; Registers in use: X for addresses of strings +; Memory locations in use: PORTB memory location, CMD prompt memory locaiton, inputBuffer location +; +; Comments: This subroutine requires WriteString subroutine. +; + +PrintPrompt + pshx ; Save X to the stack + ldx #CMD ; Load the address of CMD into X + jsr WriteString ; Write the string to the serial + ldx #inputBuffer ; Load the address of the inputBuffer into X + jsr WriteString ; Write the string to the serial + pulx ; Restore X from the stack + rts + +;************************************************************************* ; TimeOnPortB subroutine ; ; This subroutine will output the time given on on PORTB for two seven segment displays. @@ -510,28 +533,41 @@ sDone cpd #9999 ; Compare D to 9999 (Max output) bgt sOverflow ; Branch to sOverflow if D > 9999 cpd #-9999 ; Compare D to -9999 (Min output) blt sOverflow ; Branch to sOverflow if D < -9999 + sei ; Disable Interrupts + jsr PrintTime ; Print Time to serial pulx ; Restore X from the stack + pshx ; Save X to the stack jsr WriteString ; Write original equation to serial console + pulx ; Restore X from the stack + ldy lenInput ; Load the length of the input buffer into Y + jsr Zeros ; Clear input buffer psha ; Save A to the stack ldaa #'=' ; Load '=' into A jsr putchar ; Print '=' to serial console pula ; Restore A from the stack ldy #buffer ; Load address of buffer into Y jsr PrintDecimalWord; Print the answer to the Serial console - ldaa #CR ; Load CR into A - jsr putchar ; Jump to putchar to write CR - ldaa #LF ; Load LF into A - jsr putchar ; Jump to putchar to write CR + 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 + cli ; Enable Interrupts puld ; Restore D from the stack puly ; Restore Y from the stack rts ; Return to caller -sOverflow pulx ; Restore X from the stack - pshx ; Save X to the stack +sOverflow ldaa #' ' ; Load a space character into A + jsr putchar ; Jump to putchar to write space character + jsr putchar ; Jump to putchar to write space character + jsr putchar ; Jump to putchar to write space character + jsr putchar ; Jump to putchar to write space character + ldx #error ; Load the address of the error prompt into X jsr WriteString ; Write original string to serial console - ldaa #CR ; Load CR into A - jsr putchar ; Jump to putchar to write CR - ldaa #LF ; Load LF into A - jsr putchar ; Jump to putchar to write CR + ldaa #' ' ; Load a space character into A + jsr putchar ; Jump to putchar to write space character ldx #overflow ; Load address of overflow string into X jsr WriteString ; Write overflow string to serial pulx ; Restore X from the stack @@ -904,7 +940,7 @@ getchar7 clra ; Set A to 0 * Data Section 2: address used [ $3100 to $3FFF ] RAM Memory * -clock dc.b 'Clock> ',NULL ; Prompt string for clock +clock dc.b 'Tcalc> ',NULL ; Prompt string for clock CMD dc.b 'CMD> ',NULL ; Prompt string for CMD @@ -912,7 +948,7 @@ error dc.b 'Error> ',NULL ; Prompt string for errors badInput dc.b 'Invalid Input',NULL ; Invalid Input Prompt -overflow dc.b 'Overflow Error',CR,LF,NULL ; Overflow error message +overflow dc.b 'Overflow Error',NULL ; Overflow error message ; twMsg: welcome message for typewrite twMsg dc.b CR,LF,'Clock stopped and Typewrite program started.',CR,LF |
