summaryrefslogtreecommitdiff
path: root/cmpen472hw11_McDonnell/Sources/main.asm
diff options
context:
space:
mode:
Diffstat (limited to 'cmpen472hw11_McDonnell/Sources/main.asm')
-rw-r--r--cmpen472hw11_McDonnell/Sources/main.asm52
1 files changed, 26 insertions, 26 deletions
diff --git a/cmpen472hw11_McDonnell/Sources/main.asm b/cmpen472hw11_McDonnell/Sources/main.asm
index ecfa67c..2aebd9d 100644
--- a/cmpen472hw11_McDonnell/Sources/main.asm
+++ b/cmpen472hw11_McDonnell/Sources/main.asm
@@ -66,7 +66,7 @@ TCNTH EQU $0044 ; Timer free runing main counter
TSCR1 EQU $0046 ; Timer system control 1
TSCR2 EQU $004D ; Timer system control 2
TFLG1 EQU $004E ; Timer interrupt flag 1
-TC1H EQU $0052 ; Timer channel 1 register
+TC5H EQU $005A ; Timer channel 5 register
CR equ $0d ; carriage return, ASCII 'Return' key
LF equ $0a ; line feed, ASCII 'next line' character
@@ -132,10 +132,10 @@ waveType dc.b 'S' ; Used to track wave type 'T' for increa
dc.w rtiisr ; Real Time Interrupt vector
*
**************************************************************************
-* Timer Interrupt Vector Section: address used [ $FFEC to $FFED ] RAM Memory
+* Timer Interrupt Vector Section: address used [ $FFE4 to $FFE5 ] RAM Memory
*
- org $FFEC ; Timer channel 1 interrupt vector setup, on simulator
- dc.w oc1isr
+ org $FFE4 ; Timer channel 5 interrupt vector setup, on simulator
+ dc.w oc5isr
*
**************************************************************************
* Program Section: address used [ $3100 to $3FFF ] RAM Memory
@@ -248,7 +248,7 @@ rtidone jsr PrintTime ; Jump to PrintTime
rtiSkip RTI ; Return from RTI ISR
;*************************************************************************
-; oc1isr subroutine
+; oc5isr subroutine
;
; This subroutine will set a flag after a set number of cycles.
;
@@ -261,19 +261,19 @@ rtiSkip RTI ; Return from RTI ISR
; Comments: The timer will stop after outputCnt == numPoints
;
-oc1isr ldd interval ; Load the interval for the next clock cycle
- addd TC1H ; for next interrupt
- std TC1H ;
- bset TFLG1,%00100010 ; Clear CH1 interrupt flag
+oc5isr ldd interval ; Load the interval for the next clock cycle
+ addd TC5H ; for next interrupt
+ std TC5H ;
+ bset TFLG1,%00100000 ; Clear CH5 interrupt flag
ldaa #1 ; Load 1 into A
staa timeTrigger ; Signal that timer went off
ldd outputCnt ; Load the count of values outputed into D
addd #1 ; Increase output count by 1
std outputCnt ; Update the count of outputted values
cpd numPoints ; Compare D to numPoints
- blo oc1Done ; If D < numPoints, Done
- jsr StopTimerCH1 ; Stop Channel 1 Timer
-oc1Done RTI ; Return from interrupt
+ blo oc5Done ; If D < numPoints, Done
+ jsr StopTimerCH5 ; Stop Channel 5 Timer
+oc5Done RTI ; Return from interrupt
;*************************************************************************
; PrintWave subroutine
@@ -396,9 +396,9 @@ DonePrint stab outputVal ; Store updated output value
rts ; Return from Caller
;*************************************************************************
-; StartTimer1oc subroutine
+; StartTimer5oc subroutine
;
-; This subroutine will enable & start the oc1 timer.
+; This subroutine will enable & start the oc5 timer.
;
; Input: Interval to set the next clock cycle
; Output: No output other
@@ -406,14 +406,14 @@ DonePrint stab outputVal ; Store updated output value
; Memory locations in use: All memory locations used for the oc5 timer.
; interval to set the next cycle.
;
-; Comments: The timer will be enabled only on channel 1 for output compare.
+; Comments: The timer will be enabled only on channel 5 for output compare.
;
-StartTimer1oc
+StartTimer5oc
PSHD
- LDAA #%00000010
- STAA TIOS ; set CH1 Output Compare
- STAA TIE ; set CH1 interrupt Enable
+ LDAA #%00100000
+ STAA TIOS ; set CH5 Output Compare
+ STAA TIE ; set CH5 interrupt Enable
LDAA #%10000000 ; enable timer, Fast Flag Clear not set
STAA TSCR1
LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1
@@ -421,16 +421,16 @@ StartTimer1oc
LDD interval ; 125usec with (24MHz/1 clock)
ADDD TCNTH ; for first interrupt
- STD TC1H ;
+ STD TC5H ;
BSET TFLG1,%00000010 ; initial Timer CH5 interrupt flag Clear, not needed if fast clear set
- LDAA #%00000010
- STAA TIE ; set CH1 interrupt Enable
+ LDAA #%00100000
+ STAA TIE ; set CH5 interrupt Enable
PULD
RTS
;*************************************************************************
-; StopTimerCH1 subroutine
+; StopTimerCH5 subroutine
;
; This subroutine will stop and disable the timer.
;
@@ -442,7 +442,7 @@ StartTimer1oc
; Comments: The timer will be disabled on all channels.
;
-StopTimerCH1
+StopTimerCH5
psha ; Save A to the stack
clra ; Clear A
staa TIE ; Stop Timers
@@ -472,7 +472,7 @@ GenWave
std outputCnt ; Clear outputCnt
staa outputVal ; Clear outputVal
- jsr StartTimer1oc ; Start Timer on CH1
+ jsr StartTimer5oc ; Start Timer on CH5
genLoop ldaa timeTrigger ; Load timeTrigger into A
beq genLoop ; If A == 0, loop
@@ -483,7 +483,7 @@ genLoop ldaa timeTrigger ; Load timeTrigger into A
cpd numPoints ; Compare D to numPoints
blo genLoop ; If D < numPoints, Loop
- jsr StopTimerCH1 ; Turn off timer
+ jsr StopTimerCH5 ; Turn off timer
puld ; Restore D from the stack
rts ; Return