dofile "vcs.lua" 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) if toto ~= 15 then end abc = 13 ~ 0x7 xyz = 1 << 2 x:f() ::lualabel:: #pragma syntax6502 off lda = 5 if lda < 6 then print('yep') end #pragma syntax6502 on --[[ local function ptr_table(label, ...) local vals = {...} section(label .. "_lo") byte_lo(vals) section(label .. "_hi") byte_hi(vals) end ]] charset(" abcdefghijklmnopqrstuvwxyz-") @@message2 byte(4, "test", 0) charset() @@message byte(4, "test", 0) @@data crosspage byte(1, 2) byte(3, 4) end word(0xf080) byte(16, 3, 4, 5, 6, 24, 32) --[[ word(message) byte_lo(message) byte_hi(message) --]] byte(\(message&0xff), \(message>>8)) --[[ ptr_table("ptrs", message, data, 0) --]] --section{ "toto", align = 256, offset = 16 } --section{ "toto", org = 0xf100 } --section "waitForIntim" @@waitForIntim --alt short syntax when no other option -- n_{ a=INTIM } ? --lda(INTIM) -- or a=INTIM --bne "waitForIntim" ldx #0xf0 ldx #0b1101 ldy #0xAB - 16 + 0b11011 & 3 | 6 ~ 0xf >> ~3 << 1 // 5 lda data lda data,5 lda data,5,x lda data,5,y lda data+3,12 lda data+3,12,x lda data+3,12,y lda (INTIM,5,x) lda (INTIM,\a(a+2),x) lda (INTIM,5),y lda (INTIM,\a(a+2)),y jmp (INTIM) jmp (INTIM,12) jmp (INTIM,\a(a-4)) lda function(c) return data * c end, v lda \c(data*c), v local f = \c(data*c) v=5 lda !f,v v=12 lda !f,v local g = function() return function(c) return data * c end end lda !g(),v #pragma encapsulate off lda f,v lda !_toto+15,16,x lda #15 #pragma encapsulate on samepage lda #0xac lda #INTIM lda 0xbeef lda INTIM lda.w INTIM lda INTIM,x lda INTIM,y lda (INTIM,x) lda (INTIM),y end asl asl INTIM asl @_toto bne "test" bne waitForIntim bne f() bne _toto jam asl lsr ldx #16 ldy 0xf0f0 rts --[[ section "doOverscan" sta{WSYNC} -- WSYNC=a lda(2) sta{VBLANK} -- a=2 VBLANK=a lda(TIM_OVERSCAN) sta{TIM64T} -- a=TIM_OVERSCAN TIM64T=a jsr "waitForIntim" section "doVBlank" lda(0x0e) label ".vsyncLoop" sta{WSYNC} sta{VSYNC} lsr() bne ".vsyncLoop" lda(2) sta{VBLANK} lda(TIM_VBLANK) sta{TIM64T} jsr "waitForIntim" section "doKernel" lda(TIM_KERNEL) sta{T1024T} jsr "waitForIntim" section "start" -- clear zeropage cld() ldx(0) txa() label ".clearLoop" dex() tsx() pha() bne ".clearLoop" -- main label "mainLoop" jsr "doOverscan" jsr "doVBlank" jsr "doKernel" jmp "mainLoop" section{ name="vectors", org=0xfffc } word{ "start", "start" } ]]