summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdtbin63719 -> 63719 bytes
-rw-r--r--cmpen472hw12_McDonnell/ASM_layout.hwl27
-rw-r--r--cmpen472hw12_McDonnell/Default.membin0 -> 285 bytes
-rw-r--r--cmpen472hw12_McDonnell/Full_Chip_Simulation.hwc1
-rw-r--r--cmpen472hw12_McDonnell/Full_Chip_Simulation.ini39
-rw-r--r--cmpen472hw12_McDonnell/Sources/cmpen472hw6_McDonnell.asm730
-rw-r--r--cmpen472hw12_McDonnell/Sources/derivative.inc10
-rw-r--r--cmpen472hw12_McDonnell/Sources/main.asm823
-rw-r--r--cmpen472hw12_McDonnell/bin/Project.absbin0 -> 7998 bytes
-rw-r--r--cmpen472hw12_McDonnell/bin/Project.abs.phy2
-rw-r--r--cmpen472hw12_McDonnell/bin/Project.abs.s1944
-rw-r--r--cmpen472hw12_McDonnell/bin/main.dbg822
-rw-r--r--cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd1
-rw-r--r--cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd1
-rw-r--r--cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd1
-rw-r--r--cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd1
-rw-r--r--cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd1
-rw-r--r--cmpen472hw12_McDonnell/cmpen472hw12_McDonnell.mcpbin0 -> 57065 bytes
-rw-r--r--cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/CWSettingsWindows.stgbin0 -> 4263 bytes
-rw-r--r--cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.obin0 -> 7998 bytes
-rw-r--r--cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx44
-rw-r--r--cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdtbin0 -> 65120 bytes
-rw-r--r--cmpen472hw12_McDonnell/prm/burner.bbl157
23 files changed, 2704 insertions, 0 deletions
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt
index 24070a6..b778804 100644
--- a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ
diff --git a/cmpen472hw12_McDonnell/ASM_layout.hwl b/cmpen472hw12_McDonnell/ASM_layout.hwl
new file mode 100644
index 0000000..fced6df
--- /dev/null
+++ b/cmpen472hw12_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 61 47 33 48
+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 80 14 10 30
+VisualizationTool< Attributes [stEditM="0",swRefresh="3",refCycles="1"]
+VisualizationTool< LoadInstrument Seg7[BoundX="54",BoundY="24",Port="0x1",Port_PortEndian="1",swDM="2"]
+VisualizationTool< LoadInstrument Seg7[BoundX="95",BoundY="25",Port="0x1",swDM="1"]
+VisualizationTool< LoadInstrument DILSwitch[BoundX="55",BoundY="117",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/cmpen472hw12_McDonnell/Default.mem b/cmpen472hw12_McDonnell/Default.mem
new file mode 100644
index 0000000..bf49148
--- /dev/null
+++ b/cmpen472hw12_McDonnell/Default.mem
Binary files differ
diff --git a/cmpen472hw12_McDonnell/Full_Chip_Simulation.hwc b/cmpen472hw12_McDonnell/Full_Chip_Simulation.hwc
new file mode 100644
index 0000000..f3ce7c9
--- /dev/null
+++ b/cmpen472hw12_McDonnell/Full_Chip_Simulation.hwc
@@ -0,0 +1 @@
+LOADMEM default.mem
diff --git a/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini
new file mode 100644
index 0000000..b71f542
--- /dev/null
+++ b/cmpen472hw12_McDonnell/Full_Chip_Simulation.ini
@@ -0,0 +1,39 @@
+[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,53,19,1873,1042
+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
diff --git a/cmpen472hw12_McDonnell/Sources/cmpen472hw6_McDonnell.asm b/cmpen472hw12_McDonnell/Sources/cmpen472hw6_McDonnell.asm
new file mode 100644
index 0000000..5287ff0
--- /dev/null
+++ b/cmpen472hw12_McDonnell/Sources/cmpen472hw6_McDonnell.asm
@@ -0,0 +1,730 @@
+**************************************************************************
+*
+* Title: Memory Monitor
+*
+* Objective: CMPEN 472 Homework 6
+*
+* Revision: V1.0
+*
+* Date: Feb. 28, 2025
+*
+* Programmer: Jacob McDonnell
+*
+* Company: The Pennsylvania State University
+* Department of Computer Science and Engineering
+*
+* Algorithm: Simple Serial I/O, address poking and modifying
+*
+* Register Use: A & B to current byte, etc,
+* X & Y holds address of strings and length of string,
+* D to hold data and address of the memory location to work on.
+*
+* 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
+* Memory locations changed if modified by user
+*
+* Observation: This program will prompt the user to print the contents of a
+* memory location and to modify the location with hexadecimal or
+* decimal data. If the user wishes, they can type 'QUIT' to exit
+* the memory monitor and enter the type writer program.
+*
+* 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
+
+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
+TESTER dc.w $0005 ; Memory location to test showing data
+ ; and writing data.
+
+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
+
+*
+* There is a section Data Section at the end of the file
+**************************************************************************
+* 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
+
+mainLoop
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with zeros
+
+ ldaa #'>' ; Load '>' into A
+ jsr putchar ; Jump to putchar to write to console
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Jump to putchar to write to console
+
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr ReadString ; Read a line from the serial console
+
+ ldx #buffer ; Load the address of the buffer into X
+ jsr CheckInput ; Jump to CheckInput to parse the user input
+ bra mainLoop ; Loop back to mainLoop always
+TypeWriter ldx #twMsg ; Load Type Writer welcome message address
+ jsr WriteString ; Jump to WriteString to write message to serial
+twReadLoop jsr getchar ; Read Character from Serial
+ beq twReadLoop ; While Character == 0, branch to twReadLoop
+ jsr putchar ; Write Character back to terminal
+ staa PORTB ; Write Character to PORTB
+ bra twReadLoop ; Branch always to twReadLoop
+
+**************************************************************************
+* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+;*************************************************************************
+; CheckInput subroutine
+;
+; This subroutine will check the input string and match the option.
+;
+; Input: Address of null terminated string in X.
+; Output: No Output, Control flow changed to proper subroutine.
+; Registers in use: X for the address of the string, A & B to read characters from
+; from the string.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine will not return a value, it will jump to the proper subroutine
+; based on the input given. If "QUIT" is the command, this subroutine will jump
+; to TypeWriter which will not return and needs to be restarted to exit.
+;
+
+CheckInput
+ pshx ; Save X to the stack
+ pshd ; Save D to the stack
+ ldaa 1,x+ ; Read Character from the string in X
+ cmpa #'W' ; Compare Character to 'W'
+ beq cWrite ; If A == 'W', branch to cWrite
+ cmpa #'Q' ; Compare A to 'Q'
+ beq cTypeWrite ; If A == 'Q', branch to cTypeWrite
+ cmpa #'S' ; Compare A to 'S'
+ bne cUnknownCMD ; If A != 'S', Command unknown
+ ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,X ; Exchange Y for X
+ pshx ; Save X to the stack
+ ldx #buffer ; Load address of buffer into X
+ ldy lenBuf ; Loadd length of the buffer into Y
+ jsr Zeros ; Fill buffer with Zeros
+ pulx ; Restore X from the stack
+ bra cDone ; branch always to cDone
+cWrite ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,D ; Exchange Y and D
+ pshd ; Save D to the stack
+skipSpaces ldaa 1,x+ ; Load next character into A
+ beq cBadData ; If A == 0, branch to bad Data (no data given)
+ cmpa #' ' ; Compare A to space character
+ beq skipSpaces ; While A == ' ', loop to skip spaces
+ cmpa #'$' ; Compare A to '$'
+ beq cHexData ; If A == '$', branch to cHexData
+ dex ; Decrement X by 1
+ jsr ReadDecimal ; Jump to ReadDecimal
+ beq cBadData ; If Z == 1, branch to cBadData
+ bra cWriteData ; Branch always to cWriteData
+cHexData dex ; Decrement X by 1
+ jsr ReadHex ; Jump to ReadHex to read hex data
+ beq cBadData ; If Z == 1, branch to cBadData
+cWriteData puld ; Restore D from the stack
+ exg D,X ; Exchange D and X
+ sty x ; Write data in Y to memory in X
+cDone jsr PrintMem ; Jump to PrintMem to print the contents of the location
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadAddr ldx #badAddr ; Load the address of badAddr into X
+ jsr WriteString ; Write badAddr to serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadData ldx #badData ; Load the address of badData into X
+ jsr WriteString ; Write badData to serial console
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cUnknownCMD ldx #badCom ; Load the address of badCom into X
+ jsr WriteString ; Write badCom to the serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cTypeWrite ldaa 1,x+ ; Load next character from X
+ cmpa #'U' ; Compare A to 'U'
+ bne cUnknownCMD ; If A != 'U', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'I' ; Compare A to 'I'
+ bne cUnknownCMD ; If A != 'I', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'T' ; Compare A to 'T'
+ bne cUnknownCMD ; If A != 'T', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ bne cUnknownCMD ; If A != 0, branch to unknown command
+ jmp TypeWriter ; Jump to TypeWriter
+
+;*************************************************************************
+; ReadHex subroutine
+;
+; This subroutine will read an ASCII string of a number in hex and convert it to
+; its value.
+;
+; Input: A memory address in register X.
+; Output: The value of the hex 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.
+;
+
+ReadHex
+ pshd ; Save D to the stack
+ ldy #0 ; Clear Y register
+ ldab 1,x+ ; Read character from X into B, add 1 to X
+ cmpb #'$' ; Compare B to '$'
+ bne rHError ; If B != '$', jump to error, not hex data
+rHLoop ldab 1,x+ ; Read Next character from X
+ beq rHDone ; If B == 0, exit loop
+ cmpb #' ' ; Compare B to space character
+ beq rHDone ; If B == ' ', exit loop
+ cmpb #'0' ; Compare B to '0' character
+ blt rHError ; If B < '0', bad address, exit loop
+ cmpb #'9' ; Compare B to '9' character
+ bhi rHAlpha ; 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 #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHAlpha cmpb #'A' ; Compare B to 'A' character
+ blt rHError ; If B < 'A', bad address, exit loop
+ cmpb #'F' ; Compare B to 'F' character
+ bhi rHError ; If B > 'F', invalid data, error out
+ subb #'A' ; Subtract 'A' from B to get true value
+ addb #$A ; Add $A to B to account for offet
+ pshb ; Save B to the stack
+ ldd #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHDone clra ; clear A accumulator
+ tap ; Transfer A into CCR to clear zero bit
+ puld ; Restore D from the stack
+ rts ; Return to caller
+rHError 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
+
+;*************************************************************************
+; 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 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
+
+;*************************************************************************
+; PrintMem subroutine
+;
+; This subroutine will print the address and contents of the given memory location.
+;
+; Input: A memory address in register X.
+; Output: The memory address in Hex and the contents in binary, hex, & decimal
+; on the serial output.
+; Registers in use: X for the address of the contents and for a buffer while printing,
+; D for the contents of the location, Y for another buffer address while
+; reversing strings and printing.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires the serial console to be setup before calling.
+;
+
+PrintMem
+ pshy ; Save Y to the Stack
+ pshd ; Save D to the Stack
+ exg x,d ; Copy Address from X to D to print
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintHexWord ; Print the Address in Hex
+ exg d,x ; Copy Address from D to X
+ ldaa #'=' ; Load the '=' character into A
+ jsr putchar ; Print the character to the serial
+ ldaa #'>' ; Load the '>' character into A
+ jsr putchar ; Print the character to the serial
+ ldd x ; Load data from address in X into D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ jsr PrintBinaryWord ; Print the binary word to the serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Prin the hex representation of the word to serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintDecimalWord; Prin the decimal representation of the word to serial
+ ldaa #CR ; Load the carriage return character into A
+ jsr putchar ; Print the character to serial
+ ldaa #LF ; Load the line feed character into A
+ jsr putchar ; Print the character to serial
+ puld ; Restore D from the stack
+ puly ; Restore Y 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
+
+;*************************************************************************
+; PrintBinaryWord subroutine
+;
+; This subroutine will print a given word of data to the serial in binary.
+;
+; Input: 1 word of data in register D
+; Output: Binary representation of the data on the serial console
+; Registers in use: X to count the number of bits written, D for the input, A for characters,
+; B for the byte being written.
+; Memory locations in use: Memory addresses for serial.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintBinaryWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshb ; Save B to the stack (we want these bits again later)
+ tab ; Transfer A to B to get upper byte
+ ldaa #'%' ; Load '%' into A
+ jsr putchar ; Print '%' to serial to denote binary number
+ ldx #16 ; Load 16 into X, since we're printing 16 bits
+bPrintLoop rolb ; Rotate MSB of B into C of CCR
+ tpa ; Copy CCR into A
+ anda #1 ; and A with 1 to get only LSB
+ adda #'0' ; Add '0' to A to get ASCII Character
+ jsr putchar ; Print Character A to serial
+ dbeq X,bPrintDone ; Decrement X and if X == 0, branch to done
+ cpx #8 ; Compare X to 8 to check if done with upper byte
+ bne bPrintLoop ; If X != 8, loop to bPrintLoop
+ pulb ; Restore B from stack to get lower byte
+ bra bPrintLoop ; Branch back into loop to print lower byte
+bPrintDone puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; PrintHexWord 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: Hexadecimal 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintHexWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq hIsZero ; Branch to hIsZero
+ 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
+hPrintLoop ldx #16 ; Load 16 in X for division
+ idiv ; Divide D / 16 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq hCheck ; If X == 0, branch to check D is zero
+hDNotZero cmpb #$0A ; Compare A to $0A
+ blt hex10 ; If B < $A, branch to hex10
+ addb #'A' ; Add 'A' to B to get ASCII Character
+ subb #$0A ; Subtract $A to adjust characters
+ stab 1,+y ; Save character from B to Y
+ exg X,D ; Swap values in X and D
+ bra hPrintLoop ; loop to hPrintLoop
+hex10 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 hPrintLoop ; Loop to hPrintLoop
+hCheck cpd #0 ; Compare D to 0
+ bne hDNotZero ; If D != 0, branch back to hDNotZero
+hPrintDone ldaa #'$' ; Load '$' into
+ staa 1,+y ; Save '$' into buffer in Y to denote Hex
+ 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+hIsZero ldaa #'$' ; Load '$' character into A
+ jsr putchar ; Print character to the screen
+ ldaa #'0' ; Load '0' character into A
+ jsr putchar ; Print character to the screen
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintDecimalWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq dIsZero ; Branch to hIsZero
+ 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 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; 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 #LF ; Load Line Feed into A
+ jsr putchar ; Write LF to terminal
+ 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
+*
+
+badAddr dc.b 'invalid input, address',CR,LF,NULL ; Error message for bad address
+
+badData dc.b 'invalid input, data',CR,LF,NULL ; Error message for bad data
+
+badCom dc.b 'invalid input, command',CR,LF,NULL ; Error message for bad command
+
+; twMsg: welcome message when type writer loads
+twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF
+ dc.b 'Restart to enter main menu again.',CR,LF,NULL
+
+
+; msg: this is the main option menu string
+msg dc.b 'S: Show the contents of memory location in word',CR,LF
+ dc.b 'W: Write the data word (not byte) to memory location',CR,LF
+ dc.b 'QUIT: Quit the main program, run Type writer program.',CR,LF,NULL
+
+ end ; last line of the file
diff --git a/cmpen472hw12_McDonnell/Sources/derivative.inc b/cmpen472hw12_McDonnell/Sources/derivative.inc
new file mode 100644
index 0000000..988343b
--- /dev/null
+++ b/cmpen472hw12_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/cmpen472hw12_McDonnell/Sources/main.asm b/cmpen472hw12_McDonnell/Sources/main.asm
new file mode 100644
index 0000000..3abe95a
--- /dev/null
+++ b/cmpen472hw12_McDonnell/Sources/main.asm
@@ -0,0 +1,823 @@
+**************************************************************************
+*
+* Title: Memory Monitor
+*
+* Objective: CMPEN 472 Homework 6
+*
+* Revision: V1.0
+*
+* Date: Feb. 28, 2025
+*
+* Programmer: Jacob McDonnell
+*
+* Company: The Pennsylvania State University
+* Department of Computer Science and Engineering
+*
+* Algorithm: Simple Serial I/O, address poking and modifying
+*
+* Register Use: A & B to current byte, etc,
+* X & Y holds address of strings and length of string,
+* D to hold data and address of the memory location to work on.
+*
+* 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
+* Memory locations changed if modified by user
+*
+* Observation: This program will prompt the user to print the contents of a
+* memory location and to modify the location with hexadecimal or
+* decimal data. If the user wishes, they can type 'QUIT' to exit
+* the memory monitor and enter the type writer program.
+*
+* 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
+
+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
+TESTER dc.w $0005 ; Memory location to test showing data
+ ; and writing data.
+
+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
+
+*
+* There is a section Data Section at the end of the file
+**************************************************************************
+* Program Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+ org $3100 ; Program start address, in RAM
+pgstart lds #$3100 ; initialize the stack pointer
+
+ ldaa #%11111111 ; Seven Segment display on PORTB
+ staa DDRB
+
+ 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
+
+mainLoop
+ ldx #$3000
+ ldy #$0100
+ jsr MDCommand
+
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with zeros
+
+ ldaa #'>' ; Load '>' into A
+ jsr putchar ; Jump to putchar to write to console
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Jump to putchar to write to console
+
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr ReadString ; Read a line from the serial console
+
+ ldx #buffer ; Load the address of the buffer into X
+ jsr CheckInput ; Jump to CheckInput to parse the user input
+ bra mainLoop ; Loop back to mainLoop always
+TypeWriter ldx #twMsg ; Load Type Writer welcome message address
+ jsr WriteString ; Jump to WriteString to write message to serial
+twReadLoop jsr getchar ; Read Character from Serial
+ beq twReadLoop ; While Character == 0, branch to twReadLoop
+ jsr putchar ; Write Character back to terminal
+ staa PORTB ; Write Character to PORTB
+ bra twReadLoop ; Branch always to twReadLoop
+
+**************************************************************************
+* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+;*************************************************************************
+; CheckInput subroutine
+;
+; This subroutine will check the input string and match the option.
+;
+; Input: Address of null terminated string in X.
+; Output: No Output, Control flow changed to proper subroutine.
+; Registers in use: X for the address of the string, A & B to read characters from
+; from the string.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine will not return a value, it will jump to the proper subroutine
+; based on the input given. If "QUIT" is the command, this subroutine will jump
+; to TypeWriter which will not return and needs to be restarted to exit.
+;
+
+CheckInput
+ pshx ; Save X to the stack
+ pshd ; Save D to the stack
+ ldaa 1,x+ ; Read Character from the string in X
+ cmpa #'W' ; Compare Character to 'W'
+ beq cWrite ; If A == 'W', branch to cWrite
+ cmpa #'Q' ; Compare A to 'Q'
+ beq cTypeWrite ; If A == 'Q', branch to cTypeWrite
+ cmpa #'S' ; Compare A to 'S'
+ bne cUnknownCMD ; If A != 'S', Command unknown
+ ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,X ; Exchange Y for X
+ pshx ; Save X to the stack
+ ldx #buffer ; Load address of buffer into X
+ ldy lenBuf ; Loadd length of the buffer into Y
+ jsr Zeros ; Fill buffer with Zeros
+ pulx ; Restore X from the stack
+ bra cDone ; branch always to cDone
+cWrite ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,D ; Exchange Y and D
+ pshd ; Save D to the stack
+skipSpaces ldaa 1,x+ ; Load next character into A
+ beq cBadData ; If A == 0, branch to bad Data (no data given)
+ cmpa #' ' ; Compare A to space character
+ beq skipSpaces ; While A == ' ', loop to skip spaces
+ cmpa #'$' ; Compare A to '$'
+ beq cHexData ; If A == '$', branch to cHexData
+ dex ; Decrement X by 1
+ jsr ReadDecimal ; Jump to ReadDecimal
+ beq cBadData ; If Z == 1, branch to cBadData
+ bra cWriteData ; Branch always to cWriteData
+cHexData dex ; Decrement X by 1
+ jsr ReadHex ; Jump to ReadHex to read hex data
+ beq cBadData ; If Z == 1, branch to cBadData
+cWriteData puld ; Restore D from the stack
+ exg D,X ; Exchange D and X
+ sty x ; Write data in Y to memory in X
+cDone jsr PrintMem ; Jump to PrintMem to print the contents of the location
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadAddr ldx #badAddr ; Load the address of badAddr into X
+ jsr WriteString ; Write badAddr to serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadData ldx #badData ; Load the address of badData into X
+ jsr WriteString ; Write badData to serial console
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cUnknownCMD ldx #badCom ; Load the address of badCom into X
+ jsr WriteString ; Write badCom to the serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cTypeWrite ldaa 1,x+ ; Load next character from X
+ cmpa #'U' ; Compare A to 'U'
+ bne cUnknownCMD ; If A != 'U', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'I' ; Compare A to 'I'
+ bne cUnknownCMD ; If A != 'I', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'T' ; Compare A to 'T'
+ bne cUnknownCMD ; If A != 'T', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ bne cUnknownCMD ; If A != 0, branch to unknown command
+ jmp TypeWriter ; Jump to TypeWriter
+
+;*************************************************************************
+; ReadHex subroutine
+;
+; This subroutine will read an ASCII string of a number in hex and convert it to
+; its value.
+;
+; Input: A memory address in register X.
+; Output: The value of the hex 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.
+;
+
+ReadHex
+ pshd ; Save D to the stack
+ ldy #0 ; Clear Y register
+ ldab 1,x+ ; Read character from X into B, add 1 to X
+ cmpb #'$' ; Compare B to '$'
+ bne rHError ; If B != '$', jump to error, not hex data
+rHLoop ldab 1,x+ ; Read Next character from X
+ beq rHDone ; If B == 0, exit loop
+ cmpb #' ' ; Compare B to space character
+ beq rHDone ; If B == ' ', exit loop
+ cmpb #'0' ; Compare B to '0' character
+ blt rHError ; If B < '0', bad address, exit loop
+ cmpb #'9' ; Compare B to '9' character
+ bhi rHAlpha ; 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 #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHAlpha cmpb #'A' ; Compare B to 'A' character
+ blt rHError ; If B < 'A', bad address, exit loop
+ cmpb #'F' ; Compare B to 'F' character
+ bhi rHError ; If B > 'F', invalid data, error out
+ subb #'A' ; Subtract 'A' from B to get true value
+ addb #$A ; Add $A to B to account for offet
+ pshb ; Save B to the stack
+ ldd #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHDone clra ; clear A accumulator
+ tap ; Transfer A into CCR to clear zero bit
+ puld ; Restore D from the stack
+ rts ; Return to caller
+rHError 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
+
+MDCommand
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ pshd ; Save D to the stack
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ tfr x,d ; Copy X to D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Print the data
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Print space to console
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ ldd #0 ; Clear D
+MDLoop cpy #0 ; Compare Y to 0
+ beq MDDone ; If Y == 0, done
+ dey ; Decrement Y by 1
+ dey ; Decrement Y by 1
+ ldab 1,x+ ; Load data from X into B
+ jsr PrintHexByte ; Print the data
+ ldab 1,x+ ; Load data from X into B
+ jsr PrintHexByte ; Print the data
+ tfr y,a ; Transfer lower byte Y to A
+ anda #15 ; And A with 15, basically modulus 16
+ bne MDLoop ; If A & 15 != 0, no newline
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Print CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print LF to serial console
+ cpy #0 ; Compare Y to 0
+ beq MDDone ; If Y == 0, done
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ tfr x,d ; Copy X to D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Print the data
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Print space to console
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ bra MDLoop ; Loop
+MDDone ldaa #CR ; Load CR into A
+ jsr putchar ; Print CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print LF to serial console
+ puld ; Restore D from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return
+
+;*************************************************************************
+; 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 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
+
+;*************************************************************************
+; PrintMem subroutine
+;
+; This subroutine will print the address and contents of the given memory location.
+;
+; Input: A memory address in register X.
+; Output: The memory address in Hex and the contents in binary, hex, & decimal
+; on the serial output.
+; Registers in use: X for the address of the contents and for a buffer while printing,
+; D for the contents of the location, Y for another buffer address while
+; reversing strings and printing.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires the serial console to be setup before calling.
+;
+
+PrintMem
+ pshy ; Save Y to the Stack
+ pshd ; Save D to the Stack
+ exg x,d ; Copy Address from X to D to print
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintHexWord ; Print the Address in Hex
+ exg d,x ; Copy Address from D to X
+ ldaa #'=' ; Load the '=' character into A
+ jsr putchar ; Print the character to the serial
+ ldaa #'>' ; Load the '>' character into A
+ jsr putchar ; Print the character to the serial
+ ldd x ; Load data from address in X into D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ jsr PrintBinaryWord ; Print the binary word to the serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Prin the hex representation of the word to serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintDecimalWord; Prin the decimal representation of the word to serial
+ ldaa #CR ; Load the carriage return character into A
+ jsr putchar ; Print the character to serial
+ ldaa #LF ; Load the line feed character into A
+ jsr putchar ; Print the character to serial
+ puld ; Restore D from the stack
+ puly ; Restore Y 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
+
+;*************************************************************************
+; PrintBinaryWord subroutine
+;
+; This subroutine will print a given word of data to the serial in binary.
+;
+; Input: 1 word of data in register D
+; Output: Binary representation of the data on the serial console
+; Registers in use: X to count the number of bits written, D for the input, A for characters,
+; B for the byte being written.
+; Memory locations in use: Memory addresses for serial.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintBinaryWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshb ; Save B to the stack (we want these bits again later)
+ tab ; Transfer A to B to get upper byte
+ ldaa #'%' ; Load '%' into A
+ jsr putchar ; Print '%' to serial to denote binary number
+ ldx #16 ; Load 16 into X, since we're printing 16 bits
+bPrintLoop rolb ; Rotate MSB of B into C of CCR
+ tpa ; Copy CCR into A
+ anda #1 ; and A with 1 to get only LSB
+ adda #'0' ; Add '0' to A to get ASCII Character
+ jsr putchar ; Print Character A to serial
+ dbeq X,bPrintDone ; Decrement X and if X == 0, branch to done
+ cpx #8 ; Compare X to 8 to check if done with upper byte
+ bne bPrintLoop ; If X != 8, loop to bPrintLoop
+ pulb ; Restore B from stack to get lower byte
+ bra bPrintLoop ; Branch back into loop to print lower byte
+bPrintDone puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+PrintHexByte
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save X to the stack
+ clra ; Clear A
+ ldx #16 ; Load 16 into X
+ idiv ; D / 16 => X & D
+ tfr x,a ; Transfer lower byte of X to A
+ cmpa #10 ; Compare A to 10
+ bhs IsAlpha ; If A >= 10, IsAlpha
+ adda #'0' ; Add '0' to A to make character
+ bra PrintChar ; Print jump to print the character
+IsAlpha adda #'A' ; Add 'A' to A to make character
+ suba #$A ; Subtract 10 from A
+PrintChar jsr putchar ; Print character to serial
+ tba ; Transfer B to A
+ cmpa #10 ; Compare A to 10
+ bhs IsAlpha2 ; If A >= 10, IsAlpha2
+ adda #'0' ; Add '0' to A to make character
+ bra PrintDone ; Print jump to print the character
+IsAlpha2 adda #'A' ; Add 'A' to A to make character
+ suba #$A ; Subtract 10 from A
+PrintDone jsr putchar ; Print character to serial
+ ldaa #' ' ; Load space into A
+ jsr putchar ; Print character to serial
+ pulx ; Restore X from the stack
+ puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return
+
+;*************************************************************************
+; PrintHexWord 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: Hexadecimal 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintHexWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq hIsZero ; Branch to hIsZero
+ 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
+hPrintLoop ldx #16 ; Load 16 in X for division
+ idiv ; Divide D / 16 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq hCheck ; If X == 0, branch to check D is zero
+hDNotZero cmpb #$0A ; Compare A to $0A
+ blt hex10 ; If B < $A, branch to hex10
+ addb #'A' ; Add 'A' to B to get ASCII Character
+ subb #$0A ; Subtract $A to adjust characters
+ stab 1,+y ; Save character from B to Y
+ exg X,D ; Swap values in X and D
+ bra hPrintLoop ; loop to hPrintLoop
+hex10 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 hPrintLoop ; Loop to hPrintLoop
+hCheck cpd #0 ; Compare D to 0
+ bne hDNotZero ; If D != 0, branch back to hDNotZero
+hPrintDone ldaa #'$' ; Load '$' into
+ staa 1,+y ; Save '$' into buffer in Y to denote Hex
+ 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+hIsZero ldaa #'$' ; Load '$' character into A
+ jsr putchar ; Print character to the screen
+ ldaa #'0' ; Load '0' character into A
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintDecimalWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq dIsZero ; Branch to hIsZero
+ 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 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; 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 #LF ; Load Line Feed into A
+ jsr putchar ; Write LF to terminal
+ 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
+*
+
+badAddr dc.b 'invalid input, address',CR,LF,NULL ; Error message for bad address
+
+badData dc.b 'invalid input, data',CR,LF,NULL ; Error message for bad data
+
+badCom dc.b 'invalid input, command',CR,LF,NULL ; Error message for bad command
+
+; twMsg: welcome message when type writer loads
+twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF
+ dc.b 'Restart to enter main menu again.',CR,LF,NULL
+
+
+; msg: this is the main option menu string
+msg dc.b 'S: Show the contents of memory location in word',CR,LF
+ dc.b 'W: Write the data word (not byte) to memory location',CR,LF
+ dc.b 'QUIT: Quit the main program, run Type writer program.',CR,LF,NULL
+
+ end ; last line of the file
diff --git a/cmpen472hw12_McDonnell/bin/Project.abs b/cmpen472hw12_McDonnell/bin/Project.abs
new file mode 100644
index 0000000..bafb25c
--- /dev/null
+++ b/cmpen472hw12_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw12_McDonnell/bin/Project.abs.phy b/cmpen472hw12_McDonnell/bin/Project.abs.phy
new file mode 100644
index 0000000..a683de5
--- /dev/null
+++ b/cmpen472hw12_McDonnell/bin/Project.abs.phy
@@ -0,0 +1,2 @@
+S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731325F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731C
+S9030000FC
diff --git a/cmpen472hw12_McDonnell/bin/Project.abs.s19 b/cmpen472hw12_McDonnell/bin/Project.abs.s19
new file mode 100644
index 0000000..32c163b
--- /dev/null
+++ b/cmpen472hw12_McDonnell/bin/Project.abs.s19
@@ -0,0 +1,44 @@
+S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731325F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731C
+S1233000000500000000000000000000000000000000000010000000000000000000000097
+S10B3020000000000000001094
+S1233100CF310086FF5A03860C5ACBCC00015CC8CE353B163467CE3000CD0100163232CE1E
+S12331203002FD3013163458863E1634928620163492CE3002FD3013163473CE3002163111
+S12331405520D3CE34EA16346716349927FB1634925A0120F4343BA63081572722815127D7
+S12331606D81532660A6008124265A1631E72742B7E534CE3002FD301316345830202DA64D
+S123318000812426401631E72728B7E43BA630272A812027F881242708091632A2271C20BC
+S12331A006091631E727143AB7C56D001632CF3A303DCE34A21634673A303DCE34BB1634AF
+S12331C0673A3A303DCE34D11634673A303DA630815526F1A630814926EBA630815426E54E
+S12331E0A63026E10631433BCD0000E630C124263BE6302732C120272EC1302D2FC1392202
+S12332000EC03037CC001013B7C63319ED20E2C1412D19C1462215C041CB0A37CC0010134C
+S1233220B7C63319ED20CA87B7023A3D8604B7023A3D34353B3435B754CE3002FD3013160B
+S12332403458CD300216339486201634923130CC00008D0000273D0303E630163360E63087
+S1233260163360B760840F26E9860D163492860A1634928D0000271C3435B754CE3002FDCC
+S12332803013163458CD30021633948620163492313020BE860D163492860A1634923A3162
+S12332A0303D3BCD0000E630271AC1202716C1302D17C1392213C03037CC000A13B7C633FC
+S12332C019ED20E287B7023A3D8604B7023A3D353BB7D4CD3002163394B7C5863D1634927F
+S12332E0863E163492EC00CE3002FD301316345816333B36862016349216349232CD300213
+S123330016339436862016349216349232CE3002FD3013163458CD3002163406860D1634F8
+S123332092860A1634923A313D343536A67F27056A3020F8876A303231303D343B37180E84
+S12333408625163492CE001055B72084018B301634920405088E000826EE3320EB3A303D1C
+S12333603B353487CE00101810B750810A24048B3020048B41800A163492180F810A240473
+S12333808B3020048B41800A163492862016349230313A3D343B358C0000275336353486EF
+S12333A030CE3015CD00051634613031876A4032CE001018108E00002716C10A2D0ACB41A6
+S12333C0C00A6B60B7D420E8CB306B60B7D420E08C000026E586246A60CE301516332916CA
+S12333E03467FD3026CE3015163458313A303D862416349286301634921634921634921668
+S12334003492313A303D343B358C000027413635348630CE3015CD00051634613031876A3B
+S12334204032CE000A18108E00002708CB306B60B7D420EE8C000026F3CE301516332916BA
+S12334403467FD3026CE3015163458313A303D8630163492313A303D36876A300436FB32C5
+S12334603D6A300436FB3D36A630270516349220F7323D36353416349927FB810D270A6A98
+S12334803016349203270220ED860A1634923031323D4FCC80FC5ACF3D4FCC200396CF3DCA
+S12334A0873D696E76616C696420696E7075742C20616464726573730D0A00696E76616CAA
+S12334C0696420696E7075742C20646174610D0A00696E76616C696420696E7075742C204B
+S12334E0636F6D6D616E640D0A0057656C636F6D6520746F205479706520577269746572A4
+S12335002C20796F75206D617920747970652062656C6F772E0D0A526573746172742074BE
+S12335206F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A202020EE
+S123354020202053686F772074686520636F6E74656E7473206F66206D656D6F7279206C3D
+S12335606F636174696F6E20696E20776F72640D0A573A2020202020205772697465207480
+S12335806865206461746120776F726420286E6F7420627974652920746F206D656D6F72EB
+S12335A079206C6F636174696F6E0D0A515549543A2020205175697420746865206D6169C6
+S12335C06E2070726F6772616D2C2072756E2054797065207772697465722070726F6772F7
+S10935E0616D2E0D0A00CE
+S9030000FC
diff --git a/cmpen472hw12_McDonnell/bin/main.dbg b/cmpen472hw12_McDonnell/bin/main.dbg
new file mode 100644
index 0000000..f017a20
--- /dev/null
+++ b/cmpen472hw12_McDonnell/bin/main.dbg
@@ -0,0 +1,822 @@
+**************************************************************************
+*
+* Title: Memory Monitor
+*
+* Objective: CMPEN 472 Homework 6
+*
+* Revision: V1.0
+*
+* Date: Feb. 28, 2025
+*
+* Programmer: Jacob McDonnell
+*
+* Company: The Pennsylvania State University
+* Department of Computer Science and Engineering
+*
+* Algorithm: Simple Serial I/O, address poking and modifying
+*
+* Register Use: A & B to current byte, etc,
+* X & Y holds address of strings and length of string,
+* D to hold data and address of the memory location to work on.
+*
+* 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
+* Memory locations changed if modified by user
+*
+* Observation: This program will prompt the user to print the contents of a
+* memory location and to modify the location with hexadecimal or
+* decimal data. If the user wishes, they can type 'QUIT' to exit
+* the memory monitor and enter the type writer program.
+*
+* 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
+
+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
+TESTER dc.w $0005 ; Memory location to test showing data
+ ; and writing data.
+
+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
+
+*
+* There is a section Data Section at the end of the file
+**************************************************************************
+* Program Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+ org $3100 ; Program start address, in RAM
+pgstart lds #$3100 ; initialize the stack pointer
+
+ ldaa #%11111111 ; Seven Segment display on PORTB
+ staa DDRB
+
+ 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
+
+mainLoop
+ ldx #$3000
+ ldy #$0100
+ jsr MDCommand
+
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with zeros
+
+ ldaa #'>' ; Load '>' into A
+ jsr putchar ; Jump to putchar to write to console
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Jump to putchar to write to console
+
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr ReadString ; Read a line from the serial console
+
+ ldx #buffer ; Load the address of the buffer into X
+ jsr CheckInput ; Jump to CheckInput to parse the user input
+ bra mainLoop ; Loop back to mainLoop always
+TypeWriter ldx #twMsg ; Load Type Writer welcome message address
+ jsr WriteString ; Jump to WriteString to write message to serial
+twReadLoop jsr getchar ; Read Character from Serial
+ beq twReadLoop ; While Character == 0, branch to twReadLoop
+ jsr putchar ; Write Character back to terminal
+ staa PORTB ; Write Character to PORTB
+ bra twReadLoop ; Branch always to twReadLoop
+
+**************************************************************************
+* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+;*************************************************************************
+; CheckInput subroutine
+;
+; This subroutine will check the input string and match the option.
+;
+; Input: Address of null terminated string in X.
+; Output: No Output, Control flow changed to proper subroutine.
+; Registers in use: X for the address of the string, A & B to read characters from
+; from the string.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine will not return a value, it will jump to the proper subroutine
+; based on the input given. If "QUIT" is the command, this subroutine will jump
+; to TypeWriter which will not return and needs to be restarted to exit.
+;
+
+CheckInput
+ pshx ; Save X to the stack
+ pshd ; Save D to the stack
+ ldaa 1,x+ ; Read Character from the string in X
+ cmpa #'W' ; Compare Character to 'W'
+ beq cWrite ; If A == 'W', branch to cWrite
+ cmpa #'Q' ; Compare A to 'Q'
+ beq cTypeWrite ; If A == 'Q', branch to cTypeWrite
+ cmpa #'S' ; Compare A to 'S'
+ bne cUnknownCMD ; If A != 'S', Command unknown
+ ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,X ; Exchange Y for X
+ pshx ; Save X to the stack
+ ldx #buffer ; Load address of buffer into X
+ ldy lenBuf ; Loadd length of the buffer into Y
+ jsr Zeros ; Fill buffer with Zeros
+ pulx ; Restore X from the stack
+ bra cDone ; branch always to cDone
+cWrite ldaa 0,x ; Load next character but don't increment
+ cmpa #'$' ; Compare A to '$'
+ bne cUnknownCMD ; If A != '$', branch to unknown command
+ jsr ReadHex ; ReadHex to Read the memory Address
+ beq cBadAddr ; If Z == 1, branch to cBadAddr
+ exg Y,D ; Exchange Y and D
+ pshd ; Save D to the stack
+skipSpaces ldaa 1,x+ ; Load next character into A
+ beq cBadData ; If A == 0, branch to bad Data (no data given)
+ cmpa #' ' ; Compare A to space character
+ beq skipSpaces ; While A == ' ', loop to skip spaces
+ cmpa #'$' ; Compare A to '$'
+ beq cHexData ; If A == '$', branch to cHexData
+ dex ; Decrement X by 1
+ jsr ReadDecimal ; Jump to ReadDecimal
+ beq cBadData ; If Z == 1, branch to cBadData
+ bra cWriteData ; Branch always to cWriteData
+cHexData dex ; Decrement X by 1
+ jsr ReadHex ; Jump to ReadHex to read hex data
+ beq cBadData ; If Z == 1, branch to cBadData
+cWriteData puld ; Restore D from the stack
+ exg D,X ; Exchange D and X
+ sty x ; Write data in Y to memory in X
+cDone jsr PrintMem ; Jump to PrintMem to print the contents of the location
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadAddr ldx #badAddr ; Load the address of badAddr into X
+ jsr WriteString ; Write badAddr to serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cBadData ldx #badData ; Load the address of badData into X
+ jsr WriteString ; Write badData to serial console
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cUnknownCMD ldx #badCom ; Load the address of badCom into X
+ jsr WriteString ; Write badCom to the serial console
+ puld ; Restore D from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+cTypeWrite ldaa 1,x+ ; Load next character from X
+ cmpa #'U' ; Compare A to 'U'
+ bne cUnknownCMD ; If A != 'U', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'I' ; Compare A to 'I'
+ bne cUnknownCMD ; If A != 'I', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ cmpa #'T' ; Compare A to 'T'
+ bne cUnknownCMD ; If A != 'T', branch to unknown command
+ ldaa 1,x+ ; Load next character from X
+ bne cUnknownCMD ; If A != 0, branch to unknown command
+ jmp TypeWriter ; Jump to TypeWriter
+
+;*************************************************************************
+; ReadHex subroutine
+;
+; This subroutine will read an ASCII string of a number in hex and convert it to
+; its value.
+;
+; Input: A memory address in register X.
+; Output: The value of the hex 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.
+;
+
+ReadHex
+ pshd ; Save D to the stack
+ ldy #0 ; Clear Y register
+ ldab 1,x+ ; Read character from X into B, add 1 to X
+ cmpb #'$' ; Compare B to '$'
+ bne rHError ; If B != '$', jump to error, not hex data
+rHLoop ldab 1,x+ ; Read Next character from X
+ beq rHDone ; If B == 0, exit loop
+ cmpb #' ' ; Compare B to space character
+ beq rHDone ; If B == ' ', exit loop
+ cmpb #'0' ; Compare B to '0' character
+ blt rHError ; If B < '0', bad address, exit loop
+ cmpb #'9' ; Compare B to '9' character
+ bhi rHAlpha ; 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 #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHAlpha cmpb #'A' ; Compare B to 'A' character
+ blt rHError ; If B < 'A', bad address, exit loop
+ cmpb #'F' ; Compare B to 'F' character
+ bhi rHError ; If B > 'F', invalid data, error out
+ subb #'A' ; Subtract 'A' from B to get true value
+ addb #$A ; Add $A to B to account for offet
+ pshb ; Save B to the stack
+ ldd #16 ; load 16 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 rHLoop ; Branch always to rHLoop
+rHDone clra ; clear A accumulator
+ tap ; Transfer A into CCR to clear zero bit
+ puld ; Restore D from the stack
+ rts ; Return to caller
+rHError 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
+
+MDCommand
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ pshd ; Save D to the stack
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ tfr x,d ; Copy X to D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Print the data
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Print space to console
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ ldd #0 ; Clear D
+MDLoop cpy #0 ; Compare Y to 0
+ beq MDDone ; If Y == 0, done
+ dey ; Decrement Y by 1
+ dey ; Decrement Y by 1
+ ldab 1,x+ ; Load data from X into B
+ jsr PrintHexByte ; Print the data
+ ldab 1,x+ ; Load data from X into B
+ jsr PrintHexByte ; Print the data
+ tfr y,a ; Transfer lower byte Y to A
+ anda #15 ; And A with 15, basically modulus 16
+ bne MDLoop ; If A & 15 != 0, no newline
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Print CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print LF to serial console
+ cpy #0 ; Compare Y to 0
+ beq MDDone ; If Y == 0, done
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ tfr x,d ; Copy X to D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Print the data
+ ldaa #' ' ; Load space character into A
+ jsr putchar ; Print space to console
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ bra MDLoop ; Loop
+MDDone ldaa #CR ; Load CR into A
+ jsr putchar ; Print CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print LF to serial console
+ puld ; Restore D from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return
+
+;*************************************************************************
+; 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 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
+
+;*************************************************************************
+; PrintMem subroutine
+;
+; This subroutine will print the address and contents of the given memory location.
+;
+; Input: A memory address in register X.
+; Output: The memory address in Hex and the contents in binary, hex, & decimal
+; on the serial output.
+; Registers in use: X for the address of the contents and for a buffer while printing,
+; D for the contents of the location, Y for another buffer address while
+; reversing strings and printing.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires the serial console to be setup before calling.
+;
+
+PrintMem
+ pshy ; Save Y to the Stack
+ pshd ; Save D to the Stack
+ exg x,d ; Copy Address from X to D to print
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintHexWord ; Print the Address in Hex
+ exg d,x ; Copy Address from D to X
+ ldaa #'=' ; Load the '=' character into A
+ jsr putchar ; Print the character to the serial
+ ldaa #'>' ; Load the '>' character into A
+ jsr putchar ; Print the character to the serial
+ ldd x ; Load data from address in X into D
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ jsr PrintBinaryWord ; Print the binary word to the serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintHexWord ; Prin the hex representation of the word to serial
+ psha ; Save A to the stack
+ ldaa #' ' ; Load Space character into A
+ jsr putchar ; Print Space character to the serial
+ jsr putchar ; Print Space character to the serial
+ pula ; Restore A from the stack
+ ldx #buffer ; Load the address of the buffer into X
+ ldy lenBuf ; Load the length of the buffer into Y
+ jsr Zeros ; Fill the buffer with Zeros
+ ldy #buffer ; Load the address of the buffer into Y
+ jsr PrintDecimalWord; Prin the decimal representation of the word to serial
+ ldaa #CR ; Load the carriage return character into A
+ jsr putchar ; Print the character to serial
+ ldaa #LF ; Load the line feed character into A
+ jsr putchar ; Print the character to serial
+ puld ; Restore D from the stack
+ puly ; Restore Y 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
+
+;*************************************************************************
+; PrintBinaryWord subroutine
+;
+; This subroutine will print a given word of data to the serial in binary.
+;
+; Input: 1 word of data in register D
+; Output: Binary representation of the data on the serial console
+; Registers in use: X to count the number of bits written, D for the input, A for characters,
+; B for the byte being written.
+; Memory locations in use: Memory addresses for serial.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintBinaryWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshb ; Save B to the stack (we want these bits again later)
+ tab ; Transfer A to B to get upper byte
+ ldaa #'%' ; Load '%' into A
+ jsr putchar ; Print '%' to serial to denote binary number
+ ldx #16 ; Load 16 into X, since we're printing 16 bits
+bPrintLoop rolb ; Rotate MSB of B into C of CCR
+ tpa ; Copy CCR into A
+ anda #1 ; and A with 1 to get only LSB
+ adda #'0' ; Add '0' to A to get ASCII Character
+ jsr putchar ; Print Character A to serial
+ dbeq X,bPrintDone ; Decrement X and if X == 0, branch to done
+ cpx #8 ; Compare X to 8 to check if done with upper byte
+ bne bPrintLoop ; If X != 8, loop to bPrintLoop
+ pulb ; Restore B from stack to get lower byte
+ bra bPrintLoop ; Branch back into loop to print lower byte
+bPrintDone puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+PrintHexByte
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save X to the stack
+ clra ; Clear A
+ ldx #16 ; Load 16 into X
+ idiv ; D / 16 => X & D
+ tfr x,a ; Transfer lower byte of X to A
+ cmpa #10 ; Compare A to 10
+ bhs IsAlpha ; If A >= 10, IsAlpha
+ adda #'0' ; Add '0' to A to make character
+ bra PrintChar ; Print jump to print the character
+IsAlpha adda #'A' ; Add 'A' to A to make character
+ suba #$A ; Subtract 10 from A
+PrintChar jsr putchar ; Print character to serial
+ tba ; Transfer B to A
+ cmpa #10 ; Compare A to 10
+ bhs IsAlpha2 ; If A >= 10, IsAlpha2
+ adda #'0' ; Add '0' to A to make character
+ bra PrintDone ; Print jump to print the character
+IsAlpha2 adda #'A' ; Add 'A' to A to make character
+ suba #$A ; Subtract 10 from A
+PrintDone jsr putchar ; Print character to serial
+ ldaa #' ' ; Load space into A
+ jsr putchar ; Print character to serial
+ pulx ; Restore X from the stack
+ puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return
+
+;*************************************************************************
+; PrintHexWord 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: Hexadecimal 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintHexWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq hIsZero ; Branch to hIsZero
+ 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
+hPrintLoop ldx #16 ; Load 16 in X for division
+ idiv ; Divide D / 16 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq hCheck ; If X == 0, branch to check D is zero
+hDNotZero cmpb #$0A ; Compare A to $0A
+ blt hex10 ; If B < $A, branch to hex10
+ addb #'A' ; Add 'A' to B to get ASCII Character
+ subb #$0A ; Subtract $A to adjust characters
+ stab 1,+y ; Save character from B to Y
+ exg X,D ; Swap values in X and D
+ bra hPrintLoop ; loop to hPrintLoop
+hex10 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 hPrintLoop ; Loop to hPrintLoop
+hCheck cpd #0 ; Compare D to 0
+ bne hDNotZero ; If D != 0, branch back to hDNotZero
+hPrintDone ldaa #'$' ; Load '$' into
+ staa 1,+y ; Save '$' into buffer in Y to denote Hex
+ 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+hIsZero ldaa #'$' ; Load '$' character into A
+ jsr putchar ; Print character to the screen
+ ldaa #'0' ; Load '0' character into A
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ jsr putchar ; Print character to the screen
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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.
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintDecimalWord
+ pshx ; Save X to the stack
+ pshd ; Save D (A:B) to the stack
+ pshy ; Save Y to the stack
+ cpd #0 ; Compare D to zero
+ beq dIsZero ; Branch to hIsZero
+ 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 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) 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
+ puly ; Restore Y from the stack
+ puld ; Restore D (A:B) from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; 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 #LF ; Load Line Feed into A
+ jsr putchar ; Write LF to terminal
+ 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
+*
+
+badAddr dc.b 'invalid input, address',CR,LF,NULL ; Error message for bad address
+
+badData dc.b 'invalid input, data',CR,LF,NULL ; Error message for bad data
+
+badCom dc.b 'invalid input, command',CR,LF,NULL ; Error message for bad command
+
+; twMsg: welcome message when type writer loads
+twMsg dc.b 'Welcome to Type Writer, you may type below.',CR,LF
+ dc.b 'Restart to enter main menu again.',CR,LF,NULL
+
+
+; msg: this is the main option menu string
+msg dc.b 'S: Show the contents of memory location in word',CR,LF
+ dc.b 'W: Write the data word (not byte) to memory location',CR,LF
+ dc.b 'QUIT: Quit the main program, run Type writer program.',CR,LF,NULL
+
diff --git a/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd
new file mode 100644
index 0000000..ac4d359
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd
@@ -0,0 +1 @@
+// After load the commands written below will be executed
diff --git a/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd
new file mode 100644
index 0000000..0bed464
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd
@@ -0,0 +1 @@
+// Before load the commands written below will be executed
diff --git a/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd
new file mode 100644
index 0000000..bf55944
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd
@@ -0,0 +1 @@
+// After reset the commands written below will be executed
diff --git a/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd
new file mode 100644
index 0000000..6a1549a
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd
@@ -0,0 +1 @@
+// At startup the commands written below will be executed
diff --git a/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd
new file mode 100644
index 0000000..6a1549a
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd
@@ -0,0 +1 @@
+// At startup the commands written below will be executed
diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell.mcp b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell.mcp
new file mode 100644
index 0000000..c36ca3d
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell.mcp
Binary files differ
diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/CWSettingsWindows.stg b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/CWSettingsWindows.stg
new file mode 100644
index 0000000..f4fb317
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/CWSettingsWindows.stg
Binary files differ
diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o
new file mode 100644
index 0000000..bafb25c
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx
new file mode 100644
index 0000000..9d4a153
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -0,0 +1,44 @@
+S0860000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731325F4D63446F6E6E656C6C5C636D70656E343732687731325F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726D71
+S1233000000500000000000000000000000000000000000010000000000000000000000097
+S10B3020000000000000001094
+S1233100CF310086FF5A03860C5ACBCC00015CC8CE353B163467CE3000CD0100163232CE1E
+S12331203002FD3013163458863E1634928620163492CE3002FD3013163473CE3002163111
+S12331405520D3CE34EA16346716349927FB1634925A0120F4343BA63081572722815127D7
+S12331606D81532660A6008124265A1631E72742B7E534CE3002FD301316345830202DA64D
+S123318000812426401631E72728B7E43BA630272A812027F881242708091632A2271C20BC
+S12331A006091631E727143AB7C56D001632CF3A303DCE34A21634673A303DCE34BB1634AF
+S12331C0673A3A303DCE34D11634673A303DA630815526F1A630814926EBA630815426E54E
+S12331E0A63026E10631433BCD0000E630C124263BE6302732C120272EC1302D2FC1392202
+S12332000EC03037CC001013B7C63319ED20E2C1412D19C1462215C041CB0A37CC0010134C
+S1233220B7C63319ED20CA87B7023A3D8604B7023A3D34353B3435B754CE3002FD3013160B
+S12332403458CD300216339486201634923130CC00008D0000273D0303E630163360E63087
+S1233260163360B760840F26E9860D163492860A1634928D0000271C3435B754CE3002FDCC
+S12332803013163458CD30021633948620163492313020BE860D163492860A1634923A3162
+S12332A0303D3BCD0000E630271AC1202716C1302D17C1392213C03037CC000A13B7C633FC
+S12332C019ED20E287B7023A3D8604B7023A3D353BB7D4CD3002163394B7C5863D1634927F
+S12332E0863E163492EC00CE3002FD301316345816333B36862016349216349232CD300213
+S123330016339436862016349216349232CE3002FD3013163458CD3002163406860D1634F8
+S123332092860A1634923A313D343536A67F27056A3020F8876A303231303D343B37180E84
+S12333408625163492CE001055B72084018B301634920405088E000826EE3320EB3A303D1C
+S12333603B353487CE00101810B750810A24048B3020048B41800A163492180F810A240473
+S12333808B3020048B41800A163492862016349230313A3D343B358C0000275336353486EF
+S12333A030CE3015CD00051634613031876A4032CE001018108E00002716C10A2D0ACB41A6
+S12333C0C00A6B60B7D420E8CB306B60B7D420E08C000026E586246A60CE301516332916CA
+S12333E03467FD3026CE3015163458313A303D862416349286301634921634921634921668
+S12334003492313A303D343B358C000027413635348630CE3015CD00051634613031876A3B
+S12334204032CE000A18108E00002708CB306B60B7D420EE8C000026F3CE301516332916BA
+S12334403467FD3026CE3015163458313A303D8630163492313A303D36876A300436FB32C5
+S12334603D6A300436FB3D36A630270516349220F7323D36353416349927FB810D270A6A98
+S12334803016349203270220ED860A1634923031323D4FCC80FC5ACF3D4FCC200396CF3DCA
+S12334A0873D696E76616C696420696E7075742C20616464726573730D0A00696E76616CAA
+S12334C0696420696E7075742C20646174610D0A00696E76616C696420696E7075742C204B
+S12334E0636F6D6D616E640D0A0057656C636F6D6520746F205479706520577269746572A4
+S12335002C20796F75206D617920747970652062656C6F772E0D0A526573746172742074BE
+S12335206F20656E746572206D61696E206D656E7520616761696E2E0D0A00533A202020EE
+S123354020202053686F772074686520636F6E74656E7473206F66206D656D6F7279206C3D
+S12335606F636174696F6E20696E20776F72640D0A573A2020202020205772697465207480
+S12335806865206461746120776F726420286E6F7420627974652920746F206D656D6F72EB
+S12335A079206C6F636174696F6E0D0A515549543A2020205175697420746865206D6169C6
+S12335C06E2070726F6772616D2C2072756E2054797065207772697465722070726F6772F7
+S10935E0616D2E0D0A00CE
+S9033100CB
diff --git a/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt
new file mode 100644
index 0000000..79d5b40
--- /dev/null
+++ b/cmpen472hw12_McDonnell/cmpen472hw12_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ
diff --git a/cmpen472hw12_McDonnell/prm/burner.bbl b/cmpen472hw12_McDonnell/prm/burner.bbl
new file mode 100644
index 0000000..0c57619
--- /dev/null
+++ b/cmpen472hw12_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
+