| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- ;export symbols
- XDEF PulseWidthMod
- XREF __SEG_END_SSTACK,TON,TOFF,PRESSED,PORT_T,FourMSDelay,Keypad
-
-
- PulseWidthMod:
- PSHA ;preserve registers
- PSHB
- PSHX
- PSHY
- PulseWidthMain:
- JSR Keypad ;call Keypad subroutine
- LDAA PRESSED ;load the pressed value ;7.1 ?
- CMPA #$00 ;check if no value has been pressed ;7.1 ?
- ; use previous value for TON and TOFF ?
- BEQ Return ;go back to the calling routine
-
- CheckTON:
- LDAB TON ;load TON to check if TON is zero
- CMPB #$00 ;conditional if TON is zero
- ;BEQ CheckTOFF ;check TOFFF if TON is zero
- BNE SetTAndDelay;following instructions? ;7.1 ?
-
- CheckTOFF: ;will be called if TON is equal to zero
- LDAB TOFF ;load TOFF into Acc. B
- CMPB #$00 ;check if TOFF == #$00
- BEQ PulseWidthMain ;"branch back to the keypad routine" ? should this be BEQ Keypad ?
- SetTAndDelay:
- BSET PORT_T,#%00001000 ;set bit 3 of Port T
- JSR FourMSDelay ;delay 4 ms
- LDAA TON ;load TON into Acc. A
- DECA ;decrement A
- STAA TON ;now we have decremented TON by way of Acc. A0
- BRA CheckTON ;check TON again
-
- ClearTAndDelay:
- BCLR PORT_T,#%00001000 ;clear bit 3 of Port T
- JSR FourMSDelay ;delay 4 ms
- LDAA TOFF ;load TOFF into Acc. A
- DECA ;decrement A
- STAA TOFF ;TOFF has been effectively decremented
- BRA CheckTOFF ;check TOFF again after decrementation
-
- Return:
- PULY ;restore the registers
- PULX
- PULB
- PULA
-
- RTI
-
-
|