mirror of
https://github.com/g012/l65.git
synced 2024-11-15 19:09:19 +00:00
92 lines
3.4 KiB
Plaintext
92 lines
3.4 KiB
Plaintext
|
require'vcs'
|
||
|
mappers['2K']()
|
||
|
|
||
|
local tmp = 0x80
|
||
|
|
||
|
section{ "font", align=256 } dc.b
|
||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,-- <SPC>
|
||
|
0x18,0x3c,0x66,0x7e,0x66,0x66,0x66,0x00,-- A
|
||
|
0x7c,0x66,0x66,0x7c,0x66,0x66,0x7c,0x00,-- B
|
||
|
0x3c,0x66,0x60,0x60,0x60,0x66,0x3c,0x00,-- C
|
||
|
0x78,0x6c,0x66,0x66,0x66,0x6c,0x78,0x00,-- D
|
||
|
0x7e,0x60,0x60,0x78,0x60,0x60,0x7e,0x00,-- E
|
||
|
0x7e,0x60,0x60,0x78,0x60,0x60,0x60,0x00,-- F
|
||
|
0x3c,0x66,0x60,0x6e,0x66,0x66,0x3c,0x00,-- G
|
||
|
0x66,0x66,0x66,0x7e,0x66,0x66,0x66,0x00,-- H
|
||
|
0x3c,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,-- I
|
||
|
0x1e,0x0c,0x0c,0x0c,0x0c,0x6c,0x38,0x00,-- J
|
||
|
0x66,0x6c,0x78,0x70,0x78,0x6c,0x66,0x00,-- K
|
||
|
0x60,0x60,0x60,0x60,0x60,0x60,0x7e,0x00,-- L
|
||
|
0x63,0x77,0x7f,0x6b,0x63,0x63,0x63,0x00,-- M
|
||
|
0x66,0x76,0x7e,0x7e,0x6e,0x66,0x66,0x00,-- N
|
||
|
0x3c,0x66,0x66,0x66,0x66,0x66,0x3c,0x00,-- O
|
||
|
0x7c,0x66,0x66,0x7c,0x60,0x60,0x60,0x00,-- P
|
||
|
0x3c,0x66,0x66,0x66,0x66,0x3c,0x0e,0x00,-- Q
|
||
|
0x7c,0x66,0x66,0x7c,0x78,0x6c,0x66,0x00,-- R
|
||
|
0x3c,0x66,0x60,0x3c,0x06,0x66,0x3c,0x00,-- S
|
||
|
0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x00,-- T
|
||
|
0x66,0x66,0x66,0x66,0x66,0x66,0x3c,0x00,-- U
|
||
|
0x66,0x66,0x66,0x66,0x66,0x3c,0x18,0x00,-- V
|
||
|
0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,-- W
|
||
|
0x66,0x66,0x3c,0x18,0x3c,0x66,0x66,0x00,-- X
|
||
|
0x66,0x66,0x66,0x3c,0x18,0x18,0x18,0x00,-- Y
|
||
|
0x7e,0x06,0x0c,0x18,0x30,0x60,0x7e,0x00 -- Z
|
||
|
|
||
|
charset(" abcdefghijklmnopqrstuvwxyz", \x(x*8))
|
||
|
@@text_hello dc.b "hello world"
|
||
|
|
||
|
local print_txt = tmp+1 -- text pointer, can cross
|
||
|
local print_line_count=tmp -- number of lines to print
|
||
|
local print_ptr = tmp+3 -- array of pointers to the characters
|
||
|
-- a = line count
|
||
|
@@print12
|
||
|
sta print_line_count
|
||
|
lda#6 sta NUSIZ0 sta NUSIZ1
|
||
|
-- set MSB of font character addresses
|
||
|
lda#font>>8 ldx#23 @_loadfont sta print_ptr,x dex dex bpl _loadfont
|
||
|
-- position sprites
|
||
|
samepage
|
||
|
sta WSYNC
|
||
|
ldx#6 @_delay dex bne _delay
|
||
|
sta RESP0 nop sta RESP1 lda#0x70 sta HMP0 lda#0x60 sta HMP1 sta WSYNC sta HMOVE
|
||
|
end
|
||
|
@_loop
|
||
|
-- load text line
|
||
|
ldx#0 ldy#0 @_loadline lda (print_txt),y sta print_ptr,x inx inx iny cpy#12 bne _loadline
|
||
|
lda#0x80 sta HMP0 sta HMP1
|
||
|
ldy#0 samepage @_printline
|
||
|
sta WSYNC sta HMOVE
|
||
|
-- first scanline
|
||
|
lda (print_ptr+2),y sta GRP0 lda (print_ptr+6),y sta GRP1
|
||
|
lda (print_ptr+22),y tax sleep(6)
|
||
|
lda (print_ptr+10),y sta GRP0 lda (print_ptr+14),y sta GRP1 lda (print_ptr+18),y sta GRP0 stx GRP1
|
||
|
sta HMCLR sleep(8) sta HMOVE
|
||
|
-- second scanline
|
||
|
lda (print_ptr),y sta GRP0 lda (print_ptr+4),y sta GRP1
|
||
|
lda (print_ptr+20),y tax lda#0x80 sta HMP0 sta HMP1 nop
|
||
|
lda (print_ptr+8),y sta GRP0 lda (print_ptr+12),y sta GRP1 lda (print_ptr+16),y sta GRP0 stx GRP1
|
||
|
iny cpy#8 bne _printline
|
||
|
end
|
||
|
dec print_line_count beq _end
|
||
|
lda print_txt clc adc#12 sta print_txt lda print_txt+1 adc#0 sta print_txt+1
|
||
|
jmp _loop
|
||
|
@_end
|
||
|
lda#0 sta GRP0 sta GRP1
|
||
|
rts
|
||
|
|
||
|
local kernel = function()
|
||
|
ldx#40 @_blank sta WSYNC dex bne _blank
|
||
|
setptr(text_hello,print_txt) lda#1 jsr print12
|
||
|
end
|
||
|
|
||
|
@@main
|
||
|
init()
|
||
|
lda#0xaa sta COLUP0 sta COLUP1
|
||
|
@_frame
|
||
|
overscan() vblank() screen(kernel) jmp _frame
|
||
|
|
||
|
;
|
||
|
writebin(filename..'.bin')
|
||
|
writesym(filename..'.sym')
|
||
|
print(stats)
|