Skip to content

Instantly share code, notes, and snippets.

@mertsalik
Created November 17, 2013 14:34
Show Gist options
  • Save mertsalik/7514105 to your computer and use it in GitHub Desktop.
Save mertsalik/7514105 to your computer and use it in GitHub Desktop.
XDEF Entry ; export 'Entry' symbol
ABSENTRY Entry ; for absolute assembly: mark this as application entry point
INCLUDE 'mc9s12c32.inc'
ROMStart EQU $4000
ORG RAMStart
Lamp DC.B $01
Counter1 DC.W $FFFF
Counter2 DC.W $0010
Temp DC.B $00
ORG ROMStart
Entry:
LDS #RAMEnd+1
;ANDCC #$BF
LDAA #$00 ; PE0
STAA DDRE
LDAA #$01
STAA DDRA
LDAA #$10
STAA DDRB
LDAA #$10 ; ilk isigi yakar
;LDAA Lamp
STAA PORTA ; LED1 ON
STAA PORTB ; LED2 OFF
LOOP:
JSR poll
JSR delayS
BRA LOOP
delayS:
LDY Counter2
delaySLoop:
JSR delayMs
DEY
BNE delaySLoop
RTS
delayMs:
LDX Counter1
delayMsLoop:
DEX
BNE delayMsLoop
RTS
poll:
LDAB PORTE
ANDB #$01
CMPB #$01
BEQ Return
LDAB Temp
CMPB #$01
BEQ Return2
COMA
STAA PORTA
STAA PORTB
LDAB #$01
STAB Temp
Return:
LDAB #$00
STAB Temp
Return2:
RTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment