Originally, I called it c8basic, but wanted KateBASIC, sounds much better
sudo apt install bnfc flex bison
make
Draw user key input with blinking cursor
include 'c8.asm'org 0x200jmp _start_global: .cursor: db11111000b_start: clsmov I, _global.cursormov v1,0 ; xmov v2,6 ; ymov v3,30 ; delay period 1/2 sec.mov v5,0 ; x = 0 for draw charactermov v6,0 ; cursor need redraw? .loop:mov v4,0 ; key scannermov v0, dtm sne v0,0jmp .draw_cursor .for: sknp v4jmp .keypressadd v4,1 se v4,16jmp .for .draw_cursor: sne v6,0 sne v0,0 drw v1, v2,1 se v6,0mov v6,0 sne v0,0mov dtm, v3jmp .loop .keypress: se vF,1 drw v1, v2,1 hex v4 drw v1, v5,5add v1,5mov I, _global.cursormov v6,1jmp .draw_cursorCurrently there is only one type: byte
Line comment //
Block comment /**/
global flag = 1
global binnum as byte = %10010011
global max_height as byte = $10 // decimal 16
let a
let b as byte
let c as byte = 10
let d as byte[2] = { 50, 30 } // array declare and init
sub dosomething
putc(0, 0, 5, $A) // draw number 0xA at top left of the display
endsub
function sum(a, b)
let c = a + b
return c
if a > b then
putc(10, 10, 1)
else
putc(10, 10, 0)
endif
for i = 0 to 5
putc( 0, i * 5, i )
endfor
for i = 0 to 10 step 2
// do something
endfor
For loop has not step down yet (negative step)
if a > $100 then
goto exit
endif
// do other thing
exit:
halt