diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2025-04-01 18:21:56 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2025-04-01 18:21:56 -0400 |
| commit | fd3d5b220e20b5279a453739b42aae8becd69ca9 (patch) | |
| tree | da6b4fc053d94f132595a421a79fed469449c9f7 /cmpen472hw2_McDonnell/bin | |
| parent | 76518a5895392bfc55fab037afadb32b1add9d68 (diff) | |
HW9: Initial glue of 7 & 8
Diffstat (limited to 'cmpen472hw2_McDonnell/bin')
| -rw-r--r-- | cmpen472hw2_McDonnell/bin/Project.abs | bin | 0 -> 3286 bytes | |||
| -rw-r--r-- | cmpen472hw2_McDonnell/bin/Project.abs.phy | 2 | ||||
| -rw-r--r-- | cmpen472hw2_McDonnell/bin/Project.abs.s19 | 6 | ||||
| -rw-r--r-- | cmpen472hw2_McDonnell/bin/main.dbg | 169 |
4 files changed, 177 insertions, 0 deletions
diff --git a/cmpen472hw2_McDonnell/bin/Project.abs b/cmpen472hw2_McDonnell/bin/Project.abs Binary files differnew file mode 100644 index 0000000..2f19b93 --- /dev/null +++ b/cmpen472hw2_McDonnell/bin/Project.abs diff --git a/cmpen472hw2_McDonnell/bin/Project.abs.phy b/cmpen472hw2_McDonnell/bin/Project.abs.phy new file mode 100644 index 0000000..9f77331 --- /dev/null +++ b/cmpen472hw2_McDonnell/bin/Project.abs.phy @@ -0,0 +1,2 @@ +S0570000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877324D63446F6E6E656C6C5C62696E5C50726F6A6563742E616273AE +S9030000FC diff --git a/cmpen472hw2_McDonnell/bin/Project.abs.s19 b/cmpen472hw2_McDonnell/bin/Project.abs.s19 new file mode 100644 index 0000000..1c45a26 --- /dev/null +++ b/cmpen472hw2_McDonnell/bin/Project.abs.s19 @@ -0,0 +1,6 @@ +S0570000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877324D63446F6E6E656C6C5C62696E5C50726F6A6563742E616273AE +S1073000010000BF08 +S1233100CF310086FF5A0386005A0196018401260516311B20F516312E20F04C01804D018A +S12331201016313B4D01804C011016313B3D4C01F016313B4D01F016313B3D35FD300216D9 +S114314031470326FA313D34FE3000A70926FC303DD0 +S9030000FC diff --git a/cmpen472hw2_McDonnell/bin/main.dbg b/cmpen472hw2_McDonnell/bin/main.dbg new file mode 100644 index 0000000..0560731 --- /dev/null +++ b/cmpen472hw2_McDonnell/bin/main.dbg @@ -0,0 +1,169 @@ +************************************************************************** +* +* Title: LED Light Blinking +* +* Objective: CMPEN 472 Homework 2 in-class-room demonstration +* program +* +* Revision: V1.0 +* +* Date: Jan. 29, 2025 +* +* Programmer: Jacob McDonnell +* +* Company: The Pennsylvania State University +* Department of Computer Science and Engineering +* +* Algorithm: Simple Parallel I/O use and time delay-loop demo +* +* Register Use: A: LED Light on/off state and Switch 1 on/off state +* X,Y: Delay and loop counters +* +* 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 that blinks LEDs and blinking period can +* be changed with the delay loop counter value. +* +* Note: All Homework programs MUST have comments similar +* to this Homework 2 program. So, please use those +* comment format for all your subsequent CMPEN472 +* Homework programs. +* +* Adding more explanations and comments help you and +* others to understnad your program later. +* +* 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 +Counter1 dc.w $0100 ; X register count number for time Delay + ; inner loop for msec +Counter2 dc.w $00BF ; Y register count number for time delay + ; output loop for sec +* +************************************************************************** +* 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 ; LED 1, 2, 3, 4 at PORTB bit 4, 5, 6, 7 FOR CSM-12C128 board + staa DDRB ; set PORTB bit 4, 5, 6, 7 as Output + + ldaa #%00000000 + staa PORTB ; Turn off LED 1, 2, 3, 4 (all bits in PORTB, for simulation + +mainLoop + ldaa PORTB + anda #%00000001 ; Read switch 1 at PORTB bit 0 + bne sw1pushed ; check to see if it is pushed + +sw1notpsh jsr alternate ; Jump to the alternate subroutine to alternate LED 1 and 4 + bra mainLoop ; loop back to the beginning to check the switch + +sw1pushed jsr allBlink ; Jump to the allBlink subroutine to blink all lights + bra mainLoop ; loop back to the beginning to check the switch + +************************************************************************** +* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory +* + +alternate + bset PORTB,%10000000 ; Turn ON LED 4 at PORTB bit 7 + bclr PORTB,%00010000 ; Turn off LED 1 at PORTB bit 4 + jsr delay1sec ; Wait for 1 second + + bclr PORTB,%10000000 ; Turn off LED 4 at PORTB bit 7 + bset PORTB,%00010000 ; Turn on LED 1 at PORTB bit 4 + jsr delay1sec ; Wait for 1 second + rts ; Return to the caller + +allBlink + bset PORTB,%11110000 ; Turn ON all 4 LEDs + jsr delay1sec ; Wait for 1 second + + bclr PORTB,%11110000 ; Turn off all 4 LEDs + jsr delay1sec ; Wait for 1 second + rts ; Return to the caller + +;************************************************************************* +; delay1sec subroutine +; +; This subroutine will delay for 1 second +; +; Input: a 16 bit count number in 'Counter2' +; Output: time delay of 1 second, cpu cycles wasted +; Registers in use: Y register as counter +; Memory locations in use: a 16bit input number at 'Counter2' +; +; Comments: This subroutine requires delayMS subroutine +; + +delay1sec + pshy ; save Y to the stack + ldy Counter2 ; long delay by the value of Counter2 + +dly1Loop jsr delayMS ; total time delay = Y * delayMS + dey + bne dly1Loop + + puly ; restore y from the stack + rts ; return + +;************************************************************************* +; delayMS subroutine +; +; This subroutine causes a few msec. Delay +; +; Input: a 16bit count number in 'Counter1' +; Output: time delay, cpu cycle wasted +; Registers in use: X register, as counter +; Memory locations in use: a 16bit input number at 'Counter1' +; +; Comments: one can add more NOP instructions to lengthen the delay time. +; + +delayMS + pshx ; save X to the stack + ldx Counter1 ; short Delay + +dlyMSLoop nop ; total time delay = X * NOP + dex + bne dlyMSLoop + + pulx ; restore X + rts ; return + +* +* Add any subroutines here +* |
