From db27faf84654f0084542536e538044a0458bb554 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Mon, 10 Feb 2025 17:35:01 -0500 Subject: HW4 Initial --- examprep/ASM_layout.hwl | 18 +++ examprep/Default.mem | Bin 0 -> 285 bytes examprep/Full_Chip_Simulation.ini | 27 ++++ examprep/Sources/derivative.inc | 10 ++ examprep/Sources/main.asm | 86 +++++++++++ examprep/bin/Project.abs | Bin 0 -> 3162 bytes examprep/bin/Project.abs.phy | 2 + examprep/bin/Project.abs.s19 | 5 + examprep/bin/main.dbg | 65 +++++++++ examprep/cmd/Full_Chip_Simulation_Postload.cmd | 1 + examprep/cmd/Full_Chip_Simulation_Preload.cmd | 1 + examprep/cmd/Full_Chip_Simulation_Reset.cmd | 1 + examprep/cmd/Full_Chip_Simulation_SetCPU.cmd | 1 + examprep/cmd/Full_Chip_Simulation_Startup.cmd | 1 + examprep/examprep.mcp | Bin 0 -> 57065 bytes examprep/examprep_Data/CWSettingsWindows.stg | Bin 0 -> 4263 bytes .../examprep_Data/Standard/ObjectCode/main.asm.o | Bin 0 -> 3162 bytes .../examprep_Data/Standard/ObjectCode/main.asm.sx | 5 + .../examprep_Data/Standard/TargetDataWindows.tdt | Bin 0 -> 61354 bytes examprep/prm/burner.bbl | 157 +++++++++++++++++++++ 20 files changed, 380 insertions(+) create mode 100644 examprep/ASM_layout.hwl create mode 100644 examprep/Default.mem create mode 100644 examprep/Full_Chip_Simulation.ini create mode 100644 examprep/Sources/derivative.inc create mode 100644 examprep/Sources/main.asm create mode 100644 examprep/bin/Project.abs create mode 100644 examprep/bin/Project.abs.phy create mode 100644 examprep/bin/Project.abs.s19 create mode 100644 examprep/bin/main.dbg create mode 100644 examprep/cmd/Full_Chip_Simulation_Postload.cmd create mode 100644 examprep/cmd/Full_Chip_Simulation_Preload.cmd create mode 100644 examprep/cmd/Full_Chip_Simulation_Reset.cmd create mode 100644 examprep/cmd/Full_Chip_Simulation_SetCPU.cmd create mode 100644 examprep/cmd/Full_Chip_Simulation_Startup.cmd create mode 100644 examprep/examprep.mcp create mode 100644 examprep/examprep_Data/CWSettingsWindows.stg create mode 100644 examprep/examprep_Data/Standard/ObjectCode/main.asm.o create mode 100644 examprep/examprep_Data/Standard/ObjectCode/main.asm.sx create mode 100644 examprep/examprep_Data/Standard/TargetDataWindows.tdt create mode 100644 examprep/prm/burner.bbl (limited to 'examprep') diff --git a/examprep/ASM_layout.hwl b/examprep/ASM_layout.hwl new file mode 100644 index 0000000..af05bda --- /dev/null +++ b/examprep/ASM_layout.hwl @@ -0,0 +1,18 @@ +OPEN source 0 0 60 42 +Source < attributes MARKS off +OPEN assembly 60 0 40 30 +Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,TOPPC 0xF800 +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,ADDRESS 0x80 +OPEN data 0 42 60 28 +Data < attributes SCOPE global,COMPLEMENT None,FORMAT Symb,MODE automatic,UPDATERATE 10,NAMEWIDTH 16 +OPEN command 0 70 60 30 +Command < attributes CACHESIZE 1000 +bckcolor 50331647 +font 'Courier New' 9 BLACK +AUTOSIZE on +ACTIVATE Assembly Memory Register Command Data Source Procedure diff --git a/examprep/Default.mem b/examprep/Default.mem new file mode 100644 index 0000000..bf49148 Binary files /dev/null and b/examprep/Default.mem differ diff --git a/examprep/Full_Chip_Simulation.ini b/examprep/Full_Chip_Simulation.ini new file mode 100644 index 0000000..ddd9fb3 --- /dev/null +++ b/examprep/Full_Chip_Simulation.ini @@ -0,0 +1,27 @@ +[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,52,52,1972,1075 +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/examprep/Sources/derivative.inc b/examprep/Sources/derivative.inc new file mode 100644 index 0000000..988343b --- /dev/null +++ b/examprep/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/examprep/Sources/main.asm b/examprep/Sources/main.asm new file mode 100644 index 0000000..ee2c3e1 --- /dev/null +++ b/examprep/Sources/main.asm @@ -0,0 +1,86 @@ +************************************************************************** +* 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 + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +SOURCE ds.b $000C ; 12 Byte source array + +LENSRC dc.w $000C ; Length of the Source Array + +DEST ds.b $000C ; 12 Byte destination array + +LENDST dc.w $000C ; Length of the destination array + +StackSP dc.w $3100 ; Address of the stack + +* +************************************************************************** +* Program Section: address used [ $3100 to $3FFF ] RAM Memory +* + org $3100 ; Program start address, in RAM +pgstart lds StackSP ; initialize the stack pointer + ldaa #1 ; Load 1 into A + ldx #SOURCE ; Load the address of SOURCE into X + ldy LENSRC ; Load the length of SOURCE into Y +fillLoop tbeq Y,doneLoop ; If Y==0, jump to done loop + staa 1,X+ ; Copy A into address of X, add 1 to X + inca ; Increment A by 1 + dey ; Decrement Y by 1 + bra fillLoop ; Jump to fillLoop +doneLoop jsr memcpy ; Call memcpy + bra done + + +************************************************************************** +* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory +* + +;************************************************************************* +; memcpy subroutine +; +; This subroutine will copy LENSRC bytes from SOURCE to DEST. +; +; Input: Two addresses, SOURCE and DEST, 1 word length LENSRC +; Output: LENSRC bytes copied from SOURCE to DEST +; Registers in use: D to count the number of bytes copied +; Y to hold the address of the current byte in SOURCE +; X to hold the address of the current byte in DEST +; Memory locations in use: One word, LENSRC, for the length of bytes to copy +; Two arrays, SOURCE & DEST, to copy from SOURCE to DEST +; +memcpy + pshy ; Save Y to the stack + pshx ; Save X to the stack + pshd ; Save D to the stack + ldy #SOURCE ; Load the address of the source array into Y + ldx #DEST ; Load the address of the destination array into X + ldd LENSRC ; Load the length of the source array into D +loop tbeq D,EXIT ; If d==0, jump to EXIT + movb Y,X ; Copy data from address in Y to address in X + inx ; Increment X by 1 + iny ; Increment Y by 1 + subd #1 ; Decrement D by 1 + bra loop ; Branch always to loop +EXIT puld ; Restore D from the stack + pulx ; Restore X from the stack + puly ; Restore Y from the stack + rts ; Return to caller + +* +************************************************************************** + +done + end ; Last line of the file \ No newline at end of file diff --git a/examprep/bin/Project.abs b/examprep/bin/Project.abs new file mode 100644 index 0000000..3831379 Binary files /dev/null and b/examprep/bin/Project.abs differ diff --git a/examprep/bin/Project.abs.phy b/examprep/bin/Project.abs.phy new file mode 100644 index 0000000..6e803fc --- /dev/null +++ b/examprep/bin/Project.abs.phy @@ -0,0 +1,2 @@ +S04B0000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C6578616D707265705C62696E5C50726F6A6563742E61627395 +S9030000FC diff --git a/examprep/bin/Project.abs.s19 b/examprep/bin/Project.abs.s19 new file mode 100644 index 0000000..025a781 --- /dev/null +++ b/examprep/bin/Project.abs.s19 @@ -0,0 +1,5 @@ +S04B0000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C6578616D707265705C62696E5C50726F6A6563742E61627395 +S1213000000000000000000000000000000C000000000000000000000000000C310065 +S1233100FF301C8601CE3000FD300C0446066A30420320F7163119201E35343BCD3000CE4F +S11A3120300EFC300C04440B180A4000080283000120F23A30313DF1 +S9030000FC diff --git a/examprep/bin/main.dbg b/examprep/bin/main.dbg new file mode 100644 index 0000000..cd3eb3d --- /dev/null +++ b/examprep/bin/main.dbg @@ -0,0 +1,65 @@ +************************************************************************** +* 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 + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +SOURCE ds.b $000C ; 12 Byte source array + +LENSRC dc.w $000C ; Length of the Source Array + +DEST ds.b $000C ; 12 Byte destination array + +LENDST dc.w $000C ; Length of the destination array + +StackSP dc.w $3100 ; Address of the stack + +* +************************************************************************** +* Program Section: address used [ $3100 to $3FFF ] RAM Memory +* + org $3100 ; Program start address, in RAM +pgstart lds StackSP ; initialize the stack pointer + ldaa #1 ; Load 1 into A + ldx #SOURCE ; Load the address of SOURCE into X + ldy LENSRC ; Load the length of SOURCE into Y +fillLoop tbeq Y,doneLoop ; If Y==0, jump to done loop + staa 1,X+ ; Copy A into address of X, add 1 to X + inca ; Increment A by 1 + dey ; Decrement Y by 1 + bra fillLoop ; Jump to fillLoop +doneLoop jsr memcpy ; Call memcpy + bra done + + +memcpy pshy ; Save Y to the stack + pshx ; Save X to the stack + pshd ; Save D to the stack + ldy #SOURCE ; Load the address of the source array into Y + ldx #DEST ; Load the address of the destination array into X + ldd LENSRC ; Load the length of the source array into D +loop tbeq D,EXIT ; If d==0, jump to EXIT + movb Y,X ; Copy data from address in Y to address in X + inx ; Increment X by 1 + iny ; Increment Y by 1 + subd #1 ; Decrement D by 1 + bra loop ; Branch always to loop +EXIT puld ; Restore D from the stack + pulx ; Restore X from the stack + puly ; Restore Y from the stack + rts ; Return to caller + + +done diff --git a/examprep/cmd/Full_Chip_Simulation_Postload.cmd b/examprep/cmd/Full_Chip_Simulation_Postload.cmd new file mode 100644 index 0000000..ac4d359 --- /dev/null +++ b/examprep/cmd/Full_Chip_Simulation_Postload.cmd @@ -0,0 +1 @@ +// After load the commands written below will be executed diff --git a/examprep/cmd/Full_Chip_Simulation_Preload.cmd b/examprep/cmd/Full_Chip_Simulation_Preload.cmd new file mode 100644 index 0000000..0bed464 --- /dev/null +++ b/examprep/cmd/Full_Chip_Simulation_Preload.cmd @@ -0,0 +1 @@ +// Before load the commands written below will be executed diff --git a/examprep/cmd/Full_Chip_Simulation_Reset.cmd b/examprep/cmd/Full_Chip_Simulation_Reset.cmd new file mode 100644 index 0000000..bf55944 --- /dev/null +++ b/examprep/cmd/Full_Chip_Simulation_Reset.cmd @@ -0,0 +1 @@ +// After reset the commands written below will be executed diff --git a/examprep/cmd/Full_Chip_Simulation_SetCPU.cmd b/examprep/cmd/Full_Chip_Simulation_SetCPU.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/examprep/cmd/Full_Chip_Simulation_SetCPU.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/examprep/cmd/Full_Chip_Simulation_Startup.cmd b/examprep/cmd/Full_Chip_Simulation_Startup.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/examprep/cmd/Full_Chip_Simulation_Startup.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/examprep/examprep.mcp b/examprep/examprep.mcp new file mode 100644 index 0000000..bd55db6 Binary files /dev/null and b/examprep/examprep.mcp differ diff --git a/examprep/examprep_Data/CWSettingsWindows.stg b/examprep/examprep_Data/CWSettingsWindows.stg new file mode 100644 index 0000000..be689d4 Binary files /dev/null and b/examprep/examprep_Data/CWSettingsWindows.stg differ diff --git a/examprep/examprep_Data/Standard/ObjectCode/main.asm.o b/examprep/examprep_Data/Standard/ObjectCode/main.asm.o new file mode 100644 index 0000000..3831379 Binary files /dev/null and b/examprep/examprep_Data/Standard/ObjectCode/main.asm.o differ diff --git a/examprep/examprep_Data/Standard/ObjectCode/main.asm.sx b/examprep/examprep_Data/Standard/ObjectCode/main.asm.sx new file mode 100644 index 0000000..7b19995 --- /dev/null +++ b/examprep/examprep_Data/Standard/ObjectCode/main.asm.sx @@ -0,0 +1,5 @@ +S06A0000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C6578616D707265705C6578616D707265705F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726D63 +S1213000000000000000000000000000000C000000000000000000000000000C310065 +S1233100FF301C8601CE3000FD300C0446066A30420320F7163119201E35343BCD3000CE4F +S11A3120300EFC300C04440B180A4000080283000120F23A30313DF1 +S9033100CB diff --git a/examprep/examprep_Data/Standard/TargetDataWindows.tdt b/examprep/examprep_Data/Standard/TargetDataWindows.tdt new file mode 100644 index 0000000..84bc055 Binary files /dev/null and b/examprep/examprep_Data/Standard/TargetDataWindows.tdt differ diff --git a/examprep/prm/burner.bbl b/examprep/prm/burner.bbl new file mode 100644 index 0000000..0c57619 --- /dev/null +++ b/examprep/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 + -- cgit v1.2.3