diff options
| -rw-r--r-- | cmpen472_hw8McDonnell/Sources/main.asm | 68 | ||||
| -rw-r--r-- | cmpen472_hw8McDonnell/bin/Project.abs | bin | 7968 -> 7972 bytes | |||
| -rw-r--r-- | cmpen472_hw8McDonnell/bin/Project.abs.s19 | 22 | ||||
| -rw-r--r-- | cmpen472_hw8McDonnell/bin/main.dbg | 2 | ||||
| -rw-r--r-- | cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.o | bin | 7968 -> 7972 bytes | |||
| -rw-r--r-- | cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.sx | 22 | ||||
| -rw-r--r-- | cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/TargetDataWindows.tdt | bin | 65029 -> 65029 bytes |
7 files changed, 81 insertions, 33 deletions
diff --git a/cmpen472_hw8McDonnell/Sources/main.asm b/cmpen472_hw8McDonnell/Sources/main.asm index 903738f..1782ad1 100644 --- a/cmpen472_hw8McDonnell/Sources/main.asm +++ b/cmpen472_hw8McDonnell/Sources/main.asm @@ -2,22 +2,22 @@ * * Title: Calculator * -* Objective: CMPEN 472 Homework 7 +* Objective: CMPEN 472 Homework 8 * * Revision: V1.0 * -* Date: Mar. 7, 2025 +* Date: Mar. 24, 2025 * * Programmer: Jacob McDonnell * * Company: The Pennsylvania State University * Department of Computer Science and Engineering * -* Algorithm: Simple Serial I/O, address poking and modifying +* Algorithm: Simple Serial I/O, Real Time Interrupts for Time Tracking * * Register Use: A & B to current byte, etc, * X & Y holds address of strings and length of string, -* D to hold data and address of the memory location to work on. +* D to hold data for printing, reading, and updating time. * * Memory Use: RAM Locations from $3000 for data, * RAM Locations from $3100 for program @@ -25,12 +25,10 @@ * Input: Serial Port for User Input * * Output: Serial Port for String Output -* Memory locations changed if modified by user * -* Observation: This program is a simple 16-bit calculator. The input can be -* any 4 digit positive decimal integer, the output can be negative. -* The +, -, *, and / operators are supported. Only two numbers at -* a time. +* Observation: The HC12 will output the time and a command prompt every second. +* The user can input commands and the program will output a response +* based on the input. * * Note: ON CSM-12C128 board, * @@ -169,6 +167,24 @@ twLoop jsr getchar ; Read a character from the serial conso * Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory * +;************************************************************************* +; rtiisr subroutine +; +; This subroutine will increment the counter, seconds, minutes, & hours counters +; to track the time. This subroutine will be called ~400 times a second. +; +; Input: No input other than the timer to call the isr. +; Output: The counter, seconds, minutes, & hours buffers will +; be updated to track the time, the time & prompt will be +; printed every second. +; Registers in use: X for adding to the counter, seconds, minutes, & hours buffers. +; Memory locations in use: Memory Address for serial line, Memory addresses for RTIISR control, +; Buffer words for counters, seconds, minutes, & hours buffers. +; +; Comments: The counter buffer should be compared to 400, but for the simulator, +; the counter is compared to 200 to better simulate 1 second on my computer. +; + rtiisr bset CRGFLG,%10000000; Clear RTI Interrupt Flag ldx counter ; Load counter into X inx ; Increment counter by 1 @@ -201,6 +217,24 @@ rtiisr bset CRGFLG,%10000000; Clear RTI Interrupt Flag rtidone jsr PrintTime ; Jump to PrintTime rtiSkip RTI ; Return from RTI ISR +;************************************************************************* +; PrintTime subroutine +; +; This subroutine will print the time, command prompt, and maybe an error prompt. +; +; Input: No input. +; Output: The time prompt, time, command prompt, the current input, +; and/or an error on the serial console. +; Registers in use: A for the characters to print, X for buffer addresses, +; Y for buffer lengths, D for the seconds/minutes/hours for calling TimeOnPortB +; Memory locations in use: Memory Address for serial line, Buffer words for counters, +; seconds, minutes, & hours buffers, and buffer to print time, +; outputBuf for tracking what to output on PORTB. +; +; Comments: This subroutine requires TimeOnPortB subroutine and to be setup. The subroutine +; will print the current user input if its not finished. +; + PrintTime pshd ; Save D to the stack pshy ; Save Y to the stack @@ -267,6 +301,20 @@ skipRest jsr TimeOnPortB ; Call TimeOnPortB to output time puld ; Restore D from the stack rts ; Return to caller +;************************************************************************* +; TimeOnPortB subroutine +; +; This subroutine will output the time given on on PORTB for two seven segment displays. +; +; Input: Two Digit Decimal number in register D. +; Output: The given two digit decimal number on PORTB for two 7 segment displays. +; Registers in use: D for the input, and for math to split the digits, X for math to split digits. +; Memory locations in use: PORTB memory location. +; +; Comments: This subroutine will only work with two digit decimal numbers, and one digit decimal +; numbers (leading zeros will be added). +; + TimeOnPortB pshd ; Save D to the stack pshx ; Save X to the stack @@ -670,7 +718,7 @@ error dc.b 'Error> ',NULL ; Prompt string for badInput dc.b 'Invalid Input',NULL ; Invalid Input Prompt ; twMsg: welcome message for typewrite -twMsg dc.b 'Clock stopped and Typewrite program started.',CR,LF +twMsg dc.b CR,LF,'Clock stopped and Typewrite program started.',CR,LF dc.b 'You may type below.',CR,LF,NULL ; msg: this is the main option menu string diff --git a/cmpen472_hw8McDonnell/bin/Project.abs b/cmpen472_hw8McDonnell/bin/Project.abs Binary files differindex 0d33129..4684657 100644 --- a/cmpen472_hw8McDonnell/bin/Project.abs +++ b/cmpen472_hw8McDonnell/bin/Project.abs diff --git a/cmpen472_hw8McDonnell/bin/Project.abs.s19 b/cmpen472_hw8McDonnell/bin/Project.abs.s19 index b97742f..aad812e 100644 --- a/cmpen472_hw8McDonnell/bin/Project.abs.s19 +++ b/cmpen472_hw8McDonnell/bin/Project.abs.s19 @@ -2,7 +2,7 @@ S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C43 S123300000000000000000000000000000000000000010000000000000000000000000009C S123302000000000001000000000000000000000000000000000000000000000000000007C S106304000106811 -S1233100CF310086F15A03860C5ACBCC00015CC8CE34901633F24C3B194C38804C37808635 +S1233100CF310086F15A03860C5ACBCC00015CC8CE34921633F24C3B194C38804C37808633 S1233120FF5A03CE3030FD30401633E310EF1631B9CE3030FD30401633FECE3030163266AB S1233140CE3030FD30401633E314101631B910EF20DF14104D3880CE344C1633F216341F67 S12331609727FA5A0116341820F34C3780FE302C087E302C8E00C8263FCE00007E302CFE23 @@ -28,15 +28,15 @@ S12333C0131633E33A31303D86301634183A31303D36862D7A302F3240800150C001C30059 S12333E001209B36876A300436FB323D6A300436FB3D36A630270516341820F7323D36357B S12334003416341F27FB810D270A6A3016341803270220ED3031323D4FCC80FC5ACF3D4FD9 S1233420CC200396CF3D873D436C6F636B3E2000434D443E20004572726F723E2000496E98 -S123344076616C696420496E70757400436C6F636B2073746F7070656420616E64205479DD -S1233460706577726974652070726F6772616D20737461727465642E0D0A596F75206D61A9 -S12334807920747970652062656C6F772E0D0A00436F6D6D616E64733A0D0A743A20536546 -S12334A074207468652074696D6520696E20666F726D61742048483A4D4D3A53530D0A68E1 -S12334C03A20446973706C61792074686520686F757273206F6E20746865203720736567F2 -S12334E06D656E7420646973706C6179730D0A6D3A20446973706C617920746865206D6980 -S12335006E75746573206F6E207468652037207365676D656E7420646973706C6179730D1A -S12335200A733A20446973706C617920746865207365636F6E6473206F6E207468652037B5 -S1233540207365676D656E7420646973706C6179730D0A713A2053746F702074686520635F -S11F35606C6F636B20616E6420656E74657220747970657772697465720D0A007B +S123344076616C696420496E707574000D0A436C6F636B2073746F7070656420616E642093 +S12334605479706577726974652070726F6772616D20737461727465642E0D0A596F7520AA +S12334806D617920747970652062656C6F772E0D0A00436F6D6D616E64733A0D0A743A2030 +S12334A0536574207468652074696D6520696E20666F726D61742048483A4D4D3A53530D9B +S12334C00A683A20446973706C61792074686520686F757273206F6E20746865203720734C +S12334E065676D656E7420646973706C6179730D0A6D3A20446973706C617920746865208A +S12335006D696E75746573206F6E207468652037207365676D656E7420646973706C6179C4 +S1233520730D0A733A20446973706C617920746865207365636F6E6473206F6E207468658C +S12335402037207365676D656E7420646973706C6179730D0A713A2053746F70207468658B +S121356020636C6F636B20616E6420656E74657220747970657772697465720D0A00F6 S105FFF0316A70 S9030000FC diff --git a/cmpen472_hw8McDonnell/bin/main.dbg b/cmpen472_hw8McDonnell/bin/main.dbg index 6d18ef7..752531b 100644 --- a/cmpen472_hw8McDonnell/bin/main.dbg +++ b/cmpen472_hw8McDonnell/bin/main.dbg @@ -670,7 +670,7 @@ error dc.b 'Error> ',NULL ; Prompt string for badInput dc.b 'Invalid Input',NULL ; Invalid Input Prompt ; twMsg: welcome message for typewrite -twMsg dc.b 'Clock stopped and Typewrite program started.',CR,LF +twMsg dc.b CR,LF,'Clock stopped and Typewrite program started.',CR,LF dc.b 'You may type below.',CR,LF,NULL ; msg: this is the main option menu string diff --git a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.o Binary files differindex 0d33129..4684657 100644 --- a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.o +++ b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.o diff --git a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.sx index 0ba80b1..3f3ba82 100644 --- a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.sx +++ b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/ObjectCode/main.asm.sx @@ -3,7 +3,7 @@ S123300000000000000000000000000000000000000010000000000000000000000000009C S123302000000000001000000000000000000000000000000000000000000000000000007C S106304000106811 S105FFF0316A70 -S1233100CF310086F15A03860C5ACBCC00015CC8CE34901633F24C3B194C38804C37808635 +S1233100CF310086F15A03860C5ACBCC00015CC8CE34921633F24C3B194C38804C37808633 S1233120FF5A03CE3030FD30401633E310EF1631B9CE3030FD30401633FECE3030163266AB S1233140CE3030FD30401633E314101631B910EF20DF14104D3880CE344C1633F216341F67 S12331609727FA5A0116341820F34C3780FE302C087E302C8E00C8263FCE00007E302CFE23 @@ -29,14 +29,14 @@ S12333C0131633E33A31303D86301634183A31303D36862D7A302F3240800150C001C30059 S12333E001209B36876A300436FB323D6A300436FB3D36A630270516341820F7323D36357B S12334003416341F27FB810D270A6A3016341803270220ED3031323D4FCC80FC5ACF3D4FD9 S1233420CC200396CF3D873D436C6F636B3E2000434D443E20004572726F723E2000496E98 -S123344076616C696420496E70757400436C6F636B2073746F7070656420616E64205479DD -S1233460706577726974652070726F6772616D20737461727465642E0D0A596F75206D61A9 -S12334807920747970652062656C6F772E0D0A00436F6D6D616E64733A0D0A743A20536546 -S12334A074207468652074696D6520696E20666F726D61742048483A4D4D3A53530D0A68E1 -S12334C03A20446973706C61792074686520686F757273206F6E20746865203720736567F2 -S12334E06D656E7420646973706C6179730D0A6D3A20446973706C617920746865206D6980 -S12335006E75746573206F6E207468652037207365676D656E7420646973706C6179730D1A -S12335200A733A20446973706C617920746865207365636F6E6473206F6E207468652037B5 -S1233540207365676D656E7420646973706C6179730D0A713A2053746F702074686520635F -S11F35606C6F636B20616E6420656E74657220747970657772697465720D0A007B +S123344076616C696420496E707574000D0A436C6F636B2073746F7070656420616E642093 +S12334605479706577726974652070726F6772616D20737461727465642E0D0A596F7520AA +S12334806D617920747970652062656C6F772E0D0A00436F6D6D616E64733A0D0A743A2030 +S12334A0536574207468652074696D6520696E20666F726D61742048483A4D4D3A53530D9B +S12334C00A683A20446973706C61792074686520686F757273206F6E20746865203720734C +S12334E065676D656E7420646973706C6179730D0A6D3A20446973706C617920746865208A +S12335006D696E75746573206F6E207468652037207365676D656E7420646973706C6179C4 +S1233520730D0A733A20446973706C617920746865207365636F6E6473206F6E207468658C +S12335402037207365676D656E7420646973706C6179730D0A713A2053746F70207468658B +S121356020636C6F636B20616E6420656E74657220747970657772697465720D0A00F6 S9033100CB diff --git a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/TargetDataWindows.tdt Binary files differindex 58b2dad..4d2f711 100644 --- a/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/TargetDataWindows.tdt +++ b/cmpen472_hw8McDonnell/cmpen472_hw8McDonnell_Data/Standard/TargetDataWindows.tdt |
