diff --git a/8Bitsy.dsk b/8Bitsy.dsk new file mode 100644 index 0000000..a28f5d1 Binary files /dev/null and b/8Bitsy.dsk differ diff --git a/asm/tape.fnl b/asm/tape.fnl index 2940f25..7a1b3c8 100644 --- a/asm/tape.fnl +++ b/asm/tape.fnl @@ -25,7 +25,7 @@ (table.insert block :nextline) block) (fn prg.dat-parser.basic [lines] - (local block (prg:new-block)) + (local block (prg.new-block)) (each [_ line (ipairs (lume.slice lines 2))] (prg:parse-dats block [(parse-line line)])) (prg:parse-dats block [[:dw 0]]) diff --git a/asm/vm.fnl b/asm/vm.fnl index 12da712..a54a2fd 100644 --- a/asm/vm.fnl +++ b/asm/vm.fnl @@ -38,7 +38,7 @@ (fn install-vm-parser [prg] (fn prg.dat-parser.vm [bytecodes] - (local block (prg:new-block)) + (local block (prg.new-block)) (each [_ bytecode (ipairs (lume.slice bytecodes 2))] (if (= (type bytecode) :number) @@ -391,8 +391,8 @@ (vm:def :$doconst ; usage: [jsr :$doconst] followed by two bytes (vm:reserve) [:pla] [:sta vm.W] [:pla] [:sta vm.WH] - [:ldy 1] [:lda [vm.W] :y] [:sta vm.TOP] - [:iny] [:lda [vm.W] :y] [:sta vm.TOPH]) + [:ldy 1] [:lda [vm.W] :y] [:sta vm.TOP :x] + [:iny] [:lda [vm.W] :y] [:sta vm.TOPH :x]) (fn vm.const [self name val] (self.code:append name [:jsr :$doconst] diff --git a/game/content.fnl b/game/content.fnl index d5b77ca..8f66f33 100644 --- a/game/content.fnl +++ b/game/content.fnl @@ -2,5 +2,5 @@ (local {: vm : say : deflevel} (require :game.defs)) (deflevel "game/map1.json" :map1) -(vm:word :cat (say :pcat "I'M A CAT")) +(vm:word :cat (say :cat "I'M A CAT")) diff --git a/game/init.fnl b/game/init.fnl index 768f0e0..827c7a3 100644 --- a/game/init.fnl +++ b/game/init.fnl @@ -15,9 +15,10 @@ (tile.appendtiles org.code) (org.code:append [:align 0x100] :font) (tile.appendgfx org.code (tile.loadgfx tile.fn-font)) +(tile.append-portraitwords vm) (vm:var :tick-count) -(vm:word :handle-key :tick :read-key :dup :cheat-key :player-key :hide-footer) +(vm:word :handle-key :tick :read-key :player-key :hide-footer) (vm:word :tick :map-specific-tick :tick-count :get 1 :+ :tick-count :set :player-redraw :rnd :drop) (vm:var :next-level 0) @@ -30,6 +31,8 @@ :map-specific-load :full-redraw) +(util.reload :game.content) + (vm.code:append :main [:jsr :reset] [:jsr :interpret] diff --git a/game/player.fnl b/game/player.fnl index 45d30e6..2c9cad4 100644 --- a/game/player.fnl +++ b/game/player.fnl @@ -62,14 +62,13 @@ (vm:word :two-frame :tick-count :get 0x1f :& 0x10 :<) (vm:word :player-tile ; -- ptile - :two-frame (vm:if [(itile :player-frame1)] [(itile :player-frame1)])) + (itile :player-frame1) :lookup-tile) (vm:word :flag-at? ; yx flag -- f :swap :itile-at :lookup-flags :&) (vm:word :player-key ; key -- (vm:ifchain - [:dup (string.byte " ") :=] [:drop :toggle-player] [:movement-dir :dup] [:player-yx :get :swap ; oldyx dir :try-move-player