From d130e95e39401aa09b10836d8b26cc659ee3b1ba Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Tue, 18 Feb 2025 14:25:22 -0500 Subject: Initial HW5 --- cmpen472hw5_McDonnell/ASM_layout.hwl | 23 ++ cmpen472hw5_McDonnell/Default.mem | Bin 0 -> 285 bytes cmpen472hw5_McDonnell/Full_Chip_Simulation.hwc | 1 + cmpen472hw5_McDonnell/Full_Chip_Simulation.ini | 39 +++ cmpen472hw5_McDonnell/Sources/derivative.inc | 10 + cmpen472hw5_McDonnell/Sources/main.asm | 272 +++++++++++++++++++++ cmpen472hw5_McDonnell/bin/Project.abs | Bin 0 -> 4062 bytes cmpen472hw5_McDonnell/bin/Project.abs.phy | 2 + cmpen472hw5_McDonnell/bin/Project.abs.s19 | 10 + cmpen472hw5_McDonnell/bin/main.dbg | 270 ++++++++++++++++++++ .../cmd/Full_Chip_Simulation_Postload.cmd | 1 + .../cmd/Full_Chip_Simulation_Preload.cmd | 1 + .../cmd/Full_Chip_Simulation_Reset.cmd | 1 + .../cmd/Full_Chip_Simulation_SetCPU.cmd | 1 + .../cmd/Full_Chip_Simulation_Startup.cmd | 1 + cmpen472hw5_McDonnell/cmpen472hw5_McDonnell.mcp | Bin 0 -> 57065 bytes .../CWSettingsWindows.stg | Bin 0 -> 2088 bytes .../Standard/ObjectCode/main.asm.o | Bin 0 -> 4062 bytes .../Standard/ObjectCode/main.asm.sx | 10 + .../Standard/TargetDataWindows.tdt | Bin 0 -> 62658 bytes cmpen472hw5_McDonnell/prm/burner.bbl | 157 ++++++++++++ 21 files changed, 799 insertions(+) create mode 100644 cmpen472hw5_McDonnell/ASM_layout.hwl create mode 100644 cmpen472hw5_McDonnell/Default.mem create mode 100644 cmpen472hw5_McDonnell/Full_Chip_Simulation.hwc create mode 100644 cmpen472hw5_McDonnell/Full_Chip_Simulation.ini create mode 100644 cmpen472hw5_McDonnell/Sources/derivative.inc create mode 100644 cmpen472hw5_McDonnell/Sources/main.asm create mode 100644 cmpen472hw5_McDonnell/bin/Project.abs create mode 100644 cmpen472hw5_McDonnell/bin/Project.abs.phy create mode 100644 cmpen472hw5_McDonnell/bin/Project.abs.s19 create mode 100644 cmpen472hw5_McDonnell/bin/main.dbg create mode 100644 cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd create mode 100644 cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd create mode 100644 cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd create mode 100644 cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd create mode 100644 cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd create mode 100644 cmpen472hw5_McDonnell/cmpen472hw5_McDonnell.mcp create mode 100644 cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/CWSettingsWindows.stg create mode 100644 cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o create mode 100644 cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx create mode 100644 cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt create mode 100644 cmpen472hw5_McDonnell/prm/burner.bbl diff --git a/cmpen472hw5_McDonnell/ASM_layout.hwl b/cmpen472hw5_McDonnell/ASM_layout.hwl new file mode 100644 index 0000000..e6b105c --- /dev/null +++ b/cmpen472hw5_McDonnell/ASM_layout.hwl @@ -0,0 +1,23 @@ +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 0x3125 +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 Visualizationtool 66 17 16 45 +VisualizationTool< Attributes [stEditM="0",swRefresh="3",refCycles="1"] +VisualizationTool< LoadInstrument DILSwitch[BoundX="24",BoundY="108",Port="0x1"] +VisualizationTool< LoadInstrument LED[BoundX="28",BoundY="44",Port="0x1",swBIT="7"] +VisualizationTool< ResetVT Undo +bckcolor 50331647 +font 'Courier New' 9 BLACK +AUTOSIZE on +ACTIVATE "Assembly" "Memory" "Register" "Command" "Data" "Procedure" "Source" "VisualizationTool" diff --git a/cmpen472hw5_McDonnell/Default.mem b/cmpen472hw5_McDonnell/Default.mem new file mode 100644 index 0000000..bf49148 Binary files /dev/null and b/cmpen472hw5_McDonnell/Default.mem differ diff --git a/cmpen472hw5_McDonnell/Full_Chip_Simulation.hwc b/cmpen472hw5_McDonnell/Full_Chip_Simulation.hwc new file mode 100644 index 0000000..f3ce7c9 --- /dev/null +++ b/cmpen472hw5_McDonnell/Full_Chip_Simulation.hwc @@ -0,0 +1 @@ +LOADMEM default.mem diff --git a/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini new file mode 100644 index 0000000..dd82fbd --- /dev/null +++ b/cmpen472hw5_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=0,1,-1,-1,-1,-1,260,260,2180,1283 +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/cmpen472hw5_McDonnell/Sources/derivative.inc b/cmpen472hw5_McDonnell/Sources/derivative.inc new file mode 100644 index 0000000..988343b --- /dev/null +++ b/cmpen472hw5_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/cmpen472hw5_McDonnell/Sources/main.asm b/cmpen472hw5_McDonnell/Sources/main.asm new file mode 100644 index 0000000..55f7e17 --- /dev/null +++ b/cmpen472hw5_McDonnell/Sources/main.asm @@ -0,0 +1,272 @@ +************************************************************************** +* +* Title: LED Light Dimmer Loop +* +* Objective: CMPEN 472 Homework 4 +* +* Revision: V1.0 +* +* Date: Feb. 14, 2025 +* +* Programmer: Jacob McDonnell +* +* Company: The Pennsylvania State University +* Department of Computer Science and Engineering +* +* Algorithm: Simple Parallel I/O use, time delay-loop, and PWM control +* +* Register Use: A to control LEDS initially and for Light Level +* X to hold the counter in the loop. +* +* Memory Use: RAM Locations from $3000 for data, +* RAM Locations from $3100 for program +* +* Input: Parameters hard-coded in the program - PORTB +* Switch 1 at PORTB bit 0 +* Switch 2 at PORTB bit 1 +* Switch 3 at PORTB bit 2 +* Switch 4 at PORTB bit 3 +* +* Output: LED 1 at PORTB bit 4 +* LED 2 at PORTB bit 5 +* LED 3 at PORTB bit 6 +* LED 4 at PORTB bit 7 +* +* Observation: This program will decrease LED 4 from 100% to 0% in 400ms +* and then increase LED 4 from 0% to 100% in 400ms. The program +* will loop forever. +* +* Note: ON CSM-12C128 board, +* Switch 1 is at PORTB bit 0, and +* LED 4 is at PORTB bit 7. +* +* 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 + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +Counter dc.w $0036 ; X register count number for time Delay + ; loop for 10 useconds + ; The work to calculate this number is in + ; the comments for the delay10usec subroutine. + +LEVEL dc.b $0005 ; Light Level that the LED should be + +* +************************************************************************** +* 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 + +mainLoop + ldaa #1 + jsr TurnOnLED + ldaa #2 + jsr TurnOnLED + ldaa #3 + jsr TurnOnLED + ldaa #1 + jsr TurnOffLED + ldaa #2 + jsr TurnOffLED + ldaa #3 + jsr TurnOffLED + jsr HighToLow + jsr HighToLow + jsr LowToHigh + jsr LowToHigh + bra mainLoop ; Loop back to mainLoop always + +************************************************************************** +* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory +* + +;************************************************************************* +; TurnOnLED subroutine +; +; This subroutine will dim turn on a specified LED +; +; Input: LED number 1 to 3, in accumulator A +; Output: Specified LED turned on +; Registers in use: A accumulator to specify the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires PORTB to be setup +; + +TurnOnLED + cmpa #1 ; Compare A to 1 + bne onCheckTwo ; If A != 1, check next number + bset PORTB,%00010000 ; Turn On LED 1 + bra onDone ; Jump to onDone +onCheckTwo cmpa #2 ; Compare A to 2 + bne onCheckThr ; If A != 2, check next number + bset PORTB,%00100000 ; Turn On LED 2 + bra onDone ; Jump to onDone +onCheckThr bset PORTB,%01000000 ; Turn On LED 3 +onDone rts ; Return to caller + +;************************************************************************* +; TurnOffLED subroutine +; +; This subroutine will dim turn of a specified LED +; +; Input: LED number 1 to 3, in accumulator A +; Output: Specified LED turned of +; Registers in use: A accumulator to specify the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires PORTB to be setup +; + +TurnOffLED + cmpa #1 ; Compare A to 1 + bne ofCheckTwo ; If A != 1, check next number + bclr PORTB,%00010000 ; Turn Off LED 1 + bra ofDone ; Jump to onDone +ofCheckTwo cmpa #2 ; Compare A to 2 + bne ofCheckThr ; If A != 2, check next number + bclr PORTB,%00100000 ; Turn Off LED 2 + bra ofDone ; Jump to onDone +ofCheckThr bclr PORTB,%01000000 ; Turn Off LED 3 +ofDone rts ; Return to caller + +;************************************************************************* +; HighToLow subroutine +; +; This subroutine will dim LED4 from 100% to 0% in 400ms +; +; Input: No Input, all parameters are hard coded +; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles +; Registers in use: A accumulator to control the light level of the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires dimmer subroutine +; + +HighToLow + psha ; Save accumulator A to the stack + ldaa #100 ; load 100 into accumulator A +decrease tbeq A,doneDec ; Test if A == 0, skip loop if so + staa LEVEL ; Save A to LEVEL + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + deca ; decrement accumulator A by 1 + bra decrease ; loop to decrease always +doneDec pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; HighToLow subroutine +; +; This subroutine will dim LED4 from 100% to 0% in 400ms +; +; Input: No Input, all parameters are hard coded +; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles +; Registers in use: A accumulator to control the light level of the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires dimmer subroutine +; + +LowToHigh + psha ; Save accumulator A to the stack + ldaa #0 ; load 100 into accumulator A +increase cmpa #100 ; Compare A to 100 + beq mainLoop ; Test if A == 100, jump to mainLoop + staa LEVEL ; Save A to LEVEL + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + inca ; increment accumulator A by 1 + bra increase ; loop to increase always +doneInc pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; dimmer subroutine +; +; This subroutine will dim LED4 to a given level +; +; Input: Two 1 byte counters, ONN and OFF, for how many times +; LED4 should be on and off for. +; Output: LED4 dimmed to a given level, wasted cycles +; Registers in use: A accumulator to counter number of times looped +; Memory locations in use: Two bytes ONN and OFF used to dim the LED4 to a given level +; +; Comments: This subroutine requires delay10usec subroutine +; + +dimmer + bset PORTB,%10000000 ; Turn LED4 on + psha ; Save A to the stack + ldaa LEVEL ; Load the light level into accumulator A +onDelay tbeq A, skipToOff ; Test if A == 0, skip loop if so + jsr delay10usec ; delay for 10 microseconds + deca ; decrement accumulator A by 1 + bra onDelay ; jump back to onDelay always +skipToOff bclr PORTB,%10000000 ; Turn off LED4 + ldaa #100 ; load 100 into accumulator A + suba LEVEL ; Subtract LEVEL to get off count +offDelay tbeq A,doneLoop ; Test if A == 0, skip loop if so + jsr delay10usec ; delay 10 microseconds + deca ; decrement accumulator A by 1 + bra offDelay ; jump back to offDelay always +doneLoop pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; delay10usec subroutine +; +; This subroutine causes a 10 usec. delay +; +; Input: a 16bit count number in 'Counter' +; Output: time delay, cpu cycle wasted +; Registers in use: X register, as counter +; Memory locations in use: a 16bit input number at 'Counter' +; +; Comments: Code relies on counter being $39 to be exactly 10 usec work is below +; Given: freq = 24MHz = 24000000 sec = 10 usec = 0.00001 +; freq = cycles / seconds +; +; cycles = freq * seconds = 24000000Hz * 0.00001 = 240 +; +; This sub routine is 12 + 4 * 'Counter' cycles long, solving for 'Counter' +; the result is found to be 57. +; + +delay10usec + pshx ; Save register x to the stack + ldx Counter ; load counter into register x +innerLoop dex ; decrement register x by 1 + bne innerLoop ; loop while register x is not 0 + pulx ; restore register x from the stack + nop ; extra nop to make exactly 10 usec + rts ; return to caller + + end ; last line of the file + diff --git a/cmpen472hw5_McDonnell/bin/Project.abs b/cmpen472hw5_McDonnell/bin/Project.abs new file mode 100644 index 0000000..079cf26 Binary files /dev/null and b/cmpen472hw5_McDonnell/bin/Project.abs differ diff --git a/cmpen472hw5_McDonnell/bin/Project.abs.phy b/cmpen472hw5_McDonnell/bin/Project.abs.phy new file mode 100644 index 0000000..5fd42b8 --- /dev/null +++ b/cmpen472hw5_McDonnell/bin/Project.abs.phy @@ -0,0 +1,2 @@ +S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162734B +S9030000FC diff --git a/cmpen472hw5_McDonnell/bin/Project.abs.s19 b/cmpen472hw5_McDonnell/bin/Project.abs.s19 new file mode 100644 index 0000000..102dafa --- /dev/null +++ b/cmpen472hw5_McDonnell/bin/Project.abs.s19 @@ -0,0 +1,10 @@ +S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162734B +S10630000036058E +S1233100CF310086F15A0386011631338602163133860316313386011631498602163149A2 +S1233120860316314916315F16315F16317916317920D4810126054C0110200C81022605CE +S12331404C012020034C01403D810126054D0110200C810226054D012020034D01403D369A +S123316086640440127A30021631941631941631941631944320EB323D36860081642787E7 +S12331807A30021631941631941631941631944220EA323D4C018036B630020440061631DC +S12331A0B74320F74D01808664B030020440061631B74320F7323D34FE30000926FD30A7EA +S10431C03DCD +S9030000FC diff --git a/cmpen472hw5_McDonnell/bin/main.dbg b/cmpen472hw5_McDonnell/bin/main.dbg new file mode 100644 index 0000000..5582c28 --- /dev/null +++ b/cmpen472hw5_McDonnell/bin/main.dbg @@ -0,0 +1,270 @@ +************************************************************************** +* +* Title: LED Light Dimmer Loop +* +* Objective: CMPEN 472 Homework 4 +* +* Revision: V1.0 +* +* Date: Feb. 14, 2025 +* +* Programmer: Jacob McDonnell +* +* Company: The Pennsylvania State University +* Department of Computer Science and Engineering +* +* Algorithm: Simple Parallel I/O use, time delay-loop, and PWM control +* +* Register Use: A to control LEDS initially and for Light Level +* X to hold the counter in the loop. +* +* Memory Use: RAM Locations from $3000 for data, +* RAM Locations from $3100 for program +* +* Input: Parameters hard-coded in the program - PORTB +* Switch 1 at PORTB bit 0 +* Switch 2 at PORTB bit 1 +* Switch 3 at PORTB bit 2 +* Switch 4 at PORTB bit 3 +* +* Output: LED 1 at PORTB bit 4 +* LED 2 at PORTB bit 5 +* LED 3 at PORTB bit 6 +* LED 4 at PORTB bit 7 +* +* Observation: This program will decrease LED 4 from 100% to 0% in 400ms +* and then increase LED 4 from 0% to 100% in 400ms. The program +* will loop forever. +* +* Note: ON CSM-12C128 board, +* Switch 1 is at PORTB bit 0, and +* LED 4 is at PORTB bit 7. +* +* 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 + +************************************************************************** +* Data Section: address used [ $3000 to $30FF ] RAM Memory +* + org $3000 ; Reserved RAM memory starting address + ; for Data for CMPEN 472 class +Counter dc.w $0036 ; X register count number for time Delay + ; loop for 10 useconds + ; The work to calculate this number is in + ; the comments for the delay10usec subroutine. + +LEVEL dc.b $0005 ; Light Level that the LED should be + +* +************************************************************************** +* 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 + +mainLoop + ldaa #1 + jsr TurnOnLED + ldaa #2 + jsr TurnOnLED + ldaa #3 + jsr TurnOnLED + ldaa #1 + jsr TurnOffLED + ldaa #2 + jsr TurnOffLED + ldaa #3 + jsr TurnOffLED + jsr HighToLow + jsr HighToLow + jsr LowToHigh + jsr LowToHigh + bra mainLoop ; Loop back to mainLoop always + +************************************************************************** +* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory +* + +;************************************************************************* +; TurnOnLED subroutine +; +; This subroutine will dim turn on a specified LED +; +; Input: LED number 1 to 3, in accumulator A +; Output: Specified LED turned on +; Registers in use: A accumulator to specify the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires PORTB to be setup +; + +TurnOnLED + cmpa #1 ; Compare A to 1 + bne onCheckTwo ; If A != 1, check next number + bset PORTB,%00010000 ; Turn On LED 1 + bra onDone ; Jump to onDone +onCheckTwo cmpa #2 ; Compare A to 2 + bne onCheckThr ; If A != 2, check next number + bset PORTB,%00100000 ; Turn On LED 2 + bra onDone ; Jump to onDone +onCheckThr bset PORTB,%01000000 ; Turn On LED 3 +onDone rts ; Return to caller + +;************************************************************************* +; TurnOffLED subroutine +; +; This subroutine will dim turn of a specified LED +; +; Input: LED number 1 to 3, in accumulator A +; Output: Specified LED turned of +; Registers in use: A accumulator to specify the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires PORTB to be setup +; + +TurnOffLED + cmpa #1 ; Compare A to 1 + bne ofCheckTwo ; If A != 1, check next number + bclr PORTB,%00010000 ; Turn Off LED 1 + bra ofDone ; Jump to onDone +ofCheckTwo cmpa #2 ; Compare A to 2 + bne ofCheckThr ; If A != 2, check next number + bclr PORTB,%00100000 ; Turn Off LED 2 + bra ofDone ; Jump to onDone +ofCheckThr bclr PORTB,%01000000 ; Turn Off LED 3 +ofDone rts ; Return to caller + +;************************************************************************* +; HighToLow subroutine +; +; This subroutine will dim LED4 from 100% to 0% in 400ms +; +; Input: No Input, all parameters are hard coded +; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles +; Registers in use: A accumulator to control the light level of the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires dimmer subroutine +; + +HighToLow + psha ; Save accumulator A to the stack + ldaa #100 ; load 100 into accumulator A +decrease tbeq A,doneDec ; Test if A == 0, skip loop if so + staa LEVEL ; Save A to LEVEL + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + deca ; decrement accumulator A by 1 + bra decrease ; loop to decrease always +doneDec pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; HighToLow subroutine +; +; This subroutine will dim LED4 from 100% to 0% in 400ms +; +; Input: No Input, all parameters are hard coded +; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles +; Registers in use: A accumulator to control the light level of the LED +; Memory locations in use: PORTB memory location associated with PORTB on the chip +; +; Comments: This subroutine requires dimmer subroutine +; + +LowToHigh + psha ; Save accumulator A to the stack + ldaa #0 ; load 100 into accumulator A +increase cmpa #100 ; Compare A to 100 + beq mainLoop ; Test if A == 100, jump to mainLoop + staa LEVEL ; Save A to LEVEL + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + jsr dimmer ; jump to dimmer subroutine + inca ; increment accumulator A by 1 + bra increase ; loop to increase always +doneInc pula ; Restore A from the stack + rts ; Return to caller + +;************************************************************************* +; dimmer subroutine +; +; This subroutine will dim LED4 to a given level +; +; Input: Two 1 byte counters, ONN and OFF, for how many times +; LED4 should be on and off for. +; Output: LED4 dimmed to a given level, wasted cycles +; Registers in use: A accumulator to counter number of times looped +; Memory locations in use: Two bytes ONN and OFF used to dim the LED4 to a given level +; +; Comments: This subroutine requires delay10usec subroutine +; + +dimmer + bset PORTB,%10000000 ; Turn LED4 on + psha ; Save A to the stack + ldaa LEVEL ; Load the light level into accumulator A +onDelay tbeq A, skipToOff ; Test if A == 0, skip loop if so + jsr delay10usec ; delay for 10 microseconds + deca ; decrement accumulator A by 1 + bra onDelay ; jump back to onDelay always +skipToOff bclr PORTB,%10000000 ; Turn off LED4 + ldaa #100 ; load 100 into accumulator A + suba LEVEL ; Subtract LEVEL to get off count +offDelay tbeq A,doneLoop ; Test if A == 0, skip loop if so + jsr delay10usec ; delay 10 microseconds + deca ; decrement accumulator A by 1 + bra offDelay ; jump back to offDelay always +doneLoop pula ; restore A from the stack + rts ; return to caller + +;************************************************************************* +; delay10usec subroutine +; +; This subroutine causes a 10 usec. delay +; +; Input: a 16bit count number in 'Counter' +; Output: time delay, cpu cycle wasted +; Registers in use: X register, as counter +; Memory locations in use: a 16bit input number at 'Counter' +; +; Comments: Code relies on counter being $39 to be exactly 10 usec work is below +; Given: freq = 24MHz = 24000000 sec = 10 usec = 0.00001 +; freq = cycles / seconds +; +; cycles = freq * seconds = 24000000Hz * 0.00001 = 240 +; +; This sub routine is 12 + 4 * 'Counter' cycles long, solving for 'Counter' +; the result is found to be 57. +; + +delay10usec + pshx ; Save register x to the stack + ldx Counter ; load counter into register x +innerLoop dex ; decrement register x by 1 + bne innerLoop ; loop while register x is not 0 + pulx ; restore register x from the stack + nop ; extra nop to make exactly 10 usec + rts ; return to caller + diff --git a/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd new file mode 100644 index 0000000..ac4d359 --- /dev/null +++ b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd @@ -0,0 +1 @@ +// After load the commands written below will be executed diff --git a/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd new file mode 100644 index 0000000..0bed464 --- /dev/null +++ b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd @@ -0,0 +1 @@ +// Before load the commands written below will be executed diff --git a/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd new file mode 100644 index 0000000..bf55944 --- /dev/null +++ b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd @@ -0,0 +1 @@ +// After reset the commands written below will be executed diff --git a/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/cmpen472hw5_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd @@ -0,0 +1 @@ +// At startup the commands written below will be executed diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell.mcp b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell.mcp new file mode 100644 index 0000000..f325553 Binary files /dev/null and b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell.mcp differ diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/CWSettingsWindows.stg b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/CWSettingsWindows.stg new file mode 100644 index 0000000..1d0d370 Binary files /dev/null and b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/CWSettingsWindows.stg differ diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o new file mode 100644 index 0000000..079cf26 Binary files /dev/null and b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o differ diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx new file mode 100644 index 0000000..540e06c --- /dev/null +++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx @@ -0,0 +1,10 @@ +S0840000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C636D70656E3437326877355F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726DCF +S10630000036058E +S1233100CF310086F15A0386011631338602163133860316313386011631498602163149A2 +S1233120860316314916315F16315F16317916317920D4810126054C0110200C81022605CE +S12331404C012020034C01403D810126054D0110200C810226054D012020034D01403D369A +S123316086640440127A30021631941631941631941631944320EB323D36860081642787E7 +S12331807A30021631941631941631941631944220EA323D4C018036B630020440061631DC +S12331A0B74320F74D01808664B030020440061631B74320F7323D34FE30000926FD30A7EA +S10431C03DCD +S9033100CB diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt new file mode 100644 index 0000000..1eb3593 Binary files /dev/null and b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt differ diff --git a/cmpen472hw5_McDonnell/prm/burner.bbl b/cmpen472hw5_McDonnell/prm/burner.bbl new file mode 100644 index 0000000..0c57619 --- /dev/null +++ b/cmpen472hw5_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 + -- cgit v1.2.3