diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2025-04-09 17:21:17 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2025-04-09 17:21:17 -0400 |
| commit | d1cbc8fb23dfa1b7c3c87962e1c99ab65a77f1d4 (patch) | |
| tree | d6a08bf94f2de31daa138ce84a1d7c06c33866dd /cmpen472hw10_McDonnell/bin/main.dbg | |
| parent | c785e7f8c1e0b58fb0b911703599bd9e65e1841b (diff) | |
Proper 125Hz working
Diffstat (limited to 'cmpen472hw10_McDonnell/bin/main.dbg')
| -rw-r--r-- | cmpen472hw10_McDonnell/bin/main.dbg | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/cmpen472hw10_McDonnell/bin/main.dbg b/cmpen472hw10_McDonnell/bin/main.dbg index 3934132..d635a34 100644 --- a/cmpen472hw10_McDonnell/bin/main.dbg +++ b/cmpen472hw10_McDonnell/bin/main.dbg @@ -107,11 +107,14 @@ outputVal dc.b $00 ; Used to track the output value of the outputCnt dc.w $0000 ; Used to track how many values have been outputted -interval dc.w 3000 ; Used to set the timer module based on clock cycles +interval dc.w 3000 ; Used to set the timer module based on clock cycles -numPoints dc.w 2048 ; Max Number of points for waves +numPoints dc.w 2048 ; Max Number of points for waves -timeTrigger dc.b $00 ; Tracks when timer is triggered +timeTrigger dc.b $00 ; Tracks when timer is triggered + +increment dc.w 1 ; Used for increment 31.25Hz -> 1 + ; 125Hz -> 4 waveType dc.b 'S' ; Used to track wave type 'T' for increasing triangle, ; 't' for decreasing triangle, @@ -281,9 +284,9 @@ SawToothWav clra ; Clear A ldaa #LF ; Load LF into A jsr putchar ; Write LF to serial console pula ; Restore A from the stack - addd #1 ; Increment output value by 1 + addd increment ; Add increment to D cpd #256 ; Compare D to 256 - lbne DonePrint ; If D != 256, Done + lblo DonePrint ; If D < 256, Done clrb ; Reset to Zero lbra DonePrint ; Branch to DonePrint SquareWaveH clra ; Clear A @@ -298,9 +301,9 @@ SquareWaveH clra ; Clear A pula ; Restore A from the stack clra ; Clear A ldab outputVal ; Load the output value into B - addd #1 ; Add 1 to D + addd increment ; Add increment to D cpd #256 ; Compare D to 256 - lbne DonePrint ; If D != 256, done + lblo DonePrint ; If D < 256, done clrb ; Reset B to zero ldaa #'q' ; Load 'q' into A staa waveType ; Update wave type to square wave low @@ -317,9 +320,9 @@ SquareWaveL clra ; Clear A pula ; Restore A from the stack clra ; Clear A ldab outputVal ; Load the output value into B - addd #1 ; Add 1 to D + addd increment ; Add increment to D cpd #256 ; Compare D to 256 - bne DonePrint ; If D != 256, done + blo DonePrint ; If D < 256, done clrb ; Reset B to zero ldaa #'Q' ; Load 'Q' into A staa waveType ; Update wave type to square wave low @@ -334,9 +337,9 @@ TriangleInc clra ; Clear A ldaa #LF ; Load LF into A jsr putchar ; Write LF to serial console pula ; Restore A from the stack - addd #1 ; Add 1 to D + addd increment ; Add increment to D cpd #256 ; Compare D to 256 - bne DonePrint ; If D != 256, done + blo DonePrint ; If D < 256, done ldaa #'t' ; Load 't' into A staa waveType ; Update wave type to decreasing triangle subd #1 ; Subtract 1 from D @@ -351,9 +354,9 @@ TriangleDec clra ; Clear A ldaa #LF ; Load LF into A jsr putchar ; Write LF to serial console pula ; Restore A from the stack - subd #1 ; Subtract 1 from D - cpd #$FFFF ; Compare D to $FFFF - bne DonePrint ; If D != $FFFF, done + subd increment ; Subtract increment from D + cpd #0 ; Compare D to 0 + blt DonePrint ; If D < 0, done ldaa #'T' ; Load 'T' into A staa waveType ; Update wave type to increasing triangle clrb ; Clear B @@ -585,6 +588,8 @@ isGw cmpa #'g' ; Compare A to 'g' jsr WriteString ; Write string ldaa #'S' ; Load 'S' for sawtooth staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz jsr GenWave ; Jump to GenWave ldx #doneWave ; Load the address of doneWave jsr WriteString ; Write string @@ -596,6 +601,11 @@ isGw2 cmpb #'2' ; Compare B to '2' lbne badCommand ; Not NULL? bad ldx #sw2Msg ; Load address of sawtooth 125Hz message jsr WriteString ; Write string + ldaa #'S' ; Load 'S' for sawtooth + staa waveType ; Save A to waveType + ldd #4 ; Load 4 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave ldx #doneWave ; Load the address of doneWave jsr WriteString ; Write string lbra ecDone ; Branch always to ecDone @@ -608,6 +618,8 @@ isGt cmpa #'t' ; Compare A to 't' jsr WriteString ; Write string ldaa #'T' ; Load 'T' for triangle staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz jsr GenWave ; Jump to GenWave ldx #doneWave ; Load the address of doneWave jsr WriteString ; Write string @@ -621,6 +633,8 @@ isGq cmpa #'q' ; Compare A to 'q' jsr WriteString ; Write string ldaa #'q' ; Load 'q' for square staa waveType ; Save A to waveType + ldd #1 ; Load 1 into D + std increment ; Set Increment to 1 -> 31.25Hz jsr GenWave ; Jump to GenWave ldx #doneWave ; Load the address of doneWave jsr WriteString ; Write string @@ -632,6 +646,11 @@ isGq2 cmpb #'2' ; Compare B to '2' bne badCommand ; B != NULL? bad ldx #sq2Msg ; Load address of square 125Hz message jsr WriteString ; Write string + ldaa #'q' ; Load 'q' for square + staa waveType ; Save A to waveType + ldd #4 ; Load 4 into D + std increment ; Set Increment to 4 -> 125Hz + jsr GenWave ; Jump to GenWave ldx #doneWave ; Load the address of doneWave jsr WriteString ; Write string lbra ecDone ; Branch always to ecDone |
