diff options
Diffstat (limited to 'cmpen472hw11_McDonnell')
22 files changed, 2905 insertions, 0 deletions
diff --git a/cmpen472hw11_McDonnell/ASM_layout.hwl b/cmpen472hw11_McDonnell/ASM_layout.hwl new file mode 100644 index 0000000..22795c3 --- /dev/null +++ b/cmpen472hw11_McDonnell/ASM_layout.hwl @@ -0,0 +1,27 @@ +OPEN source 0 0 60 42 +Source < attributes TOOLTIP on,TOOLTIP_FORMAT signed,TOOLTIP_MODE details,FREEZE off,MARKS off +OPEN assembly 60 0 40 30 +Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,FORMAT Auto,FREEZE off,TOPPC 0x3100 +OPEN procedure 60 60 40 17 +Procedure < attributes VALUES on,TYPES off +OPEN register 60 30 40 30 +Register < attributes FORMAT AUTO,COMPLEMENT None +OPEN memory 60 77 40 23 +Memory < attributes FORMAT hex,COMPLEMENT None,WORD 1,ASC on,ADR on,MODE automatic,UPDATERATE 10,ADDRESS 0x80 +OPEN data 0 42 60 28 +Data < attributes SCOPE global,COMPLEMENT None,FORMAT Symb,MODE automatic,SORT NotSort,UPDATERATE 10,NAMEWIDTH 16 +OPEN command 0 70 60 30 +Command < attributes CACHESIZE 1000 +OPEN Terminal 10 20 40 69 +Terminal < attributes CACHESIZE 1000 +Terminal < attributes SCI_DEFAULT_TEXT "Virtual SCI",SCI_CONNECTION 0,1,SCI_CONNECTION 1,0,SCI_CONNECTION 1,3,SCI_CONNECTION 3,1,SCI_PORT COM1,SCI_BAUD 9600,SCI_SHOW_PROTOCOL OFF,SCI_VIRTUAL_IN "Sci:2.SerialOutput",SCI_VIRTUAL_OUT "Sci:2.SerialInput",SCI_FILENAME_IN "",SCI_FILENAME_OUT "" +OPEN Visualizationtool 76 37 11 29 +VisualizationTool< Attributes [stEditM="0",swRefresh="3",refCycles="1"] +VisualizationTool< LoadInstrument Seg7[BoundX="26",BoundY="12",Port="0x1",swDM="2"] +VisualizationTool< LoadInstrument Seg7[BoundX="67",BoundY="14",Port="0x1",swDM="1"] +VisualizationTool< LoadInstrument DILSwitch[BoundX="25",BoundY="106",Port="0x1"] +VisualizationTool< ResetVT Undo +bckcolor 50331647 +font 'Courier New' 9 BLACK +AUTOSIZE on +ACTIVATE "Assembly" "Memory" "Register" "Command" "Data" "Source" "Procedure" "Terminal" "VisualizationTool" diff --git a/cmpen472hw11_McDonnell/Default.mem b/cmpen472hw11_McDonnell/Default.mem Binary files differnew file mode 100644 index 0000000..bf49148 --- /dev/null +++ b/cmpen472hw11_McDonnell/Default.mem diff --git a/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc b/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc new file mode 100644 index 0000000..f3ce7c9 --- /dev/null +++ b/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc @@ -0,0 +1 @@ +LOADMEM default.mem diff --git a/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini new file mode 100644 index 0000000..ebc46ea --- /dev/null +++ b/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini @@ -0,0 +1,42 @@ +[Environment Variables] +GENPATH={Project}Sources;{Compiler}lib\hc12c\src;{Compiler}lib\hc12c\include;{Compiler}lib\hc12c\lib;{Compiler}lib\xgatec\src;{Compiler}lib\xgatec\include;{Compiler}lib\xgatec\lib +LIBPATH={Compiler}lib\hc12c\include;{Compiler}lib\xgatec\include +OBJPATH={Project}bin +TEXTPATH={Project}bin +ABSPATH={Project}bin + +[HI-WAVE] +Target=sim +Layout=ASM_layout.hwl +LoadDialogOptions=AUTOERASEANDFLASH NORUNAFTERLOAD +CPU=HC12 +MainFrame=2,3,-1,-1,-1,-1,-7,68,1745,1084 +Configuration=Full_Chip_Simulation.hwc +Statusbar=1 +ShowToolbar=1 +Smallborder=0 +Hideheadline=0 +Hidetitle=0 +TOOLBAR=57600 57601 32795 0 57635 57634 57637 0 57671 57669 0 32777 32776 32782 32780 32781 32778 0 32806 + + + + + + + + + +[Simulator] +CMDFILE0=CMDFILE STARTUP ON ".\cmd\Full_Chip_Simulation_startup.cmd" + +[Simulator HC12] +CMDFILE0=CMDFILE RESET ON ".\cmd\Full_Chip_Simulation_reset.cmd" +CMDFILE1=CMDFILE PRELOAD ON ".\cmd\Full_Chip_Simulation_preload.cmd" +CMDFILE2=CMDFILE POSTLOAD ON ".\cmd\Full_Chip_Simulation_postload.cmd" +CMDFILE3=CMDFILE SETCPU ON ".\cmd\Full_Chip_Simulation_setcpu.cmd" +HCS12_SUPPORT=1 +FCS=MC9S12C32 +ZEROTIMEATRESET=1 +OSCFREQUENCY=48000000 +DISPLAYTIME=0 diff --git a/cmpen472hw11_McDonnell/Sources/derivative.inc b/cmpen472hw11_McDonnell/Sources/derivative.inc new file mode 100644 index 0000000..988343b --- /dev/null +++ b/cmpen472hw11_McDonnell/Sources/derivative.inc @@ -0,0 +1,10 @@ + + ; Note: This file is recreated by the project wizard whenever the MCU is + ; changed and should not be edited by hand + ; + + ; include derivative specific macros + INCLUDE 'mc9s12c32.inc' + + + diff --git a/cmpen472hw11_McDonnell/Sources/example.asm b/cmpen472hw11_McDonnell/Sources/example.asm new file mode 100644 index 0000000..0ab912d --- /dev/null +++ b/cmpen472hw11_McDonnell/Sources/example.asm @@ -0,0 +1,356 @@ +;******************************************************* +;* CMPEN 472, 2022 Spring +;* Homework 10: Timer Interrupt Sample Program, +;* MC9S12C128 Program (set to MC9S12C32 for Simulation/Debug) +;* CodeWarrior Simulator/Debug edition, not for CSM-12C128 board +;* Nov. 01, 2021 Kyusun Choi +;* March 27, 2022 Kyusun Choi +;* Nov. 07, 2022 Kyusun Choi +;* +;* This program is a 1024 data transfer program running on the +;* CodeWarrior Debugger/Simulator as follows: +;* 1. Program starts with print messages on the simulator Terminal, +;* an intro message at 1.5M baud (this program will not work +;* on the CSM-12C128 board - 1.5M baud too fast). +;* 2. Then user may hit any key, it's a typewriter program at 1.5M baud. +;* But hitting the Enter key will terminate the typewriter mode with +;* the instruction message print. +;* 3. Two messages are (1) start terminal data capture into a file and +;* (2) hit Enter key for the 1024 data transfer to begin. +;* 4. At this time, user setup the Terminal Output file, data capture to a file. +;* 5. User hits an Enter key to send 1024 data, to the Terminal and +;* the data saved in to a file named RxData3.txt which may be looked at +;* or plotted using Excel sheet. +;* 6. User may repeat the step 3 above as many times as he/she like. +;* User plots or prints the data to verify the correct data transmit. +;* +;* We assumed 24MHz bus clock and 4MHz external resonator clock frequency. +;* +;******************************************************* +;******************************************************* + +; export symbols - program starting point + XDEF Entry ; export 'Entry' symbol + ABSENTRY Entry ; for assembly entry point + +; include derivative specific macros +PORTB EQU $0001 +DDRB EQU $0003 + +SCIBDH EQU $00C8 ; Serial port (SCI) Baud Register H +SCIBDL EQU $00C9 ; Serial port (SCI) Baud Register L +SCICR2 EQU $00CB ; Serial port (SCI) Control Register 2 +SCISR1 EQU $00CC ; Serial port (SCI) Status Register 1 +SCIDRL EQU $00CF ; Serial port (SCI) Data Register + +TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select +TIE EQU $004C ; Timer interrupt enable register +TCNTH EQU $0044 ; Timer free runing main counter +TSCR1 EQU $0046 ; Timer system control 1 +TSCR2 EQU $004D ; Timer system control 2 +TFLG1 EQU $004E ; Timer interrupt flag 1 +TC6H EQU $005C ; Timer channel 2 register + +CR equ $0d ; carriage return, ASCII 'Return' key +LF equ $0a ; line feed, ASCII 'next line' character + +DATAmax equ 1024 ; Data count maximum, 1024 constant + +;******************************************************* +; variable/data section + ORG $3000 ; RAMStart defined as $3000 + ; in MC9S12C128 chip + +ctr125u DS.W 1 ; 16bit interrupt counter for 125 uSec. of time + +BUF DS.B 6 ; character buffer for a 16bit number in decimal ASCII +CTR DS.B 1 ; character buffer fill count + +msg1 DC.B 'Hello, this is 1024 data transmit program.', $00 +msg2 DC.B 'When ready, hit Enter key.', $00 +;* more text messages at the End of this program + +;******************************************************* +; interrupt vector section + + ORG $FFE2 ; Timer channel 6 interrupt vector setup, on simulator + DC.W oc6isr + +;******************************************************* +; code section + + ORG $3100 +Entry + LDS #Entry ; initialize the stack pointer + + LDAA #%11111111 ; Set PORTB bit 0,1,2,3,4,5,6,7 + STAA DDRB ; as output + LDAA #%00000000 ; Clear PORTB bit 0,1,2,3,4,5,6,7 + STAA PORTB ; Clear all bits of PORTB, initialize + + ldaa #$0C ; Enable SCI port Tx and Rx units + staa SCICR2 ; disable SCI interrupts + + ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation) +; ldd #$0002 ; Set SCI Baud Register = $0002 => 750K baud at 24MHz +; ldd #$000D ; Set SCI Baud Register = $000D => 115200 baud at 24MHz +; ldd #$009C ; Set SCI Baud Register = $009C => 9600 baud at 24MHz + std SCIBDH ; SCI port baud rate change + + ldx #msg1 ; print the first message, '1024 data transmit' + jsr printmsg + jsr nextline + + ldx #msg2 ; print the second message, user instruction, + jsr printmsg ; hit 'Enter' + jsr nextline + +mloop1 + jsr getchar + cmpa #0 + beq mloop1 + jsr putchar ; type writer, with echo print + cmpa #CR + bne mloop1 ; if Enter/Return key is pressed, move the + + ldaa #LF ; cursor to next line + jsr putchar + + ldx #msg3 ; print '> Set Terminal save file RxData3.txt' + jsr printmsg + jsr nextline + + ldx #msg4 ; print '> Press Enter/Return key to start sawtooth wave' + jsr printmsg + jsr nextline + + jsr delay1ms ; flush out SCI serial port + ; wait to finish sending last characters + +mloop2 + jsr getchar + cmpa #0 + beq mloop2 + cmpa #CR + bne mloop2 ; if Enter/Return key is pressed, move the + + jsr nextline + jsr nextline + jsr delay1ms ; flush out SCI serial port + ; wait to finish sending last characters + + ldx #0 ; Enter/Return key hit + stx ctr125u + jsr StartTimer6oc + + CLI ; Interrupt enable, for Timer OC6 interrupt start + + +loop1024 + ldd ctr125u + cpd #DATAmax ; 1024 bytes will be sent, the receiver at Windows PC + bhs loopTxON ; will only take 1024 bytes. + bra loop1024 ; set Terminal Cache Size to 10000 lines, update from 1000 lines + +loopTxON + LDAA #%00000000 + STAA TIE ; disable OC6 interrupt + + jsr nextline + jsr nextline + + ldx #msg5 ; print '> Done! Close Output file.' + jsr printmsg + jsr nextline + + ldx #msg6 ; print '> Ready for next data transmission' + jsr printmsg + jsr nextline + + BRA mloop2 + + +;subroutine section below + +;***********Timer OC6 interrupt service routine*************** +oc6isr + ldd #3000 ; 125usec with (24MHz/1 clock) + addd TC6H ; for next interrupt + std TC6H ; + bset TFLG1,%01000000 ; clear timer CH6 interrupt flag, not needed if fast clear enabled + ldd ctr125u + ldx ctr125u + inx ; update OC6 (125usec) interrupt counter + stx ctr125u + clra ; print ctr125u, only the last byte + jsr pnum10 ; to make the file RxData3.txt with exactly 1024 data +oc2done RTI +;***********end of Timer OC6 interrupt service routine******** + +;***************StartTimer6oc************************ +;* Program: Start the timer interrupt, timer channel 6 output compare +;* Input: Constants - channel 6 output compare, 125usec at 24MHz +;* Output: None, only the timer interrupt +;* Registers modified: D used and CCR modified +;* Algorithm: +; initialize TIOS, TIE, TSCR1, TSCR2, TC2H, and TFLG1 +;********************************************** +StartTimer6oc + PSHD + LDAA #%01000000 + STAA TIOS ; set CH6 Output Compare + STAA TIE ; set CH6 interrupt Enable + LDAA #%10000000 ; enable timer, Fast Flag Clear not set + STAA TSCR1 + LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1 + STAA TSCR2 ; not needed if started from reset + + LDD #3000 ; 125usec with (24MHz/1 clock) + ADDD TCNTH ; for first interrupt + STD TC6H ; + + BSET TFLG1,%01000000 ; initial Timer CH6 interrupt flag Clear, not needed if fast clear set + LDAA #%01000000 + STAA TIE ; set CH6 interrupt Enable + PULD + RTS +;***************end of StartTimer2oc***************** + + +;***********pnum10*************************** +;* Program: print a word (16bit) in decimal to SCI port +;* Input: Register D contains a 16 bit number to print in decimal number +;* Output: decimal number printed on the terminal connected to SCI port +;* +;* Registers modified: CCR +;* Algorithm: +; Keep divide number by 10 and keep the remainders +; Then send it out to SCI port +; Need memory location for counter CTR and buffer BUF(6 byte max) +;********************************************** +pnum10 pshd ;Save registers + pshx + pshy + clr CTR ; clear character count of an 8 bit number + + ldy #BUF +pnum10p1 ldx #10 + idiv + beq pnum10p2 + stab 1,y+ + inc CTR + tfr x,d + bra pnum10p1 + +pnum10p2 stab 1,y+ + inc CTR +;-------------------------------------- + +pnum10p3 ldaa #$30 + adda 1,-y + jsr putchar + dec CTR + bne pnum10p3 + jsr nextline + puly + pulx + puld + rts +;***********end of pnum10******************** + +;***********printmsg*************************** +;* Program: Output character string to SCI port, print message +;* Input: Register X points to ASCII characters in memory +;* Output: message printed on the terminal connected to SCI port +;* +;* Registers modified: CCR +;* Algorithm: +; Pick up 1 byte from memory where X register is pointing +; Send it out to SCI port +; Update X register to point to the next byte +; Repeat until the byte data $00 is encountered +; (String is terminated with NULL=$00) +;********************************************** +NULL equ $00 +printmsg psha ;Save registers + pshx +printmsgloop ldaa 1,X+ ;pick up an ASCII character from string + ; pointed by X register + ;then update the X register to point to + ; the next byte + cmpa #NULL + beq printmsgdone ;end of strint yet? + bsr putchar ;if not, print character and do next + bra printmsgloop +printmsgdone pulx + pula + rts +;***********end of printmsg******************** + +;***************putchar************************ +;* Program: Send one character to SCI port, terminal +;* Input: Accumulator A contains an ASCII character, 8bit +;* Output: Send one character to SCI port, terminal +;* Registers modified: CCR +;* Algorithm: +; Wait for transmit buffer become empty +; Transmit buffer empty is indicated by TDRE bit +; TDRE = 1 : empty - Transmit Data Register Empty, ready to transmit +; TDRE = 0 : not empty, transmission in progress +;********************************************** +putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty + staa SCIDRL ; send a character + rts +;***************end of putchar***************** + +;****************getchar*********************** +;* Program: Input one character from SCI port (terminal/keyboard) +;* if a character is received, other wise return NULL +;* Input: none +;* Output: Accumulator A containing the received ASCII character +;* if a character is received. +;* Otherwise Accumulator A will contain a NULL character, $00. +;* Registers modified: CCR +;* Algorithm: +; Check for receive buffer become full +; Receive buffer full is indicated by RDRF bit +; RDRF = 1 : full - Receive Data Register Full, 1 byte received +; RDRF = 0 : not full, 0 byte received +;********************************************** + +getchar brclr SCISR1,#%00100000,getchar7 + ldaa SCIDRL + rts +getchar7 clra + rts +;****************end of getchar**************** + +;****************nextline********************** +nextline + psha + ldaa #CR ; move the cursor to beginning of the line + jsr putchar ; Cariage Return/Enter key + ldaa #LF ; move the cursor to next line, Line Feed + jsr putchar + pula + rts +;****************end of nextline*************** + +;****************delay1ms********************** +delay1ms: pshx + ldx #$1000 ; count down X, $8FFF may be more than 10ms +d1msloop nop ; X <= X - 1 + dex ; simple loop + bne d1msloop + pulx + rts +;****************end of delay1ms*************** + +msg3 DC.B '> Be sure to start saving Terminal data: open Output file = RxData3.txt', $00 +msg4 DC.B '> When ready, hit Enter/Return key for sawtooth wave, 1024 point print.', $00 +msg5 DC.B '> Done! You may close the Output file.', $00 +msg6 DC.B '> Ready for next data transmission, hit Enter key.', $00 + + END ; this is end of assembly source file + ; lines below are ignored - not assembled + diff --git a/cmpen472hw11_McDonnell/Sources/main.asm b/cmpen472hw11_McDonnell/Sources/main.asm new file mode 100644 index 0000000..e9e65c3 --- /dev/null +++ b/cmpen472hw11_McDonnell/Sources/main.asm @@ -0,0 +1,1073 @@ +************************************************************************** +* +* Title: Signal Generator +* +* Objective: CMPEN 472 Homework 11 +* +* Revision: V1.0 +* +* Date: Apr. 11, 2025 +* +* Programmer: Jacob McDonnell +* +* Company: The Pennsylvania State University +* Department of Computer Science and Engineering +* +* Algorithm: Simple Serial I/O, Real Time Interrupts for Time Tracking, and +* output compare timer for generating functions. +* +* Register Use: A & B to current byte, etc, +* X & Y holds address of strings and length of string, +* D to hold data for printing, reading, and updating time. +* +* Memory Use: RAM Locations from $3000 for data, +* RAM Locations from $3100 for program +* +* Input: Serial Port for User Input +* +* Output: Serial Port for String Output +* +* 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, +* +* Comments: This program is developed and simulated using CodeWarrior +* development software and targeted for Axion +* Manufacturing's CSM-12C128 board running at 24MHz. +* +************************************************************************** +* Parameter Declearation Section +* +* Export Symbols + xdef pgstart ; export 'pgstart' symbol + absentry pgstart ; for assembly entry point + +* Symbols and Macros +PORTA equ $0000 ; i/o port A addresses +DDRA equ $0002 ; data direction register for PORTA +PORTB equ $0001 ; i/o port B addresses +DDRB equ $0003 ; data direction register for PORTB + +SCIBDH equ $00C8 ; Serial port (SCI) Baud Register H +SCIBDL equ $00C9 ; Serial port (SCI) Baud Register L +SCICR2 equ $00CB ; Serial port (SCI) Control Register 2 +SCISR1 equ $00CC ; Serial port (SCI) Status Register 1 +SCIDRL equ $00CF ; Serial port (SCI) Data Register + +CRGFLG EQU $0037 ; Clock and Reset Generator Flags +CRGINT EQU $0038 ; Clock and Reset Generator Interrupts +RTICTL EQU $003B ; Real Time Interrupt Control + +TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select +TIE EQU $004C ; Timer interrupt enable register +TCNTH EQU $0044 ; Timer free runing main counter +TSCR1 EQU $0046 ; Timer system control 1 +TSCR2 EQU $004D ; Timer system control 2 +TFLG1 EQU $004E ; Timer interrupt flag 1 +TC1H EQU $0052 ; Timer channel 1 register + +CR equ $0d ; carriage return, ASCII 'Return' key +LF equ $0a ; line feed, ASCII 'next line' character +NULL equ $00 ; NULL Terminator character + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +buffer ds.b $0010 ; Array of 16 bytes to read a string + dc.b NULL ; NULL terminated +lenBuf dc.w $0010 ; Length of buffer array + +buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal + dc.b NULL ; NULL terminated +lenBuf2 dc.w $0010 ; length of buffer2 + +hours dc.w $0000 ; Buffer to hold the hours of the time + +minutes dc.w $0000 ; Buffer to hold the minutes of the time + +seconds dc.w $0000 ; Buffer to hold the seconds of the time + +counter dc.w $0000 ; Counter for RTI ISR for 1 second + +numBuf dc.b $0000 ; Used by ReadDecimal for reading numbers + +operator dc.b $0000 ; Used by ReadDecimal for reading numbers + +inputBuffer ds.b $0010 ; Input Buffer Length + dc.b NULL + +lenInput dc.w $0010 ; Length of the Input Buffer + +outputBuf dc.b 's' ; Used to control what to output on 7 segment display + +outputVal dc.b $00 ; Used to track the output value of the wave + +outputCnt dc.w $0000 ; Used to track how many values have been outputted + +interval dc.w 3000 ; Used to set the timer module based on clock cycles + +numPoints dc.w 2048 ; Max Number of points for waves + +timeTrigger dc.b $00 ; Tracks when timer is triggered + +increment dc.w 1 ; Used for increment 31.25Hz -> 1 + ; 125Hz -> 4 + +waveType dc.b 'S' ; Used to track wave type 'T' for increasing triangle, + ; 't' for decreasing triangle, + ; 'Q' for square high + ; 'q' for square low + ; 'S' for sawtooth + +* +* There is a section Data Section at the end of the file +************************************************************************** +* RTI Vector Section: address used [ $FFF0 to $FFF1 ] RAM Memory +* + org $FFF0 ; Memory location for RTI interrupt vector section for simulator + dc.w rtiisr ; Real Time Interrupt vector +* +************************************************************************** +* Timer Interrupt Vector Section: address used [ $FFEC to $FFED ] RAM Memory +* + org $FFEC ; Timer channel 1 interrupt vector setup, on simulator + dc.w oc1isr +* +************************************************************************** +* Program Section: address used [ $3100 to $3FFF ] RAM Memory +* + org $3100 ; Program start address, in RAM +pgstart lds #$3100 ; initialize the stack pointer + + ldaa #%11110001 ; LED 1,2,3,4 at PORTB bit 4,5,6,7 + staa DDRB ; set PORTB bit 4,5,6,7 as output + + ldaa #$0C ; Enable SCI port Tx and Rx units + staa SCICR2 ; disable SCI interrupts + + ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation) + std SCIBDH ; SCI port baud rate change + + ldx #msg ; Load the address of the welcome message into X + jsr WriteString ; Write the string to the serial console + + bset RTICTL,%00011001; set RTI: dev=10*(2**10)=2.555msec for C128 board + ; 4MHz quartz oscillator clock + bset CRGINT,%10000000; enable RTI interrupt + bset CRGFLG,%10000000; clear RTI IF (Interrupt Flag) + + ldaa #$FF ; Two 7 segment displays on PORTB + staa DDRB ; Set all of PORTB as output + + cli ; Enable interrupts +mainLoop + ldaa #'>' ; Load '>' character + jsr putchar ; Print to serial console + ldaa #' ' ; Load ' ' character + jsr putchar ; Print to serial console + ldx #inputBuffer ; Load the address of inputBuffer into X + ldy lenInput ; Load the length of inputBuffer into Y + jsr ReadString ; Jump to ReadString to read input + + ldx #inputBuffer ; Load the address of inputBuffer into X + jsr ExecuteCommand ; Jump to ExecuteCommand + + ldx #inputBuffer ; Load the address of inputBuffer into X + ldy lenInput ; Load the length of inputBuffer into Y + jsr Zeros ; Zero out input buffer + + bra mainLoop ; Loop back to mainLoop always + +TypeWrite + sei ; Disable Interrupts + bclr CRGINT,%10000000; Disable RTI interrupt + ldx #twMsg ; Load the address of twMsg into X + jsr WriteString ; Write the string to the serial console +twLoop jsr getchar ; Read a character from the serial console + tsta ; Compare A to 0 + beq twLoop ; If A == 0, branch to twLoop + staa PORTB ; Write A to PORTB + jsr putchar ; Write character to serial console + bra twLoop ; Branch always to twLoop + +************************************************************************** +* 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 + cli ; Enable interrupts + ldx counter ; Load counter into X + inx ; Increment counter by 1 + stx counter ; Save X to counter + cpx #200 ; Compare counter to 200, This is about 1 second on my computer + bne rtiSkip ; If counter != 200, branch to rtiSkip + ldx #0 ; Load 0 into X + stx counter ; Save X to counter + ldx seconds ; Load the seconds into X + inx ; Increment the seconds by 1 + stx seconds ; Save the new seconds to the location + cpx #60 ; Compare X to 60 + bne rtidone ; If X != 60, exit isr + ldx #0 ; Reset the seconds + stx seconds ; Save the new seconds to the location + ldx minutes ; load the minutes into X + inx ; Increment the minutes by 1 + stx minutes ; Save the updated minutes + cpx #60 ; Compare the minutes to 60 + bne rtidone ; If X != 60, exit isr + ldx #0 ; Reset the minutes + stx minutes ; Save the updated minutes + ldx hours ; Load the hours into X + inx ; Increment the hours by 1 + stx hours ; Save the updated hours + cpx #24 ; Compare the hours to 24 + bne rtidone ; If X != 24, exit the isr + ldx #0 ; Reset the hours + stx hours ; Save the updated hours +rtidone jsr PrintTime ; Jump to PrintTime +rtiSkip RTI ; Return from RTI ISR + +;************************************************************************* +; oc1isr subroutine +; +; This subroutine will set a flag after a set number of cycles. +; +; Input: interval memory location for the number of cycles between triggers +; Output: The outputCnt counting the number of triggers, and timeTrigger to +; signal a timmer trigger. +; Registers in use: A for setting timeTrigger, D for increasing outputCnt and setting next count. +; Memory locations in use: Memory Address for oc5 timer, outputCnt, timeTrigger, numPoints, interval +; +; Comments: The timer will stop after outputCnt == numPoints +; + +oc1isr ldd interval ; Load the interval for the next clock cycle + addd TC1H ; for next interrupt + std TC1H ; + bset TFLG1,%00100010 ; Clear CH1 interrupt flag + ldaa #1 ; Load 1 into A + staa timeTrigger ; Signal that timer went off + ldd outputCnt ; Load the count of values outputed into D + addd #1 ; Increase output count by 1 + std outputCnt ; Update the count of outputted values + cpd numPoints ; Compare D to numPoints + blo oc1Done ; If D < numPoints, Done + jsr StopTimerCH1 ; Stop Channel 1 Timer +oc1Done RTI ; Return from interrupt + +;************************************************************************* +; PrintWave subroutine +; +; This subroutine will print a one byte decimal value to the serial console. +; The outputVal will be incremented by increment. It can follow a square wave, +; a triangle wave, & a sawtooth wave pattern. +; +; Input: waveType to denote the patter, increment to increment the outputVal +; Output: outputVal printed to the serial console +; Registers in use: A for finding the wave type, B for reading the outputVal, +; D for math and checking of outputVal +; Memory locations in use: waveType to set the patter, outputVal for printing +; the output value +; +; Comments: The timer will stop after outputCnt == numPoints +; + +PrintWave + pshd ; Save D to the stack + pshy ; Save Y to the stack + ldaa waveType ; Load the waveType into A + cmpa #'T' ; Compare to 'T' + lbeq TriangleInc ; If A == 'T', triangle wave increasing + cmpa #'t' ; Compare A to 't' + lbeq TriangleDec ; If A == 't', triangle wave decreasing + cmpa #'Q' ; Compare A to 'Q' + lbeq SquareWaveH ; If A == 'Q', square wave high + cmpa #'q' ; Compare A to 'q' + lbeq SquareWaveL ; If A == 'q', square wave low +SawToothWav clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + lblo DonePrint ; If D < 256, Done + clrb ; Reset to Zero + lbra DonePrint ; Branch to DonePrint +SquareWaveH clra ; Clear A + ldab #255 ; Load 255 into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + clra ; Clear A + ldab outputVal ; Load the output value into B + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + lblo DonePrint ; If D < 256, done + clrb ; Reset B to zero + ldaa #'q' ; Load 'q' into A + staa waveType ; Update wave type to square wave low + bra DonePrint ; Branch to DonePrint +SquareWaveL clra ; Clear A + clrb ; Reset B to zero + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + clra ; Clear A + ldab outputVal ; Load the output value into B + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + blo DonePrint ; If D < 256, done + clrb ; Reset B to zero + ldaa #'Q' ; Load 'Q' into A + staa waveType ; Update wave type to square wave low + bra DonePrint ; Branch to DonePrint +TriangleInc clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + blo DonePrint ; If D < 256, done + ldaa #'t' ; Load 't' into A + staa waveType ; Update wave type to decreasing triangle + subd #1 ; Subtract 1 from D + bra DonePrint ; Branch to DonePrint +TriangleDec clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + subd increment ; Subtract increment from D + cpd #0 ; Compare D to 0 + blt DonePrint ; If D < 0, done + ldaa #'T' ; Load 'T' into A + staa waveType ; Update wave type to increasing triangle + clrb ; Clear B +DonePrint stab outputVal ; Store updated output value + puly ; Restore Y from the stack + puld ; Restore D from the stack + rts ; Return from Caller + +;************************************************************************* +; StartTimer1oc subroutine +; +; This subroutine will enable & start the oc1 timer. +; +; Input: Interval to set the next clock cycle +; Output: No output other +; Registers in use: A used for setting up the oc5 timer, D for setting the next trigger +; Memory locations in use: All memory locations used for the oc5 timer. +; interval to set the next cycle. +; +; Comments: The timer will be enabled only on channel 1 for output compare. +; + +StartTimer1oc + PSHD + LDAA #%00000010 + STAA TIOS ; set CH1 Output Compare + STAA TIE ; set CH1 interrupt Enable + LDAA #%10000000 ; enable timer, Fast Flag Clear not set + STAA TSCR1 + LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1 + STAA TSCR2 ; not needed if started from reset + + LDD interval ; 125usec with (24MHz/1 clock) + ADDD TCNTH ; for first interrupt + STD TC1H ; + + BSET TFLG1,%00000010 ; initial Timer CH5 interrupt flag Clear, not needed if fast clear set + LDAA #%00000010 + STAA TIE ; set CH1 interrupt Enable + PULD + RTS + +;************************************************************************* +; StopTimerCH1 subroutine +; +; This subroutine will stop and disable the timer. +; +; Input: No Input +; Output: No output other +; Registers in use: A to disable the timer. +; Memory locations in use: TIE to disable the timer. +; +; Comments: The timer will be disabled on all channels. +; + +StopTimerCH1 + psha ; Save A to the stack + clra ; Clear A + staa TIE ; Stop Timers + pula ; Restore A from the stack + rts ; Return + +;************************************************************************* +; GenWave subroutine +; +; This subroutine will setup the proper variables to generate a wave and wait +; for the wave to finish generating. +; +; Input: No input but the variables for PrintWave are required. +; Output: No output except for the output of PrintWave +; Registers in use: A for reading the timeTrigger variable, +; D for reading outputCnt. +; Memory locations in use: outputCnt, outputVal, timeTrigger, numPoints. +; +; Comments: This subroutine does not have any direct input or output but calls +; PrintWave so the inputs for PrintWave should be set and the output +; of PrintWave should be expected. +; + +GenWave + pshd ; Save D to the stack + ldd #0 ; Clear D + std outputCnt ; Clear outputCnt + staa outputVal ; Clear outputVal + + jsr StartTimer1oc ; Start Timer on CH1 + +genLoop ldaa timeTrigger ; Load timeTrigger into A + beq genLoop ; If A == 0, loop + clra ; Clear A + staa timeTrigger ; Clear timeTrigger + jsr PrintWave ; Jump to PrintWave + ldd outputCnt ; Load outputCnt into D + cpd numPoints ; Compare D to numPoints + blo genLoop ; If D < numPoints, Loop + + jsr StopTimerCH1 ; Turn off timer + puld ; Restore D from the stack + rts ; Return + +;************************************************************************* +; 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 + ldaa outputBuf ; Load outputBuf into A + cmpa #'h' ; Compare A to 'h' + bne pTimeIsM ; If A != 'h', branch to pTimeIsM + ldd hours ; Load hours into B + bra skipRest ; Jump to skipRest +pTimeIsM cmpa #'m' ; Compare A to 'm' + bne pTimeIsS ; If A != 'm', branch to pTimeIsS + ldd minutes ; Load Minutes into D + bra skipRest ; Jump to skipRest +pTimeIsS ldd seconds ; Load seconds into D +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 + ldx #10 ; Load 10 into X to get digit + idiv ; Divide D by X and save Digit into D + pshb ; Save B to the stack (Lower Byte of D) + exg x,d ; Swap X and D + ldx #10 ; Load 10 into X to get digit + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + orab 1,sp+ ; Or B with Digit on stack + stab PORTB ; Save B to PORTB + pulx ; Restore X from the stack + puld ; Restore D from the stack + rts ; Return from caller + +;************************************************************************* +; ExecuteCommand subroutine +; +; This subroutine will parse user input and execute the proper command or error out. +; +; Input: An address of a NULL terminated string in X. +; Output: The output of the proper command or an error message. +; Registers in use: X for the address of the user input, A for individual characters, +; D & Y for numbers read from user input. +; Memory locations in use: Serial console memory locations. +; +; Comments: This subroutine will disable interrupts while setting the time and will +; reenable them after setting the time. +; + +ExecuteCommand + pshd ; Save D to the stack + pshy ; Save Y to the stack + ldaa 1,x+ ; Load the character from X into A + lbeq ecDone ; If A == 0, jump to ecDone + cmpa #'t' ; Compare A to 't' + bne isH ; If A != 't', branch to isH +skipSpaces ldaa 1,+x ; Load the next character into X + cmpa #' ' ; Compare A to ' ' character + beq skipSpaces ; If A == ' ', loop to skipSpaces + sei ; Disable interrupts + ldd hours ; Load hours into D + pshd ; Save hours to the stack + jsr ReadDecimal ; Read Hour number + exg y,d ; Exchange Y and D + cpd #24 ; Compare D to 24 + lbhs badHours ; If D >= 24, badHours + cpd #0 ; Compare D to 0 + lblt badHours ; If D < 0, badHours + std hours ; Save D to hours + ldaa -1,x ; Load the next character into A + cmpa #':' ; Compare A to ':' + lbne badHours ; If A != ':', badHours + ldd minutes ; Load minutes into D + pshd ; Save minutes to the stack + jsr ReadDecimal ; Read minute number + exg y,d ; Exchange Y and D + cpd #60 ; Compare D to 60 + lbhs badMinutes ; If D >= 60, badMinutes + cpd #0 ; Compare D to 0 + lblt badMinutes ; If D < 0, badMinutes + std minutes ; Save D to minutes + ldaa -1,x ; Load the next character into A + cmpa #':' ; Compare A to ':' + lbne badMinutes ; If A != ':', badMinutes + ldd seconds ; Load seconds into D + pshd ; Save seconds to the stack + jsr ReadDecimal ; Read second number + exg y,d ; Exchange Y and D + cpd #60 ; Compare D to 60 + lbhs badSeconds ; If D >= 60, badSeconds + cpd #0 ; Compare D to 0 + lblt badSeconds ; If D < 0, badSeconds + std seconds ; Save D to seconds + ldaa -1,x ; Load the next character into A + cmpa #NULL ; Compare A to NULL + lbne badSeconds ; If A != ':', badSeconds + clra ; Set A to 0 + staa counter ; Clear Counter + cli ; Enable interrupts + puld ; Restore D from the stack + puld ; Restore D from the stack + puld ; Restore D from the stack + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isH cmpa #'h' ; Compare A to 'h' + bne isM ; If A != 'h', branch to isM + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isM cmpa #'m' ; Compare A to 'm' + bne isS ; If A != 'm', branch to isS + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isS cmpa #'s' ; Compare A to 's' + bne isQ ; If A != 's', branch to isQ + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isQ cmpa #'q' ; Compare A to 'q' + bne isGw ; If A != 'q', branch to isGw + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != NULL, branch to ecDone + jmp TypeWrite ; Jump to TypeWrite +isGw cmpa #'g' ; Compare A to 'g' + lbne badCommand ; If A != 'g', branch to badCommand + ldaa 1,x+ ; Load next character into B + cmpa #'w' ; Compare A to 'w' + bne isGt ; If A != 'w', branch to isGt + ldab 1,x+ ; Load next charater into B + cmpb #NULL ; Compare B to NULL + bne isGw2 ; If B != NULL, branch to isGw2 + ldx #swMsg ; Load address of sawtooth message + jsr WriteString ; Write string + ldaa #'S' ; Load 'S' for sawtooth + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGw2 cmpb #'2' ; Compare B to '2' + lbne badCommand ; If B != '2', bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare to NULL + lbne badCommand ; Not NULL? bad + ldx #sw2Msg ; Load address of sawtooth 125Hz message + jsr WriteString ; Write string + ldaa #'S' ; Load 'S' for sawtooth + staa waveType ; Save A to waveType + ldd #4 ; Load 4 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGt cmpa #'t' ; Compare A to 't' + bne isGq ; If A != 't', branch to isGq + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare to NULL + lbne badCommand ; A != NULL? bad + ldx #tMsg ; Load address of triangle message + jsr WriteString ; Write string + ldaa #'T' ; Load 'T' for triangle + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGq cmpa #'q' ; Compare A to 'q' + lbne badCommand ; A != 'q'? bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + bne isGq2 ; B != NULL? isGq2 + ldx #sqMsg ; Load address of square message + jsr WriteString ; Write string + ldaa #'q' ; Load 'q' for square + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGq2 cmpb #'2' ; Compare B to '2' + lbne badCommand ; B != '2'? bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + bne badCommand ; B != NULL? bad + ldx #sq2Msg ; Load address of square 125Hz message + jsr WriteString ; Write string + ldaa #'q' ; Load 'q' for square + staa waveType ; Save A to waveType + ldd #8 ; Load 8 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +badSeconds puld ; Restore Seconds from the stack + std seconds ; Restore seconds before change +badMinutes puld ; Restore minutes from the stack + std minutes ; Restore minutes before change +badHours puld ; Restore hours from the stack + std hours ; Restore hours before change + cli ; Reenable interrupts +badCommand pshx ; Save X to the stack + ldx #badInput ; Load the address of badInput into X + jsr WriteString ; Jump to WriteString + pulx ; Restore X from the stack +ecDone puly ; Restore Y from the stack + puld ; Restore D from the stack + rts ; Return to caller + +;************************************************************************* +; ReadDecimal subroutine +; +; This subroutine will read an ASCII string of a number in decimal and convert it to +; its value. +; +; Input: A memory address in register X. +; Output: The value of the number in the Y register, and any errors printed +; to the serial line. Zero bit is set if error occurs. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine will return the value in the Y register, and if an error occurs, +; the Zero bit in the CCR will be set. +; + +ReadDecimal + pshd ; Save D to the stack + ldy #0 ; Clear Y register +dHLoop ldab 1,x+ ; Read Next character from X + beq dHDone ; If B == 0, exit loop + cmpb #'+' ; Compare B to '+' + beq dHDone ; If B == '+', end of number + cmpb #'-' ; Compare B to '-' + beq dHDone ; If B == '-', end of number + cmpb #'*' ; Compare B to '*' + beq dHDone ; If B == '+', end of number + cmpb #'/' ; Compare B to '/' + beq dHDone ; If B == '-', end of number + cmpb #':' ; Compare B to ':' + beq dHDone ; If B == '-', end of number + cmpb #' ' ; Compare B to space character + beq dHDone ; If B == ' ', exit loop + cmpb #'0' ; Compare B to '0' character + blt dHError ; If B < '0', bad address, exit loop + cmpb #'9' ; Compare B to '9' character + bhi dHError ; If B > '9', check if 'A'-'F' characters + subb #'0' ; Subtract '0' from B to get true value + pshb ; Save B to the stack + ldd #10 ; load 10 into D + emul ; Multiply Y and D + exg d,y ; Transfer data from D to Y + pulb ; Restore b from the stack + aby ; Add B to Y + bra dHLoop ; Branch always to rHLoop +dHDone clra ; clear A accumulator + tap ; Transfer A into CCR to clear zero bit + puld ; Restore D from the stack + rts ; Return to caller +dHError ldaa #4 ; Load 4 into A to set zero bit in CCR + tap ; Transfer A into CCR to set zero bit and warn error + puld ; Restore D from the stack + rts ; Return to caller + +;************************************************************************* +; strrev subroutine +; +; This subroutine will reverse a string from one buffer into another. +; +; Input: Address of null terminated string in X, address of a large enough +; buffer in Y. +; Output: The string in X reversed in Y. +; Registers in use: X for the address of the string, Y for the address of the buffer, +; A to read characters from the string. +; Memory locations in use: Memory Address for serial line, address of the string & buffer +; +; Comments: This subroutine will not check that the output buffer is large enough, that +; is the job of the caller. +; + +strrev + pshx ; Save X to the stack + pshy ; Save Y to the stack + psha ; Save A to the stack +revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y + beq revDone ; If Character is 0, exit loop + staa 1,x+ ; Save character in address in X, increment X + bra revLoop ; Loop back always + clra ; Set A to Zero +revDone staa 1,x+ ; Copy Null terminator into new string + pula ; Restore A from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller + +;************************************************************************* +; PrintDecimalWord subroutine +; +; This subroutine will print a given word of data to the serial in binary. +; +; Input: 1 word of data in register D, Buffer Address in Y +; Output: Decimal representation of the data on the serial console +; Registers in use: Y for the address of the buffer, X to count the number of bits +; written and for division, D for the input, A for characters. +; Memory locations in use: Memory addresses for serial, and operator to hold sign +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +PrintDecimalWord + pshx ; Save X to the stack + pshy ; Save Y to the stack + pshd ; Save D (A:B) to the stack + cpd #0 ; Compare D to zero + beq dIsZero ; Branch to hIsZero + blt dIsNegative ; If D < 0, Jump to dIsNegative +dAfterNeg psha ; Save A to the stack + pshy ; Save Y to the stack + pshx ; Save x to the stack + ldaa #'0' ; Load the '0' character into A + ldx #buffer2 ; Load the address of buffer2 into X + ldy #5 ; Load 5 into Y + jsr memset ; Write '0' to the first 5 bytes in buffer2 + pulx ; Restore X from the stack + puly ; Restore Y from the stack + clra ; Set A to zero + staa 0,y ; Load Zero into Y for Null Terminator + pula ; Restore A from the stack +dPrintLoop ldx #10 ; Load 10 in X for division + idiv ; Divide D / 10 to get Hex Digit + cpx #0 ; Compare X to 0 + beq dCheck ; If X == 0, branch to check D is zero +dDNotZero addb #'0' ; Add '0' to B to get ASCII Character + stab 1,+y ; Save character from B to Y + exg X,D ; Swap values in X and D + bra dPrintLoop ; Loop to hPrintLoop +dCheck cpd #0 ; Compare D to 0 + bne dDNotZero ; If D != 0, branch back to hDNotZero +dPrintDone ldaa operator ; Load operator into A to see if negative + cmpa #'-' ; Compare A to '-' + bne dNotNeg ; If A != '-', jump to dNotNeg + staa 1,+y ; Save '-' into buffer +dNotNeg ldx #buffer2 ; Load the address of buffer2 in X + jsr strrev ; Reverse string in Y in buffer in X + jsr WriteString ; Jump to write string to write the number + ldy lenBuf2 ; Load the length of buffer2 into Y + ldx #buffer2 ; Load the address of buffer2 into X + jsr Zeros ; Fill buffer2 with zeros + puld ; Restore D (A:B) from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller +dIsZero ldaa #'0' ; Load '0' character into A + jsr putchar ; Print character to the screen + puld ; Restore D (A:B) from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller +dIsNegative psha ; Save A to the stack + ldaa #'-' ; Load '-' into A + staa operator ; Save '-' to operator buffer + pula ; Restore A from the stack + nega ; Two's complement of A + suba #1 ; Subtract 1 from A + negb ; Two'complement of B + subb #1 ; Subtract 1 from B + addd #1 ; Add 1 to D + bra dAfterNeg ; Jump back to dAfterNeg + +;************************************************************************* +; Zeros subroutine +; +; This subroutine will write zeros to every byte in a given array. +; +; Input: Address of an array in X and its length in Y +; Output: Zeros in every byte of an array. +; Registers in use: X for the address of the array, Y for the length, and A for 0 +; Memory locations in use: Memory Address of the array +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +Zeros + psha ; Save A to the Stack + clra ; Clear A +zerosLoop staa 1,x+ ; Load A into byte at X + dbne y,zerosLoop ; Decrement Y and loop if Y != 0 + pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; memset subroutine +; +; This subroutine will write a given byte to every byte in a given array. +; +; Input: Address of an array in X and its length in Y, the byte in A +; Output: The given byte in every byte of an array. +; Registers in use: X for the address of the array, Y for the length, and A for the given byte +; Memory locations in use: Memory Address of the array +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +memset + staa 1,x+ ; Load A into byte at X + dbne y,memset ; Decrement Y and loop if Y != 0 + rts ; Return to caller + +;************************************************************************* +; WriteString subroutine +; +; This subroutine will write a given null terminated string to the serial. +; +; Input: Address of null terminated string in X +; Output: Null terminated string written to serial +; Registers in use: X for the address of the string and A for the current byte +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +WriteString + psha ; Save A to the stack +writeLoop ldaa 1,x+ ; Load the byte at addr in X, then add 1 + beq doneWrite ; if A == 0, branch to doneWrite + jsr putchar ; Jump to putchar to write byte to serial + bra writeLoop ; branch always to writeLoop +doneWrite pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; ReadString subroutine +; +; This subroutine will read a string from the serial line to a given address. +; +; Input: Address of an array in X +; Output: Null terminated string in the given array +; Registers in use: X for the address of the string Y for the length of the string, +; and A for the current byte +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine requires serial to be setup and getchar subroutine. +; + +ReadString + psha ; Save accumulator A to the stack + pshy ; Save Y to the stack + pshx ; Save X to the stack +readLoop jsr getchar ; Jump to putchar to write byte to serial + beq readLoop ; While A == 0, loop + cmpa #CR ; If A == CR, 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 + beq doneRead ; If Y == 0, no more room, stop reading + bra readLoop ; branch always to readLoop +doneRead ldaa #CR ; Load CR into A + jsr putchar ; Print to serial + ldaa #LF ; Load LF into A + jsr putchar ; Print to serial + pulx ; Restore X from the stack + pulY ; Restore Y from the stack + pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; putchar subroutine +; +; This subroutine writes a single byte to a serial line +; +; Input: A single ASCII byte in accumulator A +; Output: Sends one character to SCI port +; Registers in use: Accumulator A with input byte +; Memory locations in use: SCISR1 and SCIDRL status and data registers +; + +putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty + staa SCIDRL ; send a character + rts ; Return to caller + +;************************************************************************* +; putchar subroutine +; +; This subroutine reads one byte from the SCI port +; +; Input: One byte from the SCI port +; Output: One byte in accumulator A +; Registers in use: Accumulator A for output byte +; Memory locations in use: SCISR1 and SCIDRL status and data registers +; + +getchar brclr SCISR1,#%00100000,getchar7 ; If no input on SCI port, return 0 + ldaa SCIDRL ; Read one byte from SCI port into A + rts ; Return to caller +getchar7 clra ; Set A to 0 + rts ; Return to caller + +* +************************************************************************** +* Data Section 2: address used [ $3100 to $3FFF ] RAM Memory +* + +badInput dc.b 'Invalid Input',CR,LF,NULL ; Invalid Input Prompt + +; twMsg: welcome message for typewrite +twMsg dc.b 'Wave Generator and Clock stopped and Typewrite program started.',CR,LF + dc.b 'You may type below.',CR,LF,NULL + +; Messages for different waveforms +swMsg dc.b 'sawtooth wave generation...',CR,LF,NULL +sw2Msg dc.b 'sawtooth wave 125Hz generation...',CR,LF,NULL +tMsg dc.b 'triangle wave generation...',CR,LF,NULL +sqMsg dc.b 'square wave generation...',CR,LF,NULL +sq2Msg dc.b 'square wave 125Hz generation...',CR,LF,NULL + +doneWave dc.b 'Done generating wave.',CR,LF,NULL + +; msg: this is the main option menu string +msg dc.b 'Commands:',CR,LF + dc.b 'gw: generate sawtooth wave, printing 0 through 255, repeated for total 2048 points',CR,LF + dc.b 'gw2: generate sawtooth wave of 125Hz, wave repeated for total 2048 points',CR,LF + dc.b 'gt: generate triangle wave, printing 0 through 255, then 255 down to 0, repeated for total 2048 points',CR,LF + dc.b 'gq: generate square wave, printing 0 for 255 times, then print 255 for 255 times, then repeated for total 2048 points',CR,LF + dc.b 'gq2: generate square wave of 125Hz, wave repeated for total 2048 points',CR,LF + dc.b 't: Set the time in format HH:MM:SS',CR,LF + dc.b 'h: Display the hours on the 7 segment displays',CR,LF + dc.b 'm: Display the minutes on the 7 segment displays',CR,LF + dc.b 's: Display the seconds on the 7 segment displays',CR,LF + dc.b 'q: Stop the clock and enter typewriter',CR,LF,NULL + + end ; last line of the file diff --git a/cmpen472hw11_McDonnell/bin/Project.abs b/cmpen472hw11_McDonnell/bin/Project.abs Binary files differnew file mode 100644 index 0000000..d156a94 --- /dev/null +++ b/cmpen472hw11_McDonnell/bin/Project.abs diff --git a/cmpen472hw11_McDonnell/bin/Project.abs.phy b/cmpen472hw11_McDonnell/bin/Project.abs.phy new file mode 100644 index 0000000..1545e61 --- /dev/null +++ b/cmpen472hw11_McDonnell/bin/Project.abs.phy @@ -0,0 +1,4 @@ +S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731D +S2060FFFEC31B21C +S2060FFFF0316169 +S9030000FC diff --git a/cmpen472hw11_McDonnell/bin/Project.abs.s19 b/cmpen472hw11_McDonnell/bin/Project.abs.s19 new file mode 100644 index 0000000..086e6c4 --- /dev/null +++ b/cmpen472hw11_McDonnell/bin/Project.abs.s19 @@ -0,0 +1,79 @@ +S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731D +S123300000000000000000000000000000000000000010000000000000000000000000009C +S123302000000000001000000000000000000000000000000000000000000000000000007C +S1123040000010730000000BB8080000000153DB +S1233100CF310086F15A03860C5ACBCC00015CC8CE37371635DA4C3B194C38804C378086A1 +S1233120FF5A0310EF863E16360A862016360ACE3030FD30411635E6CE303016333BCE309D +S123314030FD30411635CB20DC14104D3880CE362A1635DA1636119727FA5A0116360A2059 +S1233160F34C378010EFFE302C087E302C8E00C8263FCE00007E302CFE302A087E302A8EF1 +S1233180003C262ACE00007E302AFE3028087E30288E003C2618CE00007E3028FE302608BD +S12331A07E30268E00182606CE00007E30261633050BFC3047D3525C524C4E2286017A3037 +S12331C04BFC3045C300017C3045BC304925031632D90B3B35B6304E81541827008A8174BA +S12331E0182700AC81511827002B81711827005087F63044CD300016355C36860D16360A6F +S1233200860A16360A32F3304C8C0100182500A4C71820009F87C6FFCD300016355C36866B +S12332200D16360A860A16360A3287F63044F3304C8C01001825007CC786717A304E20741F +S123324087C7CD300016355C36860D16360A860A16360A3287F63044F3304C8C01002554DB +S1233260C786517A304E204C87F63044CD300016355C36860D16360A860A16360A32F33059 +S12332804C8C0100252E86747A304E830001202487F63044CD300016355C36860D16360A90 +S12332A0860A16360A32B3304C8C00002D0686547A304EC77B3044313A3D3B86025A405A1D +S12332C04C86805A4686005A4DFC3047D3445C524C4E0286025A4C3A3D36875A4C323D3B45 +S12332E0CC00007C30457A30441632BAB6304B27FB877A304B1631D3FC3045BC304925EC7D +S12333001632D93A3D3BB6304381682605FC3026200C816D2605FC30282003FC302A1633EC +S1233320233A3D3B34CE000A181037B7D4CE000A58585858EAB05B01303A3D3B35A630188B +S12333402701C38174267EA620812027FA1410FC30263B163509B7E48C0018182401998CB7 +S12333600000182D01927C3026A61F813A18260187FC30283B163509B7E48C003C182401D6 +S1233380738C0000182D016C7C3028A61F813A18260161FC302A3B163509B7E48C003C1824 +S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396 +S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B +S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9 +S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA +S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656 +S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A +S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636 +S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667 +S12334A0005CE630C100261ECE36E11635DA86717A304ECC00017C304C1632DFCE371F1672 +S12334C035DA18200040C13218260032E630C100262CCE36FD1635DA86717A304ECC0008EC +S12334E07C304C1632DFCE371F1635DA182000163A7C302A3A7C30283A7C302610EF34CEE7 +S1233500361A1635DA30313A3D3BCD0000E630272EC12B272AC12D2726C12A2722C12F2724 +S12335201EC13A271AC1202716C1302D17C1392213C03037CC000A13B7C63319ED20CE8770 +S1233540B7023A3D8604B7023A3D343536A67F27056A3020F8876A303231303D34353B8CBA +S12335600000274C2D533635348630CE3013CD00051635D43031876A4032CE000A18108EAB +S123358000002708CB306B60B7D420EE8C000026F3B6302F812D26026A60CE301316354A99 +S12335A01635DAFD3024CE30131635CB3A31303D863016360A3A31303D36862D7A302F32BA +S12335C040800150C001C30001209B36876A300436FB323D6A300436FB3D36A63027051641 +S12335E0360A20F7323D36353416361127FB810D270A6A3016360A03270220ED860D16361C +S12336000A860A16360A3031323D4FCC80FC5ACF3D4FCC200396CF3D873D496E76616C69E2 +S12336206420496E7075740D0A00576176652047656E657261746F7220616E6420436C6FF0 +S1233640636B2073746F7070656420616E64205479706577726974652070726F6772616D21 +S123366020737461727465642E0D0A596F75206D617920747970652062656C6F772E0D0AE6 +S123368000736177746F6F746820776176652067656E65726174696F6E2E2E2E0D0A00737A +S12336A06177746F6F7468207761766520313235487A2067656E65726174696F6E2E2E2EDD +S12336C00D0A00747269616E676C6520776176652067656E65726174696F6E2E2E2E0D0AB9 +S12336E00073717561726520776176652067656E65726174696F6E2E2E2E0D0A007371751C +S1233700617265207761766520313235487A2067656E65726174696F6E2E2E2E0D0A0044EF +S12337206F6E652067656E65726174696E6720776176652E0D0A00436F6D6D616E64733A7B +S12337400D0A67773A2067656E657261746520736177746F6F746820776176652C20707231 +S1233760696E74696E672030207468726F756768203235352C207265706561746564206673 +S12337806F7220746F74616C203230343820706F696E74730D0A6777323A2067656E6572C3 +S12337A061746520736177746F6F74682077617665206F6620313235487A2C2077617665F1 +S12337C020726570656174656420666F7220746F74616C203230343820706F696E74730D18 +S12337E00A67743A2067656E657261746520747269616E676C6520776176652C207072695B +S12338006E74696E672030207468726F756768203235352C207468656E2032353520646FAD +S1233820776E20746F20302C20726570656174656420666F7220746F74616C20323034381D +S123384020706F696E74730D0A67713A2067656E65726174652073717561726520776176F4 +S1233860652C207072696E74696E67203020666F72203235352074696D65732C20746865E6 +S12338806E207072696E742032353520666F72203235352074696D65732C207468656E202D +S12338A0726570656174656420666F7220746F74616C203230343820706F696E74730D0A4D +S12338C06771323A2067656E6572617465207371756172652077617665206F662031323504 +S12338E0487A2C207761766520726570656174656420666F7220746F74616C203230343800 +S123390020706F696E74730D0A743A20536574207468652074696D6520696E20666F726DDA +S123392061742048483A4D4D3A53530D0A683A20446973706C61792074686520686F75725C +S123394073206F6E207468652037207365676D656E7420646973706C6179730D0A6D3A20C1 +S1233960446973706C617920746865206D696E75746573206F6E20746865203720736567D3 +S12339806D656E7420646973706C6179730D0A733A20446973706C617920746865207365D3 +S12339A0636F6E6473206F6E207468652037207365676D656E7420646973706C6179730D8E +S12339C00A713A2053746F702074686520636C6F636B20616E6420656E74657220747970CD +S10D39E0657772697465720D0A00C0 +S105FFEC31B22C +S105FFF0316179 +S9030000FC diff --git a/cmpen472hw11_McDonnell/bin/main.dbg b/cmpen472hw11_McDonnell/bin/main.dbg new file mode 100644 index 0000000..479f8e9 --- /dev/null +++ b/cmpen472hw11_McDonnell/bin/main.dbg @@ -0,0 +1,1072 @@ +************************************************************************** +* +* Title: Signal Generator +* +* Objective: CMPEN 472 Homework 11 +* +* Revision: V1.0 +* +* Date: Apr. 11, 2025 +* +* Programmer: Jacob McDonnell +* +* Company: The Pennsylvania State University +* Department of Computer Science and Engineering +* +* Algorithm: Simple Serial I/O, Real Time Interrupts for Time Tracking, and +* output compare timer for generating functions. +* +* Register Use: A & B to current byte, etc, +* X & Y holds address of strings and length of string, +* D to hold data for printing, reading, and updating time. +* +* Memory Use: RAM Locations from $3000 for data, +* RAM Locations from $3100 for program +* +* Input: Serial Port for User Input +* +* Output: Serial Port for String Output +* +* 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, +* +* Comments: This program is developed and simulated using CodeWarrior +* development software and targeted for Axion +* Manufacturing's CSM-12C128 board running at 24MHz. +* +************************************************************************** +* Parameter Declearation Section +* +* Export Symbols + xdef pgstart ; export 'pgstart' symbol + absentry pgstart ; for assembly entry point + +* Symbols and Macros +PORTA equ $0000 ; i/o port A addresses +DDRA equ $0002 ; data direction register for PORTA +PORTB equ $0001 ; i/o port B addresses +DDRB equ $0003 ; data direction register for PORTB + +SCIBDH equ $00C8 ; Serial port (SCI) Baud Register H +SCIBDL equ $00C9 ; Serial port (SCI) Baud Register L +SCICR2 equ $00CB ; Serial port (SCI) Control Register 2 +SCISR1 equ $00CC ; Serial port (SCI) Status Register 1 +SCIDRL equ $00CF ; Serial port (SCI) Data Register + +CRGFLG EQU $0037 ; Clock and Reset Generator Flags +CRGINT EQU $0038 ; Clock and Reset Generator Interrupts +RTICTL EQU $003B ; Real Time Interrupt Control + +TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select +TIE EQU $004C ; Timer interrupt enable register +TCNTH EQU $0044 ; Timer free runing main counter +TSCR1 EQU $0046 ; Timer system control 1 +TSCR2 EQU $004D ; Timer system control 2 +TFLG1 EQU $004E ; Timer interrupt flag 1 +TC1H EQU $0052 ; Timer channel 1 register + +CR equ $0d ; carriage return, ASCII 'Return' key +LF equ $0a ; line feed, ASCII 'next line' character +NULL equ $00 ; NULL Terminator character + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +buffer ds.b $0010 ; Array of 16 bytes to read a string + dc.b NULL ; NULL terminated +lenBuf dc.w $0010 ; Length of buffer array + +buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal + dc.b NULL ; NULL terminated +lenBuf2 dc.w $0010 ; length of buffer2 + +hours dc.w $0000 ; Buffer to hold the hours of the time + +minutes dc.w $0000 ; Buffer to hold the minutes of the time + +seconds dc.w $0000 ; Buffer to hold the seconds of the time + +counter dc.w $0000 ; Counter for RTI ISR for 1 second + +numBuf dc.b $0000 ; Used by ReadDecimal for reading numbers + +operator dc.b $0000 ; Used by ReadDecimal for reading numbers + +inputBuffer ds.b $0010 ; Input Buffer Length + dc.b NULL + +lenInput dc.w $0010 ; Length of the Input Buffer + +outputBuf dc.b 's' ; Used to control what to output on 7 segment display + +outputVal dc.b $00 ; Used to track the output value of the wave + +outputCnt dc.w $0000 ; Used to track how many values have been outputted + +interval dc.w 3000 ; Used to set the timer module based on clock cycles + +numPoints dc.w 2048 ; Max Number of points for waves + +timeTrigger dc.b $00 ; Tracks when timer is triggered + +increment dc.w 1 ; Used for increment 31.25Hz -> 1 + ; 125Hz -> 4 + +waveType dc.b 'S' ; Used to track wave type 'T' for increasing triangle, + ; 't' for decreasing triangle, + ; 'Q' for square high + ; 'q' for square low + ; 'S' for sawtooth + +* +* There is a section Data Section at the end of the file +************************************************************************** +* RTI Vector Section: address used [ $FFF0 to $FFF1 ] RAM Memory +* + org $FFF0 ; Memory location for RTI interrupt vector section for simulator + dc.w rtiisr ; Real Time Interrupt vector +* +************************************************************************** +* Timer Interrupt Vector Section: address used [ $FFEC to $FFED ] RAM Memory +* + org $FFEC ; Timer channel 1 interrupt vector setup, on simulator + dc.w oc1isr +* +************************************************************************** +* Program Section: address used [ $3100 to $3FFF ] RAM Memory +* + org $3100 ; Program start address, in RAM +pgstart lds #$3100 ; initialize the stack pointer + + ldaa #%11110001 ; LED 1,2,3,4 at PORTB bit 4,5,6,7 + staa DDRB ; set PORTB bit 4,5,6,7 as output + + ldaa #$0C ; Enable SCI port Tx and Rx units + staa SCICR2 ; disable SCI interrupts + + ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation) + std SCIBDH ; SCI port baud rate change + + ldx #msg ; Load the address of the welcome message into X + jsr WriteString ; Write the string to the serial console + + bset RTICTL,%00011001; set RTI: dev=10*(2**10)=2.555msec for C128 board + ; 4MHz quartz oscillator clock + bset CRGINT,%10000000; enable RTI interrupt + bset CRGFLG,%10000000; clear RTI IF (Interrupt Flag) + + ldaa #$FF ; Two 7 segment displays on PORTB + staa DDRB ; Set all of PORTB as output + + cli ; Enable interrupts +mainLoop + ldaa #'>' ; Load '>' character + jsr putchar ; Print to serial console + ldaa #' ' ; Load ' ' character + jsr putchar ; Print to serial console + ldx #inputBuffer ; Load the address of inputBuffer into X + ldy lenInput ; Load the length of inputBuffer into Y + jsr ReadString ; Jump to ReadString to read input + + ldx #inputBuffer ; Load the address of inputBuffer into X + jsr ExecuteCommand ; Jump to ExecuteCommand + + ldx #inputBuffer ; Load the address of inputBuffer into X + ldy lenInput ; Load the length of inputBuffer into Y + jsr Zeros ; Zero out input buffer + + bra mainLoop ; Loop back to mainLoop always + +TypeWrite + sei ; Disable Interrupts + bclr CRGINT,%10000000; Disable RTI interrupt + ldx #twMsg ; Load the address of twMsg into X + jsr WriteString ; Write the string to the serial console +twLoop jsr getchar ; Read a character from the serial console + tsta ; Compare A to 0 + beq twLoop ; If A == 0, branch to twLoop + staa PORTB ; Write A to PORTB + jsr putchar ; Write character to serial console + bra twLoop ; Branch always to twLoop + +************************************************************************** +* 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 + cli ; Enable interrupts + ldx counter ; Load counter into X + inx ; Increment counter by 1 + stx counter ; Save X to counter + cpx #200 ; Compare counter to 200, This is about 1 second on my computer + bne rtiSkip ; If counter != 200, branch to rtiSkip + ldx #0 ; Load 0 into X + stx counter ; Save X to counter + ldx seconds ; Load the seconds into X + inx ; Increment the seconds by 1 + stx seconds ; Save the new seconds to the location + cpx #60 ; Compare X to 60 + bne rtidone ; If X != 60, exit isr + ldx #0 ; Reset the seconds + stx seconds ; Save the new seconds to the location + ldx minutes ; load the minutes into X + inx ; Increment the minutes by 1 + stx minutes ; Save the updated minutes + cpx #60 ; Compare the minutes to 60 + bne rtidone ; If X != 60, exit isr + ldx #0 ; Reset the minutes + stx minutes ; Save the updated minutes + ldx hours ; Load the hours into X + inx ; Increment the hours by 1 + stx hours ; Save the updated hours + cpx #24 ; Compare the hours to 24 + bne rtidone ; If X != 24, exit the isr + ldx #0 ; Reset the hours + stx hours ; Save the updated hours +rtidone jsr PrintTime ; Jump to PrintTime +rtiSkip RTI ; Return from RTI ISR + +;************************************************************************* +; oc1isr subroutine +; +; This subroutine will set a flag after a set number of cycles. +; +; Input: interval memory location for the number of cycles between triggers +; Output: The outputCnt counting the number of triggers, and timeTrigger to +; signal a timmer trigger. +; Registers in use: A for setting timeTrigger, D for increasing outputCnt and setting next count. +; Memory locations in use: Memory Address for oc5 timer, outputCnt, timeTrigger, numPoints, interval +; +; Comments: The timer will stop after outputCnt == numPoints +; + +oc1isr ldd interval ; Load the interval for the next clock cycle + addd TC1H ; for next interrupt + std TC1H ; + bset TFLG1,%00100010 ; Clear CH1 interrupt flag + ldaa #1 ; Load 1 into A + staa timeTrigger ; Signal that timer went off + ldd outputCnt ; Load the count of values outputed into D + addd #1 ; Increase output count by 1 + std outputCnt ; Update the count of outputted values + cpd numPoints ; Compare D to numPoints + blo oc1Done ; If D < numPoints, Done + jsr StopTimerCH1 ; Stop Channel 1 Timer +oc1Done RTI ; Return from interrupt + +;************************************************************************* +; PrintWave subroutine +; +; This subroutine will print a one byte decimal value to the serial console. +; The outputVal will be incremented by increment. It can follow a square wave, +; a triangle wave, & a sawtooth wave pattern. +; +; Input: waveType to denote the patter, increment to increment the outputVal +; Output: outputVal printed to the serial console +; Registers in use: A for finding the wave type, B for reading the outputVal, +; D for math and checking of outputVal +; Memory locations in use: waveType to set the patter, outputVal for printing +; the output value +; +; Comments: The timer will stop after outputCnt == numPoints +; + +PrintWave + pshd ; Save D to the stack + pshy ; Save Y to the stack + ldaa waveType ; Load the waveType into A + cmpa #'T' ; Compare to 'T' + lbeq TriangleInc ; If A == 'T', triangle wave increasing + cmpa #'t' ; Compare A to 't' + lbeq TriangleDec ; If A == 't', triangle wave decreasing + cmpa #'Q' ; Compare A to 'Q' + lbeq SquareWaveH ; If A == 'Q', square wave high + cmpa #'q' ; Compare A to 'q' + lbeq SquareWaveL ; If A == 'q', square wave low +SawToothWav clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + lblo DonePrint ; If D < 256, Done + clrb ; Reset to Zero + lbra DonePrint ; Branch to DonePrint +SquareWaveH clra ; Clear A + ldab #255 ; Load 255 into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + clra ; Clear A + ldab outputVal ; Load the output value into B + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + lblo DonePrint ; If D < 256, done + clrb ; Reset B to zero + ldaa #'q' ; Load 'q' into A + staa waveType ; Update wave type to square wave low + bra DonePrint ; Branch to DonePrint +SquareWaveL clra ; Clear A + clrb ; Reset B to zero + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + clra ; Clear A + ldab outputVal ; Load the output value into B + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + blo DonePrint ; If D < 256, done + clrb ; Reset B to zero + ldaa #'Q' ; Load 'Q' into A + staa waveType ; Update wave type to square wave low + bra DonePrint ; Branch to DonePrint +TriangleInc clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + addd increment ; Add increment to D + cpd #256 ; Compare D to 256 + blo DonePrint ; If D < 256, done + ldaa #'t' ; Load 't' into A + staa waveType ; Update wave type to decreasing triangle + subd #1 ; Subtract 1 from D + bra DonePrint ; Branch to DonePrint +TriangleDec clra ; Clear A + ldab outputVal ; Load the output value into B + ldy #buffer ; Load the address of buffer into Y + jsr PrintDecimalWord; Print the lower byte of the output value; + psha ; Save A to the stack + ldaa #CR ; Load CR into A + jsr putchar ; Write CR to serial console + ldaa #LF ; Load LF into A + jsr putchar ; Write LF to serial console + pula ; Restore A from the stack + subd increment ; Subtract increment from D + cpd #0 ; Compare D to 0 + blt DonePrint ; If D < 0, done + ldaa #'T' ; Load 'T' into A + staa waveType ; Update wave type to increasing triangle + clrb ; Clear B +DonePrint stab outputVal ; Store updated output value + puly ; Restore Y from the stack + puld ; Restore D from the stack + rts ; Return from Caller + +;************************************************************************* +; StartTimer1oc subroutine +; +; This subroutine will enable & start the oc1 timer. +; +; Input: Interval to set the next clock cycle +; Output: No output other +; Registers in use: A used for setting up the oc5 timer, D for setting the next trigger +; Memory locations in use: All memory locations used for the oc5 timer. +; interval to set the next cycle. +; +; Comments: The timer will be enabled only on channel 1 for output compare. +; + +StartTimer1oc + PSHD + LDAA #%00000010 + STAA TIOS ; set CH1 Output Compare + STAA TIE ; set CH1 interrupt Enable + LDAA #%10000000 ; enable timer, Fast Flag Clear not set + STAA TSCR1 + LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1 + STAA TSCR2 ; not needed if started from reset + + LDD interval ; 125usec with (24MHz/1 clock) + ADDD TCNTH ; for first interrupt + STD TC1H ; + + BSET TFLG1,%00000010 ; initial Timer CH5 interrupt flag Clear, not needed if fast clear set + LDAA #%00000010 + STAA TIE ; set CH1 interrupt Enable + PULD + RTS + +;************************************************************************* +; StopTimerCH1 subroutine +; +; This subroutine will stop and disable the timer. +; +; Input: No Input +; Output: No output other +; Registers in use: A to disable the timer. +; Memory locations in use: TIE to disable the timer. +; +; Comments: The timer will be disabled on all channels. +; + +StopTimerCH1 + psha ; Save A to the stack + clra ; Clear A + staa TIE ; Stop Timers + pula ; Restore A from the stack + rts ; Return + +;************************************************************************* +; GenWave subroutine +; +; This subroutine will setup the proper variables to generate a wave and wait +; for the wave to finish generating. +; +; Input: No input but the variables for PrintWave are required. +; Output: No output except for the output of PrintWave +; Registers in use: A for reading the timeTrigger variable, +; D for reading outputCnt. +; Memory locations in use: outputCnt, outputVal, timeTrigger, numPoints. +; +; Comments: This subroutine does not have any direct input or output but calls +; PrintWave so the inputs for PrintWave should be set and the output +; of PrintWave should be expected. +; + +GenWave + pshd ; Save D to the stack + ldd #0 ; Clear D + std outputCnt ; Clear outputCnt + staa outputVal ; Clear outputVal + + jsr StartTimer1oc ; Start Timer on CH1 + +genLoop ldaa timeTrigger ; Load timeTrigger into A + beq genLoop ; If A == 0, loop + clra ; Clear A + staa timeTrigger ; Clear timeTrigger + jsr PrintWave ; Jump to PrintWave + ldd outputCnt ; Load outputCnt into D + cpd numPoints ; Compare D to numPoints + blo genLoop ; If D < numPoints, Loop + + jsr StopTimerCH1 ; Turn off timer + puld ; Restore D from the stack + rts ; Return + +;************************************************************************* +; 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 + ldaa outputBuf ; Load outputBuf into A + cmpa #'h' ; Compare A to 'h' + bne pTimeIsM ; If A != 'h', branch to pTimeIsM + ldd hours ; Load hours into B + bra skipRest ; Jump to skipRest +pTimeIsM cmpa #'m' ; Compare A to 'm' + bne pTimeIsS ; If A != 'm', branch to pTimeIsS + ldd minutes ; Load Minutes into D + bra skipRest ; Jump to skipRest +pTimeIsS ldd seconds ; Load seconds into D +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 + ldx #10 ; Load 10 into X to get digit + idiv ; Divide D by X and save Digit into D + pshb ; Save B to the stack (Lower Byte of D) + exg x,d ; Swap X and D + ldx #10 ; Load 10 into X to get digit + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + lslb ; Shift B left by 1 + orab 1,sp+ ; Or B with Digit on stack + stab PORTB ; Save B to PORTB + pulx ; Restore X from the stack + puld ; Restore D from the stack + rts ; Return from caller + +;************************************************************************* +; ExecuteCommand subroutine +; +; This subroutine will parse user input and execute the proper command or error out. +; +; Input: An address of a NULL terminated string in X. +; Output: The output of the proper command or an error message. +; Registers in use: X for the address of the user input, A for individual characters, +; D & Y for numbers read from user input. +; Memory locations in use: Serial console memory locations. +; +; Comments: This subroutine will disable interrupts while setting the time and will +; reenable them after setting the time. +; + +ExecuteCommand + pshd ; Save D to the stack + pshy ; Save Y to the stack + ldaa 1,x+ ; Load the character from X into A + lbeq ecDone ; If A == 0, jump to ecDone + cmpa #'t' ; Compare A to 't' + bne isH ; If A != 't', branch to isH +skipSpaces ldaa 1,+x ; Load the next character into X + cmpa #' ' ; Compare A to ' ' character + beq skipSpaces ; If A == ' ', loop to skipSpaces + sei ; Disable interrupts + ldd hours ; Load hours into D + pshd ; Save hours to the stack + jsr ReadDecimal ; Read Hour number + exg y,d ; Exchange Y and D + cpd #24 ; Compare D to 24 + lbhs badHours ; If D >= 24, badHours + cpd #0 ; Compare D to 0 + lblt badHours ; If D < 0, badHours + std hours ; Save D to hours + ldaa -1,x ; Load the next character into A + cmpa #':' ; Compare A to ':' + lbne badHours ; If A != ':', badHours + ldd minutes ; Load minutes into D + pshd ; Save minutes to the stack + jsr ReadDecimal ; Read minute number + exg y,d ; Exchange Y and D + cpd #60 ; Compare D to 60 + lbhs badMinutes ; If D >= 60, badMinutes + cpd #0 ; Compare D to 0 + lblt badMinutes ; If D < 0, badMinutes + std minutes ; Save D to minutes + ldaa -1,x ; Load the next character into A + cmpa #':' ; Compare A to ':' + lbne badMinutes ; If A != ':', badMinutes + ldd seconds ; Load seconds into D + pshd ; Save seconds to the stack + jsr ReadDecimal ; Read second number + exg y,d ; Exchange Y and D + cpd #60 ; Compare D to 60 + lbhs badSeconds ; If D >= 60, badSeconds + cpd #0 ; Compare D to 0 + lblt badSeconds ; If D < 0, badSeconds + std seconds ; Save D to seconds + ldaa -1,x ; Load the next character into A + cmpa #NULL ; Compare A to NULL + lbne badSeconds ; If A != ':', badSeconds + clra ; Set A to 0 + staa counter ; Clear Counter + cli ; Enable interrupts + puld ; Restore D from the stack + puld ; Restore D from the stack + puld ; Restore D from the stack + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isH cmpa #'h' ; Compare A to 'h' + bne isM ; If A != 'h', branch to isM + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isM cmpa #'m' ; Compare A to 'm' + bne isS ; If A != 'm', branch to isS + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isS cmpa #'s' ; Compare A to 's' + bne isQ ; If A != 's', branch to isQ + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != CR, bad command + staa outputBuf ; Store A into outputBuf + jsr PrintTime ; Print Time + lbra ecDone ; Branch to ecDone +isQ cmpa #'q' ; Compare A to 'q' + bne isGw ; If A != 'q', branch to isGw + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + lbne badCommand ; If B != NULL, branch to ecDone + jmp TypeWrite ; Jump to TypeWrite +isGw cmpa #'g' ; Compare A to 'g' + lbne badCommand ; If A != 'g', branch to badCommand + ldaa 1,x+ ; Load next character into B + cmpa #'w' ; Compare A to 'w' + bne isGt ; If A != 'w', branch to isGt + ldab 1,x+ ; Load next charater into B + cmpb #NULL ; Compare B to NULL + bne isGw2 ; If B != NULL, branch to isGw2 + ldx #swMsg ; Load address of sawtooth message + jsr WriteString ; Write string + ldaa #'S' ; Load 'S' for sawtooth + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGw2 cmpb #'2' ; Compare B to '2' + lbne badCommand ; If B != '2', bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare to NULL + lbne badCommand ; Not NULL? bad + ldx #sw2Msg ; Load address of sawtooth 125Hz message + jsr WriteString ; Write string + ldaa #'S' ; Load 'S' for sawtooth + staa waveType ; Save A to waveType + ldd #4 ; Load 4 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGt cmpa #'t' ; Compare A to 't' + bne isGq ; If A != 't', branch to isGq + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare to NULL + lbne badCommand ; A != NULL? bad + ldx #tMsg ; Load address of triangle message + jsr WriteString ; Write string + ldaa #'T' ; Load 'T' for triangle + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGq cmpa #'q' ; Compare A to 'q' + lbne badCommand ; A != 'q'? bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + bne isGq2 ; B != NULL? isGq2 + ldx #sqMsg ; Load address of square message + jsr WriteString ; Write string + ldaa #'q' ; Load 'q' for square + staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +isGq2 cmpb #'2' ; Compare B to '2' + lbne badCommand ; B != '2'? bad + ldab 1,x+ ; Load next character into B + cmpb #NULL ; Compare B to NULL + bne badCommand ; B != NULL? bad + ldx #sq2Msg ; Load address of square 125Hz message + jsr WriteString ; Write string + ldaa #'q' ; Load 'q' for square + staa waveType ; Save A to waveType + ldd #8 ; Load 8 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave + ldx #doneWave ; Load the address of doneWave + jsr WriteString ; Write string + lbra ecDone ; Branch always to ecDone +badSeconds puld ; Restore Seconds from the stack + std seconds ; Restore seconds before change +badMinutes puld ; Restore minutes from the stack + std minutes ; Restore minutes before change +badHours puld ; Restore hours from the stack + std hours ; Restore hours before change + cli ; Reenable interrupts +badCommand pshx ; Save X to the stack + ldx #badInput ; Load the address of badInput into X + jsr WriteString ; Jump to WriteString + pulx ; Restore X from the stack +ecDone puly ; Restore Y from the stack + puld ; Restore D from the stack + rts ; Return to caller + +;************************************************************************* +; ReadDecimal subroutine +; +; This subroutine will read an ASCII string of a number in decimal and convert it to +; its value. +; +; Input: A memory address in register X. +; Output: The value of the number in the Y register, and any errors printed +; to the serial line. Zero bit is set if error occurs. +; Registers in use: X for the address of the contents and for a buffer while printing, +; D for multiplication, B for the character, Y for output value. +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine will return the value in the Y register, and if an error occurs, +; the Zero bit in the CCR will be set. +; + +ReadDecimal + pshd ; Save D to the stack + ldy #0 ; Clear Y register +dHLoop ldab 1,x+ ; Read Next character from X + beq dHDone ; If B == 0, exit loop + cmpb #'+' ; Compare B to '+' + beq dHDone ; If B == '+', end of number + cmpb #'-' ; Compare B to '-' + beq dHDone ; If B == '-', end of number + cmpb #'*' ; Compare B to '*' + beq dHDone ; If B == '+', end of number + cmpb #'/' ; Compare B to '/' + beq dHDone ; If B == '-', end of number + cmpb #':' ; Compare B to ':' + beq dHDone ; If B == '-', end of number + cmpb #' ' ; Compare B to space character + beq dHDone ; If B == ' ', exit loop + cmpb #'0' ; Compare B to '0' character + blt dHError ; If B < '0', bad address, exit loop + cmpb #'9' ; Compare B to '9' character + bhi dHError ; If B > '9', check if 'A'-'F' characters + subb #'0' ; Subtract '0' from B to get true value + pshb ; Save B to the stack + ldd #10 ; load 10 into D + emul ; Multiply Y and D + exg d,y ; Transfer data from D to Y + pulb ; Restore b from the stack + aby ; Add B to Y + bra dHLoop ; Branch always to rHLoop +dHDone clra ; clear A accumulator + tap ; Transfer A into CCR to clear zero bit + puld ; Restore D from the stack + rts ; Return to caller +dHError ldaa #4 ; Load 4 into A to set zero bit in CCR + tap ; Transfer A into CCR to set zero bit and warn error + puld ; Restore D from the stack + rts ; Return to caller + +;************************************************************************* +; strrev subroutine +; +; This subroutine will reverse a string from one buffer into another. +; +; Input: Address of null terminated string in X, address of a large enough +; buffer in Y. +; Output: The string in X reversed in Y. +; Registers in use: X for the address of the string, Y for the address of the buffer, +; A to read characters from the string. +; Memory locations in use: Memory Address for serial line, address of the string & buffer +; +; Comments: This subroutine will not check that the output buffer is large enough, that +; is the job of the caller. +; + +strrev + pshx ; Save X to the stack + pshy ; Save Y to the stack + psha ; Save A to the stack +revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y + beq revDone ; If Character is 0, exit loop + staa 1,x+ ; Save character in address in X, increment X + bra revLoop ; Loop back always + clra ; Set A to Zero +revDone staa 1,x+ ; Copy Null terminator into new string + pula ; Restore A from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller + +;************************************************************************* +; PrintDecimalWord subroutine +; +; This subroutine will print a given word of data to the serial in binary. +; +; Input: 1 word of data in register D, Buffer Address in Y +; Output: Decimal representation of the data on the serial console +; Registers in use: Y for the address of the buffer, X to count the number of bits +; written and for division, D for the input, A for characters. +; Memory locations in use: Memory addresses for serial, and operator to hold sign +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +PrintDecimalWord + pshx ; Save X to the stack + pshy ; Save Y to the stack + pshd ; Save D (A:B) to the stack + cpd #0 ; Compare D to zero + beq dIsZero ; Branch to hIsZero + blt dIsNegative ; If D < 0, Jump to dIsNegative +dAfterNeg psha ; Save A to the stack + pshy ; Save Y to the stack + pshx ; Save x to the stack + ldaa #'0' ; Load the '0' character into A + ldx #buffer2 ; Load the address of buffer2 into X + ldy #5 ; Load 5 into Y + jsr memset ; Write '0' to the first 5 bytes in buffer2 + pulx ; Restore X from the stack + puly ; Restore Y from the stack + clra ; Set A to zero + staa 0,y ; Load Zero into Y for Null Terminator + pula ; Restore A from the stack +dPrintLoop ldx #10 ; Load 10 in X for division + idiv ; Divide D / 10 to get Hex Digit + cpx #0 ; Compare X to 0 + beq dCheck ; If X == 0, branch to check D is zero +dDNotZero addb #'0' ; Add '0' to B to get ASCII Character + stab 1,+y ; Save character from B to Y + exg X,D ; Swap values in X and D + bra dPrintLoop ; Loop to hPrintLoop +dCheck cpd #0 ; Compare D to 0 + bne dDNotZero ; If D != 0, branch back to hDNotZero +dPrintDone ldaa operator ; Load operator into A to see if negative + cmpa #'-' ; Compare A to '-' + bne dNotNeg ; If A != '-', jump to dNotNeg + staa 1,+y ; Save '-' into buffer +dNotNeg ldx #buffer2 ; Load the address of buffer2 in X + jsr strrev ; Reverse string in Y in buffer in X + jsr WriteString ; Jump to write string to write the number + ldy lenBuf2 ; Load the length of buffer2 into Y + ldx #buffer2 ; Load the address of buffer2 into X + jsr Zeros ; Fill buffer2 with zeros + puld ; Restore D (A:B) from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller +dIsZero ldaa #'0' ; Load '0' character into A + jsr putchar ; Print character to the screen + puld ; Restore D (A:B) from the stack + puly ; Restore Y from the stack + pulx ; Restore X from the stack + rts ; Return to caller +dIsNegative psha ; Save A to the stack + ldaa #'-' ; Load '-' into A + staa operator ; Save '-' to operator buffer + pula ; Restore A from the stack + nega ; Two's complement of A + suba #1 ; Subtract 1 from A + negb ; Two'complement of B + subb #1 ; Subtract 1 from B + addd #1 ; Add 1 to D + bra dAfterNeg ; Jump back to dAfterNeg + +;************************************************************************* +; Zeros subroutine +; +; This subroutine will write zeros to every byte in a given array. +; +; Input: Address of an array in X and its length in Y +; Output: Zeros in every byte of an array. +; Registers in use: X for the address of the array, Y for the length, and A for 0 +; Memory locations in use: Memory Address of the array +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +Zeros + psha ; Save A to the Stack + clra ; Clear A +zerosLoop staa 1,x+ ; Load A into byte at X + dbne y,zerosLoop ; Decrement Y and loop if Y != 0 + pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; memset subroutine +; +; This subroutine will write a given byte to every byte in a given array. +; +; Input: Address of an array in X and its length in Y, the byte in A +; Output: The given byte in every byte of an array. +; Registers in use: X for the address of the array, Y for the length, and A for the given byte +; Memory locations in use: Memory Address of the array +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +memset + staa 1,x+ ; Load A into byte at X + dbne y,memset ; Decrement Y and loop if Y != 0 + rts ; Return to caller + +;************************************************************************* +; WriteString subroutine +; +; This subroutine will write a given null terminated string to the serial. +; +; Input: Address of null terminated string in X +; Output: Null terminated string written to serial +; Registers in use: X for the address of the string and A for the current byte +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine requires serial to be setup and putchar subroutine. +; + +WriteString + psha ; Save A to the stack +writeLoop ldaa 1,x+ ; Load the byte at addr in X, then add 1 + beq doneWrite ; if A == 0, branch to doneWrite + jsr putchar ; Jump to putchar to write byte to serial + bra writeLoop ; branch always to writeLoop +doneWrite pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; ReadString subroutine +; +; This subroutine will read a string from the serial line to a given address. +; +; Input: Address of an array in X +; Output: Null terminated string in the given array +; Registers in use: X for the address of the string Y for the length of the string, +; and A for the current byte +; Memory locations in use: Memory Address for serial line, address of the string +; +; Comments: This subroutine requires serial to be setup and getchar subroutine. +; + +ReadString + psha ; Save accumulator A to the stack + pshy ; Save Y to the stack + pshx ; Save X to the stack +readLoop jsr getchar ; Jump to putchar to write byte to serial + beq readLoop ; While A == 0, loop + cmpa #CR ; If A == CR, 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 + beq doneRead ; If Y == 0, no more room, stop reading + bra readLoop ; branch always to readLoop +doneRead ldaa #CR ; Load CR into A + jsr putchar ; Print to serial + ldaa #LF ; Load LF into A + jsr putchar ; Print to serial + pulx ; Restore X from the stack + pulY ; Restore Y from the stack + pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; putchar subroutine +; +; This subroutine writes a single byte to a serial line +; +; Input: A single ASCII byte in accumulator A +; Output: Sends one character to SCI port +; Registers in use: Accumulator A with input byte +; Memory locations in use: SCISR1 and SCIDRL status and data registers +; + +putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty + staa SCIDRL ; send a character + rts ; Return to caller + +;************************************************************************* +; putchar subroutine +; +; This subroutine reads one byte from the SCI port +; +; Input: One byte from the SCI port +; Output: One byte in accumulator A +; Registers in use: Accumulator A for output byte +; Memory locations in use: SCISR1 and SCIDRL status and data registers +; + +getchar brclr SCISR1,#%00100000,getchar7 ; If no input on SCI port, return 0 + ldaa SCIDRL ; Read one byte from SCI port into A + rts ; Return to caller +getchar7 clra ; Set A to 0 + rts ; Return to caller + +* +************************************************************************** +* Data Section 2: address used [ $3100 to $3FFF ] RAM Memory +* + +badInput dc.b 'Invalid Input',CR,LF,NULL ; Invalid Input Prompt + +; twMsg: welcome message for typewrite +twMsg dc.b 'Wave Generator and Clock stopped and Typewrite program started.',CR,LF + dc.b 'You may type below.',CR,LF,NULL + +; Messages for different waveforms +swMsg dc.b 'sawtooth wave generation...',CR,LF,NULL +sw2Msg dc.b 'sawtooth wave 125Hz generation...',CR,LF,NULL +tMsg dc.b 'triangle wave generation...',CR,LF,NULL +sqMsg dc.b 'square wave generation...',CR,LF,NULL +sq2Msg dc.b 'square wave 125Hz generation...',CR,LF,NULL + +doneWave dc.b 'Done generating wave.',CR,LF,NULL + +; msg: this is the main option menu string +msg dc.b 'Commands:',CR,LF + dc.b 'gw: generate sawtooth wave, printing 0 through 255, repeated for total 2048 points',CR,LF + dc.b 'gw2: generate sawtooth wave of 125Hz, wave repeated for total 2048 points',CR,LF + dc.b 'gt: generate triangle wave, printing 0 through 255, then 255 down to 0, repeated for total 2048 points',CR,LF + dc.b 'gq: generate square wave, printing 0 for 255 times, then print 255 for 255 times, then repeated for total 2048 points',CR,LF + dc.b 'gq2: generate square wave of 125Hz, wave repeated for total 2048 points',CR,LF + dc.b 't: Set the time in format HH:MM:SS',CR,LF + dc.b 'h: Display the hours on the 7 segment displays',CR,LF + dc.b 'm: Display the minutes on the 7 segment displays',CR,LF + dc.b 's: Display the seconds on the 7 segment displays',CR,LF + dc.b 'q: Stop the clock and enter typewriter',CR,LF,NULL + diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd new file mode 100644 index 0000000..ac4d359 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd @@ -0,0 +1 @@ +// After load the commands written below will be executed diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd new file mode 100644 index 0000000..0bed464 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd @@ -0,0 +1 @@ +// Before load the commands written below will be executed diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd new file mode 100644 index 0000000..bf55944 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd @@ -0,0 +1 @@ +// After reset the commands written below will be executed diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp Binary files differnew file mode 100644 index 0000000..9377caf --- /dev/null +++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg Binary files differnew file mode 100644 index 0000000..80116df --- /dev/null +++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o Binary files differnew file mode 100644 index 0000000..d156a94 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx new file mode 100644 index 0000000..b5eed13 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx @@ -0,0 +1,79 @@ +S0860000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C636D70656E343732687731315F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726D73 +S123300000000000000000000000000000000000000010000000000000000000000000009C +S123302000000000001000000000000000000000000000000000000000000000000000007C +S1123040000010730000000BB8080000000153DB +S105FFF0316179 +S105FFEC31B22C +S1233100CF310086F15A03860C5ACBCC00015CC8CE37371635DA4C3B194C38804C378086A1 +S1233120FF5A0310EF863E16360A862016360ACE3030FD30411635E6CE303016333BCE309D +S123314030FD30411635CB20DC14104D3880CE362A1635DA1636119727FA5A0116360A2059 +S1233160F34C378010EFFE302C087E302C8E00C8263FCE00007E302CFE302A087E302A8EF1 +S1233180003C262ACE00007E302AFE3028087E30288E003C2618CE00007E3028FE302608BD +S12331A07E30268E00182606CE00007E30261633050BFC3047D3525C524C4E2286017A3037 +S12331C04BFC3045C300017C3045BC304925031632D90B3B35B6304E81541827008A8174BA +S12331E0182700AC81511827002B81711827005087F63044CD300016355C36860D16360A6F +S1233200860A16360A32F3304C8C0100182500A4C71820009F87C6FFCD300016355C36866B +S12332200D16360A860A16360A3287F63044F3304C8C01001825007CC786717A304E20741F +S123324087C7CD300016355C36860D16360A860A16360A3287F63044F3304C8C01002554DB +S1233260C786517A304E204C87F63044CD300016355C36860D16360A860A16360A32F33059 +S12332804C8C0100252E86747A304E830001202487F63044CD300016355C36860D16360A90 +S12332A0860A16360A32B3304C8C00002D0686547A304EC77B3044313A3D3B86025A405A1D +S12332C04C86805A4686005A4DFC3047D3445C524C4E0286025A4C3A3D36875A4C323D3B45 +S12332E0CC00007C30457A30441632BAB6304B27FB877A304B1631D3FC3045BC304925EC7D +S12333001632D93A3D3BB6304381682605FC3026200C816D2605FC30282003FC302A1633EC +S1233320233A3D3B34CE000A181037B7D4CE000A58585858EAB05B01303A3D3B35A630188B +S12333402701C38174267EA620812027FA1410FC30263B163509B7E48C0018182401998CB7 +S12333600000182D01927C3026A61F813A18260187FC30283B163509B7E48C003C182401D6 +S1233380738C0000182D016C7C3028A61F813A18260161FC302A3B163509B7E48C003C1824 +S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396 +S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B +S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9 +S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA +S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656 +S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A +S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636 +S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667 +S12334A0005CE630C100261ECE36E11635DA86717A304ECC00017C304C1632DFCE371F1672 +S12334C035DA18200040C13218260032E630C100262CCE36FD1635DA86717A304ECC0008EC +S12334E07C304C1632DFCE371F1635DA182000163A7C302A3A7C30283A7C302610EF34CEE7 +S1233500361A1635DA30313A3D3BCD0000E630272EC12B272AC12D2726C12A2722C12F2724 +S12335201EC13A271AC1202716C1302D17C1392213C03037CC000A13B7C63319ED20CE8770 +S1233540B7023A3D8604B7023A3D343536A67F27056A3020F8876A303231303D34353B8CBA +S12335600000274C2D533635348630CE3013CD00051635D43031876A4032CE000A18108EAB +S123358000002708CB306B60B7D420EE8C000026F3B6302F812D26026A60CE301316354A99 +S12335A01635DAFD3024CE30131635CB3A31303D863016360A3A31303D36862D7A302F32BA +S12335C040800150C001C30001209B36876A300436FB323D6A300436FB3D36A63027051641 +S12335E0360A20F7323D36353416361127FB810D270A6A3016360A03270220ED860D16361C +S12336000A860A16360A3031323D4FCC80FC5ACF3D4FCC200396CF3D873D496E76616C69E2 +S12336206420496E7075740D0A00576176652047656E657261746F7220616E6420436C6FF0 +S1233640636B2073746F7070656420616E64205479706577726974652070726F6772616D21 +S123366020737461727465642E0D0A596F75206D617920747970652062656C6F772E0D0AE6 +S123368000736177746F6F746820776176652067656E65726174696F6E2E2E2E0D0A00737A +S12336A06177746F6F7468207761766520313235487A2067656E65726174696F6E2E2E2EDD +S12336C00D0A00747269616E676C6520776176652067656E65726174696F6E2E2E2E0D0AB9 +S12336E00073717561726520776176652067656E65726174696F6E2E2E2E0D0A007371751C +S1233700617265207761766520313235487A2067656E65726174696F6E2E2E2E0D0A0044EF +S12337206F6E652067656E65726174696E6720776176652E0D0A00436F6D6D616E64733A7B +S12337400D0A67773A2067656E657261746520736177746F6F746820776176652C20707231 +S1233760696E74696E672030207468726F756768203235352C207265706561746564206673 +S12337806F7220746F74616C203230343820706F696E74730D0A6777323A2067656E6572C3 +S12337A061746520736177746F6F74682077617665206F6620313235487A2C2077617665F1 +S12337C020726570656174656420666F7220746F74616C203230343820706F696E74730D18 +S12337E00A67743A2067656E657261746520747269616E676C6520776176652C207072695B +S12338006E74696E672030207468726F756768203235352C207468656E2032353520646FAD +S1233820776E20746F20302C20726570656174656420666F7220746F74616C20323034381D +S123384020706F696E74730D0A67713A2067656E65726174652073717561726520776176F4 +S1233860652C207072696E74696E67203020666F72203235352074696D65732C20746865E6 +S12338806E207072696E742032353520666F72203235352074696D65732C207468656E202D +S12338A0726570656174656420666F7220746F74616C203230343820706F696E74730D0A4D +S12338C06771323A2067656E6572617465207371756172652077617665206F662031323504 +S12338E0487A2C207761766520726570656174656420666F7220746F74616C203230343800 +S123390020706F696E74730D0A743A20536574207468652074696D6520696E20666F726DDA +S123392061742048483A4D4D3A53530D0A683A20446973706C61792074686520686F75725C +S123394073206F6E207468652037207365676D656E7420646973706C6179730D0A6D3A20C1 +S1233960446973706C617920746865206D696E75746573206F6E20746865203720736567D3 +S12339806D656E7420646973706C6179730D0A733A20446973706C617920746865207365D3 +S12339A0636F6E6473206F6E207468652037207365676D656E7420646973706C6179730D8E +S12339C00A713A2053746F702074686520636C6F636B20616E6420656E74657220747970CD +S10D39E0657772697465720D0A00C0 +S9033100CB diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt Binary files differnew file mode 100644 index 0000000..13a37e9 --- /dev/null +++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt diff --git a/cmpen472hw11_McDonnell/prm/burner.bbl b/cmpen472hw11_McDonnell/prm/burner.bbl new file mode 100644 index 0000000..0c57619 --- /dev/null +++ b/cmpen472hw11_McDonnell/prm/burner.bbl @@ -0,0 +1,157 @@ +/* logical s-record file */ +OPENFILE "%ABS_FILE%.s19" +format=motorola +busWidth=1 +origin=0 +len=0x1000000 +destination=0 +SRECORD=Sx +SENDBYTE 1 "%ABS_FILE%" +CLOSE + + +/* physical s-record file */ +OPENFILE "%ABS_FILE%.phy" +format = motorola +busWidth = 1 +len = 0x4000 + +/* logical non banked flash at $4000 and $C000 to physical */ +origin = 0x004000 +destination = 0x0F8000 +SENDBYTE 1 "%ABS_FILE%" + +origin = 0x00C000 +destination = 0x0FC000 +SENDBYTE 1 "%ABS_FILE%" + +/* physical FTS512K flash window to physical +origin = 0x008000 +destination = 0x080000 +SENDBYTE 1 "%ABS_FILE%" +*/ + +/* physical FTS256K parts flash window to physical +origin = 0x008000 +destination = 0x0C0000 +SENDBYTE 1 "%ABS_FILE%" +*/ + +/* physical FTS128K parts flash window to physical +origin = 0x008000 +destination = 0x0E0000 +SENDBYTE 1 "%ABS_FILE%" +*/ + +/* physical FTS64K parts flash window to physical +origin = 0x008000 +destination = 0x0F0000 +SENDBYTE 1 "%ABS_FILE%" +*/ + +/* physical FTS32K parts flash window to physical +origin = 0x008000 +destination = 0x0F8000 +SENDBYTE 1 "%ABS_FILE%" +*/ + +/* logical 512 kB banked flash to physical */ +origin = 0x208000 +destination = 0x080000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x218000 +destination = 0x084000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x228000 +destination = 0x088000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x238000 +destination = 0x08C000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x248000 +destination = 0x090000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x258000 +destination = 0x094000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x268000 +destination = 0x098000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x278000 +destination = 0x09C000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x288000 +destination = 0x0A0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x298000 +destination = 0x0A4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2A8000 +destination = 0x0A8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2B8000 +destination = 0x0AC000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2C8000 +destination = 0x0B0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2D8000 +destination = 0x0B4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2E8000 +destination = 0x0B8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x2F8000 +destination = 0x0BC000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x308000 +destination = 0x0C0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x318000 +destination = 0x0C4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x328000 +destination = 0x0C8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x338000 +destination = 0x0CC000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x348000 +destination = 0x0D0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x358000 +destination = 0x0D4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x368000 +destination = 0x0D8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x378000 +destination = 0x0DC000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x388000 +destination = 0x0E0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x398000 +destination = 0x0E4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3A8000 +destination = 0x0E8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3B8000 +destination = 0x0EC000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3C8000 +destination = 0x0F0000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3D8000 +destination = 0x0F4000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3E8000 +destination = 0x0F8000 +SENDBYTE 1 "%ABS_FILE%" +origin = 0x3F8000 +destination = 0x0FC000 +SENDBYTE 1 "%ABS_FILE%" + +CLOSE + |
