I'm a cat

This commit is contained in:
Jeremy Penner 2021-04-18 00:09:31 -04:00
parent 97bf626225
commit 7e5b50dcba
6 changed files with 10 additions and 8 deletions

BIN
8Bitsy.dsk Normal file

Binary file not shown.

View file

@ -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]])

View file

@ -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]

View file

@ -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"))

View file

@ -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]

View file

@ -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