diff --git a/asm/asm.fnl b/asm/asm.fnl index ea4cd5d..de6ad14 100644 --- a/asm/asm.fnl +++ b/asm/asm.fnl @@ -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))) diff --git a/asm/vm.fnl b/asm/vm.fnl index ef79fba..066b064 100644 --- a/asm/vm.fnl +++ b/asm/vm.fnl @@ -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 diff --git a/game/defs.fnl b/game/defs.fnl index f7f6f8b..cf1c46c 100644 --- a/game/defs.fnl +++ b/game/defs.fnl @@ -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) diff --git a/game/footer.fnl b/game/footer.fnl index 6c939c8..8dbae7d 100644 --- a/game/footer.fnl +++ b/game/footer.fnl @@ -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 -- diff --git a/game/gfx.fnl b/game/gfx.fnl index df3e431..54020dc 100644 --- a/game/gfx.fnl +++ b/game/gfx.fnl @@ -127,7 +127,7 @@ :