1
0
mirror of https://github.com/g012/l65.git synced 2024-06-10 18:29:44 +00:00
l65/samples/vcs1.l65

33 lines
910 B
Plaintext

require'vcs'
TIM_OVERSCAN = 50 -- TIM64T, 3200 cycles = ~ 42 scanlines
TIM_VBLANK = 61 -- TIM64T, 3904 cycles = ~ 51 scanlines
TIM_KERNEL = 17 -- T1024T, 17408 cycles = ~229 scanlines
location(0xf000, 0xffff)
section{'vectors', org=0xfffc} dc.w start,start
local kernel = function()
ldx#0xd0 @_loop sta WSYNC stx COLUBK dex bne _loop
end
local wait = function() local l=label() lda INTIM bne l end
@@start
-- clear zeropage
cld ldx#0 txa @_clear dex tsx pha bne _clear
@main
-- overscan
sta WSYNC lda#2 sta VBLANK lda#TIM_OVERSCAN sta TIM64T wait()
-- vblank
lda#0b1110 @_vsync sta WSYNC sta VSYNC lsr bne _vsync
lda#2 sta VBLANK lda#TIM_VBLANK sta TIM64T wait() sta WSYNC sta VBLANK
-- kernel
lda#TIM_KERNEL sta T1024T kernel() wait()
jmp main
writebin(filename..'.bin')
writesym(filename..'.sym')
print(stats)