1
0
mirror of https://github.com/g012/l65.git synced 2024-11-15 19:09:19 +00:00
l65/samples/vcs1k.l65

36 lines
997 B
Plaintext

require'vcs'
#pragma syntax6502k on
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
WSYNC=a lda#2 VBLANK=a 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
local filename=string.match(arg[0], ".-([^\\/]-)%.?[^%.\\/]*$")
writebin(filename..'.bin')
writesym(filename..'.sym')
print(stats)