2017-12-18 22:59:43 +00:00
|
|
|
require'nes'
|
|
|
|
|
|
|
|
mappers.NROM()
|
|
|
|
|
2017-12-23 15:36:02 +00:00
|
|
|
location(chrrom0)
|
2017-12-18 22:59:43 +00:00
|
|
|
|
2017-12-23 22:58:42 +00:00
|
|
|
local font = section("font")
|
2017-12-23 15:36:02 +00:00
|
|
|
dc.b 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -- <SPC>
|
|
|
|
dc.b 0x38,0x38,0x2c,0x64,0x7e,0x46,0xce,0x00,0x38,0x38,0x2c,0x64,0x7e,0x46,0xce,0x00 -- A
|
|
|
|
dc.b 0xfc,0x62,0x66,0x7c,0x62,0x66,0xfc,0x00,0xfc,0x62,0x66,0x7c,0x62,0x66,0xfc,0x00 -- B
|
|
|
|
dc.b 0x7c,0xe6,0xc2,0xc0,0xc0,0xe6,0x7c,0x00,0x7c,0xe6,0xc2,0xc0,0xc0,0xe6,0x7c,0x00 -- C
|
|
|
|
dc.b 0xfc,0x4e,0x46,0x46,0x46,0xce,0xfc,0x00,0xfc,0x4e,0x46,0x46,0x46,0xce,0xfc,0x00 -- D
|
|
|
|
dc.b 0xfe,0x66,0x60,0x7c,0x60,0x66,0xfe,0x00,0xfe,0x66,0x60,0x7c,0x60,0x66,0xfe,0x00 -- E
|
|
|
|
dc.b 0xfe,0x66,0x60,0x7c,0x60,0x60,0xf0,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0xf0,0x00 -- F
|
|
|
|
dc.b 0x7c,0xe6,0xc0,0xce,0xc6,0xe6,0x7c,0x00,0x7c,0xe6,0xc0,0xce,0xc6,0xe6,0x7c,0x00 -- G
|
|
|
|
dc.b 0xee,0x66,0x66,0x7e,0x66,0x66,0xee,0x00,0xee,0x66,0x66,0x7e,0x66,0x66,0xee,0x00 -- H
|
|
|
|
dc.b 0x3c,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x3c,0x18,0x18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T
|
|
|
|
dc.b 0xe6,0xe6,0xc2,0xc2,0xc2,0xe6,0x7c,0x00,0xe6,0xe6,0xc2,0xc2,0xc2,0xe6,0x7c,0x00 -- U
|
|
|
|
dc.b 0xc6,0xc6,0xc6,0x6c,0x6c,0x38,0x38,0x00,0xc6,0xc6,0xc6,0x6c,0x6c,0x38,0x38,0x00 -- V
|
|
|
|
dc.b 0xc6,0xc6,0xd6,0xfe,0xee,0xc6,0x82,0x00,0xc6,0xc6,0xd6,0xfe,0xee,0xc6,0x82,0x00 -- W
|
|
|
|
dc.b 0x86,0xcc,0x78,0x30,0x78,0xcc,0x86,0x00,0x86,0xcc,0x78,0x30,0x78,0xcc,0x86,0x00 -- X
|
|
|
|
dc.b 0xc6,0xc6,0x6c,0x38,0x18,0x18,0x38,0x00,0xc6,0xc6,0x6c,0x38,0x18,0x18,0x38,0x00 -- Y
|
|
|
|
dc.b 0x7e,0xce,0x98,0x30,0x62,0xe6,0xfc,0x00,0x7e,0xce,0x98,0x30,0x62,0xe6,0xfc,0x00 -- Z
|
2017-12-18 22:59:43 +00:00
|
|
|
|
|
|
|
location(prgrom)
|
|
|
|
@@nmi rti
|
|
|
|
@@irq rti
|
|
|
|
|
2017-12-23 22:58:42 +00:00
|
|
|
charset(" abcdefghijklmnopqrstuvwxyz", \x(x + (font.org - font.location.start) // 16))
|
2017-12-23 15:36:02 +00:00
|
|
|
local hello = "hello world"
|
2017-12-18 22:59:43 +00:00
|
|
|
@@text byte(hello)
|
|
|
|
|
|
|
|
@@main
|
|
|
|
init()
|
2017-12-20 17:55:53 +00:00
|
|
|
vblank_waitbegin()
|
2017-12-18 22:59:43 +00:00
|
|
|
-- load BG palette in PPU RAM
|
|
|
|
ppu_addr(BGPAL)
|
2017-12-20 17:55:53 +00:00
|
|
|
for _,v in ipairs{ 0x1f, 0x00, 0x10, 0x20 } do lda #v sta PPUDATA end
|
2017-12-18 22:59:43 +00:00
|
|
|
-- load screen text in PPU RAM 0x21CA
|
|
|
|
ppu_addr(0x21ca)
|
2017-12-20 17:55:53 +00:00
|
|
|
ldy #0 @_loadtxt lda text,y sta PPUDATA iny cpy ##hello bne _loadtxt
|
2017-12-18 22:59:43 +00:00
|
|
|
-- reset scroll position
|
|
|
|
ppu_addr(0) sta BGSCROL sta BGSCROL
|
2017-12-23 15:36:02 +00:00
|
|
|
-- show BG
|
|
|
|
lda #0x0a sta PPUMASK
|
2017-12-18 22:59:43 +00:00
|
|
|
-- idle
|
|
|
|
@_loop jmp _loop
|
|
|
|
|
|
|
|
writebin(filename..'.nes')
|
2017-12-20 17:55:53 +00:00
|
|
|
writesym(filename..'.mlb', 'mesen')
|
|
|
|
writesym(filename..'.nes', 'fceux')
|
2017-12-18 22:59:43 +00:00
|
|
|
print(stats)
|