Added LED driver code
This commit is contained in:
parent
c61597ae46
commit
9548197c2f
1
Makefile
1
Makefile
|
@ -16,6 +16,7 @@ SOURCES := src/memory.s \
|
||||||
src/main.s \
|
src/main.s \
|
||||||
src/boot.s \
|
src/boot.s \
|
||||||
src/irq.s \
|
src/irq.s \
|
||||||
|
src/led.s \
|
||||||
src/vera.s
|
src/vera.s
|
||||||
|
|
||||||
INCLUDES := $(wildcard include/*.i)
|
INCLUDES := $(wildcard include/*.i)
|
||||||
|
|
|
@ -2,6 +2,7 @@ PD0 = $00DF00
|
||||||
PD1 = $00DF01
|
PD1 = $00DF01
|
||||||
PD2 = $00DF02
|
PD2 = $00DF02
|
||||||
PD3 = $00DF03
|
PD3 = $00DF03
|
||||||
|
|
||||||
PDD0 = $00DF04
|
PDD0 = $00DF04
|
||||||
PDD1 = $00DF05
|
PDD1 = $00DF05
|
||||||
PDD2 = $00DF06
|
PDD2 = $00DF06
|
||||||
|
@ -14,10 +15,11 @@ PD7 = $00DF23
|
||||||
PDD4 = $00DF24
|
PDD4 = $00DF24
|
||||||
PDD5 = $00DF25
|
PDD5 = $00DF25
|
||||||
PDD6 = $00DF26
|
PDD6 = $00DF26
|
||||||
PCS7 = $00DF27
|
|
||||||
|
|
||||||
|
PCS7 = $00DF27
|
||||||
BCR = $00DF40
|
BCR = $00DF40
|
||||||
SSCR = $00DF41
|
SSCR = $00DF41
|
||||||
|
|
||||||
TCR = $00DF42
|
TCR = $00DF42
|
||||||
TER = $00DF43
|
TER = $00DF43
|
||||||
TIFR = $00DF44
|
TIFR = $00DF44
|
||||||
|
@ -68,6 +70,7 @@ ACSR2 = $00DF74
|
||||||
ARTD2 = $00DF75
|
ARTD2 = $00DF75
|
||||||
ACSR3 = $00DF76
|
ACSR3 = $00DF76
|
||||||
ARTD3 = $00DF77
|
ARTD3 = $00DF77
|
||||||
|
|
||||||
PIBFR = $00DF78
|
PIBFR = $00DF78
|
||||||
PIBER = $00DF79
|
PIBER = $00DF79
|
||||||
PIR2 = $00DF7A
|
PIR2 = $00DF7A
|
||||||
|
@ -76,3 +79,44 @@ PIR4 = $00DF7C
|
||||||
PIR5 = $00DF7D
|
PIR5 = $00DF7D
|
||||||
PIR6 = $00DF7E
|
PIR6 = $00DF7E
|
||||||
PIR7 = $00DF7F
|
PIR7 = $00DF7F
|
||||||
|
|
||||||
|
; Enable the 512 bytes of on-CPU SRAM from $000000-0001FF
|
||||||
|
w65c265s_sram_on .macro
|
||||||
|
lda #%00000100
|
||||||
|
trb SSCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
w65c265s_sram_off .macro
|
||||||
|
lda #%00000100
|
||||||
|
tsb SSCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
; Disable the on-CPU ROM
|
||||||
|
w65c265s_rom_off .macro
|
||||||
|
lda #%10000000
|
||||||
|
tsb BCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
; Enable the on-CPU ROM
|
||||||
|
w65c265s_rom_on .macro
|
||||||
|
lda #%10000000
|
||||||
|
trb BCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
; Start FCLK
|
||||||
|
fclk_start .macro
|
||||||
|
lda #%00000001
|
||||||
|
tsb SSCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
; Stop FCLK
|
||||||
|
fclk_stop .macro
|
||||||
|
lda #%00000001
|
||||||
|
trb SSCR
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
; Select FCLK as the clock source
|
||||||
|
fclk_select .macro
|
||||||
|
lda #%11111010
|
||||||
|
tsb SSCR
|
||||||
|
.endmacro
|
|
@ -22,3 +22,22 @@ short_i .macro
|
||||||
sep #$10
|
sep #$10
|
||||||
.xs
|
.xs
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
save_registers .macro
|
||||||
|
php
|
||||||
|
.long_a
|
||||||
|
.long_i
|
||||||
|
pha
|
||||||
|
phx
|
||||||
|
phy
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
restore_registers .macro
|
||||||
|
.long_a
|
||||||
|
.long_i
|
||||||
|
ply
|
||||||
|
plx
|
||||||
|
pla
|
||||||
|
plp
|
||||||
|
.endmacro
|
||||||
|
|
31
kernel.list
31
kernel.list
|
@ -12,6 +12,7 @@ SSCR = $00df41
|
||||||
UIER = $00df49
|
UIER = $00df49
|
||||||
AUTO_INC_256 = $900000
|
AUTO_INC_256 = $900000
|
||||||
AUTO_INC_128 = $800000
|
AUTO_INC_128 = $800000
|
||||||
|
led_blink_red = $c1004d
|
||||||
VERA_DC_VIDEO = 57097
|
VERA_DC_VIDEO = 57097
|
||||||
VERA_DC_HSCALE = 57098
|
VERA_DC_HSCALE = 57098
|
||||||
AUTO_INC_NONE = $000000
|
AUTO_INC_NONE = $000000
|
||||||
|
@ -19,26 +20,27 @@ main = $c0ffc0
|
||||||
AUTO_INC_40 = $b00000
|
AUTO_INC_40 = $b00000
|
||||||
VERA_DC_VSCALE = 57099
|
VERA_DC_VSCALE = 57099
|
||||||
VERA_CTRL = 57093
|
VERA_CTRL = 57093
|
||||||
|
VERA_L_128H = $80
|
||||||
EIER = $00df47
|
EIER = $00df47
|
||||||
T2CH = $00df65
|
T2CH = $00df65
|
||||||
T0CH = $00df61
|
T0CH = $00df61
|
||||||
|
VERA_PSG_BASE = $1f9c0
|
||||||
T0CL = $00df60
|
T0CL = $00df60
|
||||||
VERA_L0_MAPBASE = 57102
|
VERA_L0_MAPBASE = 57102
|
||||||
AUTO_INC_2 = $200000
|
VERA_PALETTE_BASE= $1fa00
|
||||||
AUTO_INC_1 = $100000
|
led_red_on = $c10019
|
||||||
VERA_AUDIO_DATA = 57117
|
VERA_AUDIO_DATA = 57117
|
||||||
VERA_TILESIZE8x8= $00
|
VERA_TILESIZE8x8= $00
|
||||||
AUTO_INC_16 = $500000
|
|
||||||
VERA_SCANLINE_L = 57096
|
VERA_SCANLINE_L = 57096
|
||||||
T4LH = $00df59
|
T4LH = $00df59
|
||||||
T4LL = $00df58
|
T4LL = $00df58
|
||||||
TER = $00df43
|
TER = $00df43
|
||||||
UIFR = $00df48
|
UIFR = $00df48
|
||||||
VERA_PSG_BASE = $1f9c0
|
VERA_DC_HSTOP = 57098
|
||||||
VERA_ADDR1_L = 57088
|
VERA_ADDR1_L = 57088
|
||||||
PD7 = $00df23
|
PD7 = $00df23
|
||||||
PD6 = $00df22
|
PD6 = $00df22
|
||||||
VERA_DC_HSTOP = 57098
|
PD5 = $00df21
|
||||||
PD4 = $00df20
|
PD4 = $00df20
|
||||||
PD3 = $00df03
|
PD3 = $00df03
|
||||||
PD2 = $00df02
|
PD2 = $00df02
|
||||||
|
@ -49,7 +51,6 @@ AUTO_INC_64 = $700000
|
||||||
VERA_AUDIO_RATE = 57116
|
VERA_AUDIO_RATE = 57116
|
||||||
ACSR0 = $00df70
|
ACSR0 = $00df70
|
||||||
VERA_BASE = $00df00
|
VERA_BASE = $00df00
|
||||||
ACSR2 = $00df74
|
|
||||||
ACSR3 = $00df76
|
ACSR3 = $00df76
|
||||||
T4CL = $00df68
|
T4CL = $00df68
|
||||||
T6CH = $00df6d
|
T6CH = $00df6d
|
||||||
|
@ -71,23 +72,25 @@ PDD0 = $00df04
|
||||||
PDD1 = $00df05
|
PDD1 = $00df05
|
||||||
PDD2 = $00df06
|
PDD2 = $00df06
|
||||||
PDD3 = $00df07
|
PDD3 = $00df07
|
||||||
w65c265s_init = $008008
|
AUTO_INC_2 = $200000
|
||||||
VERA_L_128H = $80
|
AUTO_INC_1 = $100000
|
||||||
VERA_DC_VSTART = 57099
|
VERA_DC_VSTART = 57099
|
||||||
VERA_L_BPP8 = $03
|
led_init = $c0fffa
|
||||||
VERA_DATA0 = 57091
|
VERA_DATA0 = 57091
|
||||||
AUTO_INC_4 = $300000
|
AUTO_INC_4 = $300000
|
||||||
AUTO_INC_8 = $400000
|
AUTO_INC_8 = $400000
|
||||||
T7LL = $00df5e
|
T7LL = $00df5e
|
||||||
|
led_red_off = $c10033
|
||||||
VERA_L_32W = $00
|
VERA_L_32W = $00
|
||||||
VERA_L_128W = $20
|
VERA_L_128W = $20
|
||||||
|
AUTO_INC_16 = $500000
|
||||||
PIBFR = $00df78
|
PIBFR = $00df78
|
||||||
AUTO_INC_32 = $600000
|
AUTO_INC_32 = $600000
|
||||||
VERA_L0_CONFIG = 57101
|
VERA_L0_CONFIG = 57101
|
||||||
VERA_DC_BORDER = 57100
|
VERA_DC_BORDER = 57100
|
||||||
T7CH = $00df6f
|
T7CH = $00df6f
|
||||||
AUTO_INC_160 = $d00000
|
AUTO_INC_160 = $d00000
|
||||||
vera_init = $c0ffee
|
vera_init = $c10071
|
||||||
T2LL = $00df54
|
T2LL = $00df54
|
||||||
TIFR = $00df44
|
TIFR = $00df44
|
||||||
T2LH = $00df55
|
T2LH = $00df55
|
||||||
|
@ -109,7 +112,7 @@ VERA_SPI_DATA = 57118
|
||||||
T2CL = $00df64
|
T2CL = $00df64
|
||||||
VERA_ADDR0_H = 57090
|
VERA_ADDR0_H = 57090
|
||||||
VERA_SPI_CTRL = 57119
|
VERA_SPI_CTRL = 57119
|
||||||
VERA_PALETTE_BASE= $1fa00
|
VERA_L_BPP8 = $03
|
||||||
VERA_ADDR0_M = 57089
|
VERA_ADDR0_M = 57089
|
||||||
VERA_ADDR0_L = 57088
|
VERA_ADDR0_L = 57088
|
||||||
VERA_L_BPP4 = $02
|
VERA_L_BPP4 = $02
|
||||||
|
@ -123,18 +126,20 @@ T5LL = $00df5a
|
||||||
VERA_TILESIZE8x16= $02
|
VERA_TILESIZE8x16= $02
|
||||||
VERA_ISR = 57094
|
VERA_ISR = 57094
|
||||||
irq_exit = $00810d
|
irq_exit = $00810d
|
||||||
|
w65c265s_init = $008008
|
||||||
VERA_ADDR1_M = 57089
|
VERA_ADDR1_M = 57089
|
||||||
UART3_BAUD_RATE = 9600
|
UART3_BAUD_RATE = 9600
|
||||||
ACSR1 = $00df72
|
ACSR1 = $00df72
|
||||||
VERA_DC_VSTOP = 57100
|
VERA_DC_VSTOP = 57100
|
||||||
VERA_L_32H = $00
|
VERA_L_32H = $00
|
||||||
VERA_L_BITMAP = $04
|
ACSR2 = $00df74
|
||||||
VERA_IRQLINE_L = 57095
|
VERA_IRQLINE_L = 57095
|
||||||
T6LL = $00df5c
|
T6LL = $00df5c
|
||||||
PDD4 = $00df24
|
PDD4 = $00df24
|
||||||
T3CL = $00df66
|
T3CL = $00df66
|
||||||
T3CH = $00df67
|
T3CH = $00df67
|
||||||
VERA_L1_MAPBASE = 57109
|
VERA_L1_MAPBASE = 57109
|
||||||
|
delay = $c0ffee
|
||||||
VERA_L0_HSCROLL_L= 57104
|
VERA_L0_HSCROLL_L= 57104
|
||||||
VERA_L0_HSCROLL_H= 57105
|
VERA_L0_HSCROLL_H= 57105
|
||||||
T6LH = $00df5d
|
T6LH = $00df5d
|
||||||
|
@ -153,6 +158,7 @@ empty_irq_handler= $008100
|
||||||
VERA_TILESIZE16x8= $01
|
VERA_TILESIZE16x8= $01
|
||||||
VERA_AUDIO_CTRL = 57115
|
VERA_AUDIO_CTRL = 57115
|
||||||
VERA_DC_HSTART = 57097
|
VERA_DC_HSTART = 57097
|
||||||
|
VERA_L_BITMAP = $04
|
||||||
DISABLED = 0
|
DISABLED = 0
|
||||||
ARTD2 = $00df75
|
ARTD2 = $00df75
|
||||||
ARTD3 = $00df77
|
ARTD3 = $00df77
|
||||||
|
@ -161,6 +167,5 @@ ARTD1 = $00df73
|
||||||
T1LH = $00df53
|
T1LH = $00df53
|
||||||
VERA_SPRITE_ATTR_BASE= $1fc00
|
VERA_SPRITE_ATTR_BASE= $1fc00
|
||||||
BCR = $00df40
|
BCR = $00df40
|
||||||
PD5 = $00df21
|
|
||||||
VERA_L1_VSCROLL_L= 57113
|
VERA_L1_VSCROLL_L= 57113
|
||||||
VERA_L1_VSCROLL_H= 57114
|
VERA_L1_VSCROLL_H= 57114
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
.section code
|
||||||
|
|
||||||
|
led_init .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
; Set P5.4 and P5.5 as output
|
||||||
|
lda #%00110000
|
||||||
|
tsb PDD5
|
||||||
|
|
||||||
|
; Set P6.1 as output
|
||||||
|
lda #%00000010
|
||||||
|
tsb PDD6
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_red_on .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00010000
|
||||||
|
tsb PD5
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_red_off .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00010000
|
||||||
|
trb PD5
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_green_on .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00100000
|
||||||
|
tsb PD5
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_green_off .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00100000
|
||||||
|
trb PD5
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_blue_on .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00000010
|
||||||
|
tsb PD6
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_blue_off .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
lda #%00000010
|
||||||
|
trb PD6
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_blink_red .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
jsl led_red_on
|
||||||
|
|
||||||
|
ldx #02
|
||||||
|
jsl delay
|
||||||
|
|
||||||
|
jsl led_red_off
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_blink_green .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
jsl led_green_on
|
||||||
|
|
||||||
|
ldx #02
|
||||||
|
jsl delay
|
||||||
|
|
||||||
|
jsl led_green_off
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
led_blink_blue .proc
|
||||||
|
.save_registers
|
||||||
|
.short_a
|
||||||
|
.long_i
|
||||||
|
|
||||||
|
jsl led_blue_on
|
||||||
|
|
||||||
|
ldx #02
|
||||||
|
jsl delay
|
||||||
|
|
||||||
|
jsl led_blue_off
|
||||||
|
|
||||||
|
.restore_registers
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.endsection code
|
50
src/main.s
50
src/main.s
|
@ -1,13 +1,12 @@
|
||||||
.section code
|
.section code
|
||||||
main .proc
|
main .proc
|
||||||
|
|
||||||
; Start FCLK
|
.short_a
|
||||||
lda #%00000001
|
.long_i
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Disable the on-CPU ROM
|
.fclk_start
|
||||||
lda #%10001001
|
|
||||||
tsb BCR
|
.w65c265s_rom_off
|
||||||
|
|
||||||
; Disable secondary interrupt sources
|
; Disable secondary interrupt sources
|
||||||
stz UIER
|
stz UIER
|
||||||
|
@ -17,23 +16,36 @@ main .proc
|
||||||
; Disable all timers
|
; Disable all timers
|
||||||
stz TER
|
stz TER
|
||||||
|
|
||||||
; Set P5.4 and P5.5 as output
|
.fclk_select
|
||||||
lda #%00110000
|
|
||||||
tsb PDD5
|
|
||||||
|
|
||||||
; Set P6.1 as output
|
jsl led_blink_red
|
||||||
lda #%00000010
|
|
||||||
tsb PDD6
|
|
||||||
|
|
||||||
; Disable on-chip SRAM
|
jsl led_init
|
||||||
lda #%00000100
|
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Select FCLK as the clock source
|
|
||||||
lda #%11111010
|
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Initialize the VERA
|
; Initialize the VERA
|
||||||
jsl vera_init
|
jsl vera_init
|
||||||
|
|
||||||
|
idle:
|
||||||
|
wai
|
||||||
|
bra idle
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
; Delay X times.
|
||||||
|
delay .proc
|
||||||
|
phy
|
||||||
|
|
||||||
|
loop_x
|
||||||
|
ldy #$FFFF
|
||||||
|
|
||||||
|
loop_y
|
||||||
|
dey
|
||||||
|
bne loop_y
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne loop_x
|
||||||
|
|
||||||
|
ply
|
||||||
|
rtl
|
||||||
|
.endproc
|
||||||
|
|
||||||
.endsection
|
.endsection
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
.include "sentinel65x.i"
|
.include "sentinel65x.i"
|
||||||
|
|
||||||
|
; The kernel uses its own direct page and stack, located in the on-CPU
|
||||||
|
; SRAM; this RAM is only visible during a kernel call, usually an interrupt
|
||||||
|
; handler, such as a timer or COP.
|
||||||
* = 000000
|
* = 000000
|
||||||
.dsection zp
|
.dsection zp
|
||||||
|
|
||||||
|
|
209
stuff.s
209
stuff.s
|
@ -1,209 +0,0 @@
|
||||||
.include "sentinel65x.i"
|
|
||||||
|
|
||||||
* = $C8000
|
|
||||||
|
|
||||||
.null "WDC"
|
|
||||||
jml w65c265s_init
|
|
||||||
|
|
||||||
w65c265s_init .proc
|
|
||||||
; Disable standard interrupts
|
|
||||||
sei
|
|
||||||
|
|
||||||
.short_a
|
|
||||||
.long_i
|
|
||||||
|
|
||||||
; Set data bank to 0
|
|
||||||
lda #0
|
|
||||||
pha
|
|
||||||
plb
|
|
||||||
.databank 0
|
|
||||||
|
|
||||||
; Set direct page to $0000
|
|
||||||
pea $0000
|
|
||||||
pld
|
|
||||||
.dpage $0000
|
|
||||||
|
|
||||||
; Set stack to $001FF
|
|
||||||
ldx #$01FF
|
|
||||||
txs
|
|
||||||
|
|
||||||
; Start FCLK
|
|
||||||
lda #%00000001
|
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Disable the on-CPU ROM
|
|
||||||
lda #%10001001
|
|
||||||
tsb BCR
|
|
||||||
|
|
||||||
; Disable secondary interrupt sources
|
|
||||||
stz UIER
|
|
||||||
stz TIER
|
|
||||||
stz EIER
|
|
||||||
|
|
||||||
; Enable all used chip select lines.
|
|
||||||
lda #%11110011
|
|
||||||
sta PCS7
|
|
||||||
|
|
||||||
; Disable all timers
|
|
||||||
stz TER
|
|
||||||
|
|
||||||
; Set P5.4 and P5.5 as output
|
|
||||||
lda #%00110000
|
|
||||||
tsb PDD5
|
|
||||||
|
|
||||||
; Set P6.1 as output
|
|
||||||
lda #%00000010
|
|
||||||
tsb PDD6
|
|
||||||
|
|
||||||
; Disable on-chip SRAM
|
|
||||||
lda #%00000100
|
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Select FCLK as the clock source
|
|
||||||
lda #%11111010
|
|
||||||
tsb SSCR
|
|
||||||
|
|
||||||
; Initialize the VERA
|
|
||||||
jsl vera_init
|
|
||||||
|
|
||||||
; Jump to entry point.
|
|
||||||
jml start
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
blink_red .proc
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
; Turn on the red LED
|
|
||||||
lda #%00010000
|
|
||||||
tsb PD5
|
|
||||||
|
|
||||||
ldx #02
|
|
||||||
jsl delay
|
|
||||||
|
|
||||||
; Turn off the red LED
|
|
||||||
lda #%00010000
|
|
||||||
trb PD5
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
rtl
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
blink_green .proc
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
; Turn on the green LED
|
|
||||||
lda #%00100000
|
|
||||||
tsb PD5
|
|
||||||
|
|
||||||
ldx #02
|
|
||||||
jsl delay
|
|
||||||
|
|
||||||
; Turn off the green LED
|
|
||||||
lda #%00100000
|
|
||||||
trb PD5
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
rtl
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
blink_blue .proc
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
|
|
||||||
; Turn on the blue LED
|
|
||||||
lda #%00000010
|
|
||||||
tsb PD6
|
|
||||||
|
|
||||||
ldx #02
|
|
||||||
jsl delay
|
|
||||||
|
|
||||||
; Turn off the blue LED
|
|
||||||
lda #%00000010
|
|
||||||
trb PD6
|
|
||||||
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
rtl
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
; Delay X times.
|
|
||||||
delay .proc
|
|
||||||
phy
|
|
||||||
|
|
||||||
loop_x
|
|
||||||
ldy #$FFFF
|
|
||||||
|
|
||||||
loop_y
|
|
||||||
dey
|
|
||||||
bne loop_y
|
|
||||||
|
|
||||||
dex
|
|
||||||
bne loop_x
|
|
||||||
|
|
||||||
ply
|
|
||||||
rtl
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
start .proc
|
|
||||||
jsl blink_blue
|
|
||||||
main_loop
|
|
||||||
nop
|
|
||||||
bra main_loop
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
empty_irq_handler .proc
|
|
||||||
phb
|
|
||||||
phd
|
|
||||||
.long_a
|
|
||||||
.long_i
|
|
||||||
pha
|
|
||||||
phx
|
|
||||||
phy
|
|
||||||
|
|
||||||
jmp irq_exit
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
nmi_handler .proc
|
|
||||||
|
|
||||||
jsl blink_red
|
|
||||||
jsl blink_green
|
|
||||||
jsl blink_blue
|
|
||||||
|
|
||||||
rti
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
irq_exit .proc
|
|
||||||
.long_a
|
|
||||||
.long_i
|
|
||||||
ply
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
pld
|
|
||||||
plb
|
|
||||||
rti
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
vera_init .proc
|
|
||||||
pha
|
|
||||||
|
|
||||||
jsl blink_red
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jsl blink_green
|
|
||||||
|
|
||||||
pla
|
|
||||||
rtl
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
.fill $FF80 - *, 0
|
|
||||||
* = $FF80
|
|
||||||
.fill $FFBA - *, empty_irq_handler
|
|
||||||
* = $FFBA
|
|
||||||
.word nmi_handler
|
|
||||||
.fill $FFFF - *, empty_irq_handler
|
|
||||||
.fill 524288 - *, 0
|
|
Loading…
Reference in New Issue