Locate entire game sequentially in memory (except boss key)

This commit is contained in:
Jeremy Penner 2021-01-07 20:14:51 -05:00
parent 19691a2d09
commit 7baf9ffeaf
8 changed files with 17 additions and 13 deletions

View file

@ -204,9 +204,13 @@
(error (.. op.opcode " doesn't support mode " op.mode))))
""))
(fn pdat-processor.var.bytes [d env]
(local init (match (type d.init)
:number d.init
:nil 0
:function (d.init env)))
(match d.size
1 (int8-to-bytes (or d.init 0))
2 (int16-to-bytes (or d.init 0))
1 (int8-to-bytes init)
2 (int16-to-bytes init)
n (string.rep "\0" n)))
(fn pdat-processor.ref.bytes [ref env]
(int16-to-bytes (env:lookup-addr ref.target)))

View file

@ -54,7 +54,7 @@
block))
(fn mk-vm [prg options]
(local code1 (prg:org 0xc00))
(local code1 (prg:org 0x4000))
(install-vm-parser prg)
(local vm {
:IP :0x60

View file

@ -17,9 +17,7 @@
})
(local org {
:tiles (prg:org 0x4000)
:font (prg:org 0x4f00)
:level (prg:org 0x5100)
; :level (prg:org 0x5100)
:code vm.code
})
@ -116,7 +114,7 @@
(fn deflevel [mapfile label]
(local level prg) ; todo: (asm.new prg) - if we want to load levels as an overlay
(local org (level:org org.level.org))
(local org level.vm.code) ; (level:org org.level.org) - if we want to give level data a stable loxation
(local map (readjson mapfile))
(local entity (require :game.entity))
(append-map map org label)

View file

@ -23,7 +23,7 @@
[:asl vm.TOP :x] [:rol :a] ;x2
[:asl vm.TOP :x] [:rol :a] ;x4
[:asl vm.TOP :x] [:rol :a] ;x8
[:adc #(hi org.font.org)]
[:adc #(hi ($1:lookup-addr :font))]
[:sta vm.TOPH :x])
(vm:word :draw-char ; pscreen c --

View file

@ -127,7 +127,7 @@
:<rot :drawmaprow :swap
:dup :not) :drop :drop :player-redraw)
(vm.code:append :tilepage [:db (hi org.tiles.org)])
(vm.code:append :tilepage [:db #(hi ($1:lookup-addr :jaye-tileset))])
(vm:def :lookup-tile ; itile -- ptile
; each tile is 32 bytes; 2^5
; we save some cycles by storing the indices as lllhhhhh, so we don't need to shift them'
@ -138,7 +138,7 @@
[:tya] [:and 0xe0]
[:sta vm.TOP :x])
(vm:def :set-human-tileset
[:lda #(hi org.tiles.org)]
[:lda #(hi ($1:lookup-addr :jaye-tileset))]
[:sta :tilepage])
(vm:def :set-prog-tileset
[:lda #(hi ($1:lookup-addr :neut-tileset))]

View file

@ -9,8 +9,9 @@
(util.reload :game.entity)
(util.reload :game.player)
(tile.appendtiles org.tiles)
(tile.appendgfx org.font (tile.loadgfx tile.fn-font))
(tile.appendtiles org.code)
(org.code:append [:align 0x100] :font)
(tile.appendgfx org.code (tile.loadgfx tile.fn-font))
(util.reload :game.level1)
(util.reload :game.level2)

View file

@ -38,6 +38,7 @@
(fn appendtiles [org]
(local tiles (loadgfx fn-tiles))
(org:append [:align 0x100] :jaye-tileset)
(appendgfx org tiles)
(org:append [:align 0x100] :neut-tileset)
(appendgfx org tiles :neut true)

View file

@ -36,7 +36,7 @@ $0c00-$1fff 3kb-8kb - free space
$2000-$4000 8kb-16kb - hgr gfx page 1
Game:
* fix hot reload :O
* fix hot reload :O
* Title screen
* Ending screen