Offset rm loading
This commit is contained in:
parent
a0c763c248
commit
83141de319
|
@ -7,10 +7,10 @@ LIN="uxncli $HOME/roms/uxnlin.rom"
|
||||||
SRC="${ID}.tal"
|
SRC="${ID}.tal"
|
||||||
DST="${ID}.rom"
|
DST="${ID}.rom"
|
||||||
CPY="$HOME/roms"
|
CPY="$HOME/roms"
|
||||||
ARG="opctest.rom"
|
ARG="hello.rom"
|
||||||
|
|
||||||
cp ../opctest/opctest.tal .
|
|
||||||
uxnasm opctest.tal opctest.rom
|
uxnasm opctest.tal opctest.rom
|
||||||
|
uxnasm hello.tal hello.rom
|
||||||
|
|
||||||
if [[ "$*" == *"--lint"* ]]
|
if [[ "$*" == *"--lint"* ]]
|
||||||
then
|
then
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
|0100
|
||||||
|
|
||||||
|
@program
|
||||||
|
|
||||||
|
;hello-word
|
||||||
|
&while ( -- )
|
||||||
|
LDAk #18 DEO
|
||||||
|
INC2 LDAk ?&while
|
||||||
|
POP2 #010f DEO
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@hello-word
|
||||||
|
"Hello 20 "Uxn! 0a00
|
||||||
|
|
|
@ -0,0 +1,377 @@
|
||||||
|
( Opcode Tester )
|
||||||
|
|
||||||
|
|0013
|
||||||
|
|
||||||
|
@Zeropage &byte $1 &short $2
|
||||||
|
|
||||||
|
|0100
|
||||||
|
|
||||||
|
( part 1
|
||||||
|
> LIT2: Puts a short on the stack
|
||||||
|
> #18 DEO: Write a letter in terminal )
|
||||||
|
|
||||||
|
LIT2 "kO #18 DEO #18 DEO #0a18 DEO
|
||||||
|
|
||||||
|
( part 2
|
||||||
|
> LITr: Put a byte on return stack
|
||||||
|
> LIT: Puts a byte on the stack
|
||||||
|
> STH: Move a byte from working stack to return stack
|
||||||
|
> STH2r: Move a short from return stack to working stack )
|
||||||
|
|
||||||
|
LITr "k LIT "O STH STH2r #18 DEO #18 DEO #0a18 DEO
|
||||||
|
|
||||||
|
( part 3
|
||||||
|
> LIT2r: Put a short on return stack
|
||||||
|
> DUP: Duplicate byte
|
||||||
|
> ADDr: Add bytes on return stack )
|
||||||
|
|
||||||
|
LIT2r "k 4d #01 DUP STH ADDr STH ADDr STH2r #18 DEO #18 DEO #0a18 DEO
|
||||||
|
|
||||||
|
( part 4
|
||||||
|
> JSI: Subroutine to relative absolute address
|
||||||
|
> JMP2r: Jumps to absolute address on return stack )
|
||||||
|
#010f DEO
|
||||||
|
|
||||||
|
BRK
|
||||||
|
subroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
( part 5
|
||||||
|
> POP2: Removes a short from the stack
|
||||||
|
> INC2: Increments short on stack
|
||||||
|
> LDAk: Non-destructive load byte from absolute address
|
||||||
|
> JCI: Conditional subroutine to relative absolute address )
|
||||||
|
|
||||||
|
;Dict/ok pstr #0a18 DEO
|
||||||
|
|
||||||
|
( part 6
|
||||||
|
> GTH2k: Non-destructive greater-than short
|
||||||
|
> LDA2k: Non-destructive load short from absolute address
|
||||||
|
> STA2: Store short at absolute address )
|
||||||
|
|
||||||
|
LIT2r 0000
|
||||||
|
;tests/end ;tests
|
||||||
|
&l
|
||||||
|
run-test STH ADDr
|
||||||
|
INC2 INC2 GTH2k ?&l
|
||||||
|
POP2 POP2
|
||||||
|
STH2r ;Dict/done pstr
|
||||||
|
|
||||||
|
( halt )
|
||||||
|
|
||||||
|
#010f DEO
|
||||||
|
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@run-test ( addr* -- addr* f )
|
||||||
|
|
||||||
|
LDA2k JSR2 DUP ?&pass
|
||||||
|
;Dict/failed pstr
|
||||||
|
[ LIT2 &name $2 ] pstr #0a18 DEO JMP2r
|
||||||
|
&pass
|
||||||
|
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@set ( name* -- f )
|
||||||
|
|
||||||
|
;run-test/name STA2 #01
|
||||||
|
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@pstr ( str* -- )
|
||||||
|
|
||||||
|
LDAk ?&w POP2 JMP2r
|
||||||
|
&w LDAk #18 DEO INC2 LDAk ?&w
|
||||||
|
POP2
|
||||||
|
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@tests
|
||||||
|
=op-equ [
|
||||||
|
=op-equ/a =op-equ/b =op-equ/c =op-equ/d
|
||||||
|
=op-equ/e =op-equ/f =op-equ/g =op-equ/h ]
|
||||||
|
=op-neq [
|
||||||
|
=op-neq/a =op-neq/b =op-neq/c =op-neq/d
|
||||||
|
=op-neq/e =op-neq/f =op-neq/g =op-neq/h ]
|
||||||
|
=op-gth [
|
||||||
|
=op-gth/a =op-gth/b =op-gth/c =op-gth/d
|
||||||
|
=op-gth/e =op-gth/f =op-gth/g =op-gth/h ]
|
||||||
|
=op-lth [
|
||||||
|
=op-lth/a =op-lth/b =op-lth/c =op-lth/d
|
||||||
|
=op-lth/e =op-lth/f =op-lth/g =op-lth/h ]
|
||||||
|
=op-add [
|
||||||
|
=op-add/a =op-add/b =op-add/c =op-add/d
|
||||||
|
=op-add/e =op-add/f =op-add/g =op-add/h ]
|
||||||
|
=op-sub [
|
||||||
|
=op-sub/a =op-sub/b =op-sub/c =op-sub/d
|
||||||
|
=op-sub/e =op-sub/f =op-sub/g =op-sub/h ]
|
||||||
|
=op-mul [
|
||||||
|
=op-mul/a =op-mul/b =op-mul/c =op-mul/d
|
||||||
|
=op-mul/e =op-mul/f =op-mul/g =op-mul/h ]
|
||||||
|
=op-div [
|
||||||
|
=op-div/a =op-div/b =op-div/c =op-div/d
|
||||||
|
=op-div/e =op-div/f =op-div/g =op-div/h ]
|
||||||
|
=op-inc [
|
||||||
|
=op-inc/a =op-inc/b =op-inc/c =op-inc/d
|
||||||
|
=op-inc/e =op-inc/f =op-inc/g =op-inc/h ]
|
||||||
|
=op-pop [
|
||||||
|
=op-pop/a =op-pop/b =op-pop/c =op-pop/d
|
||||||
|
=op-pop/e =op-pop/f =op-pop/g =op-pop/h ]
|
||||||
|
=op-dup [
|
||||||
|
=op-dup/a =op-dup/b ]
|
||||||
|
=op-nip [
|
||||||
|
=op-nip/a =op-nip/b =op-nip/c =op-nip/d ]
|
||||||
|
=op-swp [
|
||||||
|
=op-swp/a =op-swp/b ]
|
||||||
|
=op-ovr [
|
||||||
|
=op-ovr/a =op-ovr/b ]
|
||||||
|
=op-rot [
|
||||||
|
=op-rot/a =op-rot/b ]
|
||||||
|
=op-and [
|
||||||
|
=op-and/a =op-and/b =op-and/c =op-and/d
|
||||||
|
=op-and/e =op-and/f =op-and/g =op-and/h ]
|
||||||
|
=op-ora [
|
||||||
|
=op-ora/a =op-ora/b =op-ora/c =op-ora/d
|
||||||
|
=op-ora/e =op-ora/f =op-ora/g =op-ora/h ]
|
||||||
|
=op-eor [
|
||||||
|
=op-eor/a =op-eor/b =op-eor/c =op-eor/d
|
||||||
|
=op-eor/e =op-eor/f =op-eor/g =op-eor/h ]
|
||||||
|
=op-sft [
|
||||||
|
=op-sft/a =op-sft/b =op-sft/c =op-sft/d
|
||||||
|
=op-sft/e =op-sft/f =op-sft/g =op-sft/h ]
|
||||||
|
=op-stz [
|
||||||
|
=op-stz/a =op-stz/b =op-stz/c =op-stz/d ]
|
||||||
|
=op-str [
|
||||||
|
=op-str/a =op-str/b =op-str/c =op-str/d ]
|
||||||
|
=op-sta [
|
||||||
|
=op-sta/a =op-sta/b =op-sta/c =op-sta/d ]
|
||||||
|
=op-jmp [
|
||||||
|
=op-jmp/a =op-jmp/b ]
|
||||||
|
=op-jcn [
|
||||||
|
=op-jcn/a =op-jcn/b =op-jcn/c =op-jcn/d ]
|
||||||
|
=op-jsr [
|
||||||
|
=op-jsr/a =op-jsr/b ]
|
||||||
|
=op-sth [
|
||||||
|
=op-sth/a =op-sth/b ]
|
||||||
|
=op-jci [
|
||||||
|
=op-jci/a =op-jci/b =op-jci/c ]
|
||||||
|
=op-jmi [
|
||||||
|
=op-jmi/a ]
|
||||||
|
=op-jsi [
|
||||||
|
=op-jsi/a =op-jsi/b ]
|
||||||
|
&end
|
||||||
|
|
||||||
|
@op-equ ;Dict/equ !set
|
||||||
|
&a #f8 #f8 EQU [ #01 ] EQU JMP2r
|
||||||
|
&b #01 #01 EQU [ #01 ] EQU JMP2r
|
||||||
|
&c #f8 #01 EQU [ #00 ] EQU JMP2r
|
||||||
|
&d #00 #ff EQU [ #00 ] EQU JMP2r
|
||||||
|
&e #f801 #f801 EQU2 [ #01 ] EQU JMP2r
|
||||||
|
&f #01f8 #01f8 EQU2 [ #01 ] EQU JMP2r
|
||||||
|
&g #f801 #01f8 EQU2 [ #00 ] EQU JMP2r ( HERE )
|
||||||
|
&h #01f8 #f801 EQU2 [ #00 ] EQU JMP2r
|
||||||
|
@op-neq ;Dict/neq !set
|
||||||
|
&a #f8 #f8 NEQ [ #00 ] EQU JMP2r
|
||||||
|
&b #01 #01 NEQ [ #00 ] EQU JMP2r
|
||||||
|
&c #f8 #01 NEQ [ #01 ] EQU JMP2r
|
||||||
|
&d #01 #f8 NEQ [ #01 ] EQU JMP2r
|
||||||
|
&e #f801 #f801 NEQ2 [ #00 ] EQU JMP2r
|
||||||
|
&f #01f8 #01f8 NEQ2 [ #00 ] EQU JMP2r
|
||||||
|
&g #f801 #01f8 NEQ2 [ #01 ] EQU JMP2r
|
||||||
|
&h #01f8 #f801 NEQ2 [ #01 ] EQU JMP2r
|
||||||
|
@op-gth ;Dict/gth !set
|
||||||
|
&a #f8 #f8 GTH [ #00 ] EQU JMP2r
|
||||||
|
&b #01 #01 GTH [ #00 ] EQU JMP2r
|
||||||
|
&c #f8 #01 GTH [ #01 ] EQU JMP2r
|
||||||
|
&d #01 #f8 GTH [ #00 ] EQU JMP2r
|
||||||
|
&e #f801 #f801 GTH2 [ #00 ] EQU JMP2r
|
||||||
|
&f #01f8 #01f8 GTH2 [ #00 ] EQU JMP2r
|
||||||
|
&g #f801 #01f8 GTH2 [ #01 ] EQU JMP2r
|
||||||
|
&h #01f8 #f801 GTH2 [ #00 ] EQU JMP2r
|
||||||
|
@op-lth ;Dict/lth !set
|
||||||
|
&a #f8 #f8 LTH [ #00 ] EQU JMP2r
|
||||||
|
&b #01 #01 LTH [ #00 ] EQU JMP2r
|
||||||
|
&c #f8 #01 LTH [ #00 ] EQU JMP2r
|
||||||
|
&d #01 #ff LTH [ #01 ] EQU JMP2r
|
||||||
|
&e #f801 #f801 LTH2 [ #00 ] EQU JMP2r
|
||||||
|
&f #01f8 #01f8 LTH2 [ #00 ] EQU JMP2r
|
||||||
|
&g #f801 #01f8 LTH2 [ #00 ] EQU JMP2r
|
||||||
|
&h #01f8 #f801 LTH2 [ #01 ] EQU JMP2r
|
||||||
|
@op-add ;Dict/add !set
|
||||||
|
&a #ff #00 ADD [ #ff ] EQU JMP2r
|
||||||
|
&b #01 #ff ADD [ #00 ] EQU JMP2r
|
||||||
|
&c #ff #ff ADD [ #fe ] EQU JMP2r
|
||||||
|
&d #12 #34 ADDk ADD ADD [ #8c ] EQU JMP2r
|
||||||
|
&e #ffff #0000 ADD2 [ #ffff ] EQU2 JMP2r
|
||||||
|
&f #0001 #ffff ADD2 [ #0000 ] EQU2 JMP2r
|
||||||
|
&g #ffff #ffff ADD2 [ #fffe ] EQU2 JMP2r
|
||||||
|
&h #fffe #ffff ADD2 [ #fffd ] EQU2 JMP2r
|
||||||
|
@op-sub ;Dict/sub !set
|
||||||
|
&a #ff #00 SUB [ #ff ] EQU JMP2r
|
||||||
|
&b #01 #ff SUB [ #02 ] EQU JMP2r
|
||||||
|
&c #ff #ff SUB [ #00 ] EQU JMP2r
|
||||||
|
&d #fe #ff SUB [ #ff ] EQU JMP2r
|
||||||
|
&e #ffff #0000 SUB2 [ #ffff ] EQU2 JMP2r
|
||||||
|
&f #0001 #ffff SUB2 [ #0002 ] EQU2 JMP2r
|
||||||
|
&g #ffff #ffff SUB2 [ #0000 ] EQU2 JMP2r
|
||||||
|
&h #fffe #ffff SUB2 [ #ffff ] EQU2 JMP2r
|
||||||
|
@op-mul ;Dict/mul !set
|
||||||
|
&a #00 #01 MUL [ #00 ] EQU JMP2r
|
||||||
|
&b #3f #e7 MUL [ #d9 ] EQU JMP2r
|
||||||
|
&c #37 #3f MUL [ #89 ] EQU JMP2r
|
||||||
|
&d #10 #02 MUL [ #20 ] EQU JMP2r
|
||||||
|
&e #1000 #0003 MUL2 [ #3000 ] EQU2 JMP2r
|
||||||
|
&f #abcd #1234 MUL2 [ #4fa4 ] EQU2 JMP2r
|
||||||
|
&g #8000 #0200 MUL2 [ #0000 ] EQU2 JMP2r
|
||||||
|
&h #2222 #0003 MUL2 [ #6666 ] EQU2 JMP2r
|
||||||
|
@op-div ;Dict/div !set
|
||||||
|
&a #10 #02 DIV [ #08 ] EQU JMP2r
|
||||||
|
&b #20 #20 DIV [ #01 ] EQU JMP2r
|
||||||
|
&c #34 #01 DIV [ #34 ] EQU JMP2r
|
||||||
|
&d #02 #ef DIV [ #00 ] EQU JMP2r
|
||||||
|
&e #1000 #0040 DIV2 [ #0040 ] EQU2 JMP2r
|
||||||
|
&f #abcd #1234 DIV2 [ #0009 ] EQU2 JMP2r
|
||||||
|
&g #8000 #0200 DIV2 [ #0040 ] EQU2 JMP2r
|
||||||
|
&h #2222 #0003 DIV2 [ #0b60 ] EQU2 JMP2r
|
||||||
|
@op-inc ;Dict/inc !set
|
||||||
|
&a #01 INC [ #02 ] EQU JMP2r
|
||||||
|
&b #ff INC [ #00 ] EQU JMP2r
|
||||||
|
&c #fe INC [ #ff ] EQU JMP2r
|
||||||
|
&d #00 INC [ #01 ] EQU JMP2r
|
||||||
|
&e #0001 INC2 [ #0002 ] EQU2 JMP2r
|
||||||
|
&f #ffff INC2 [ #0000 ] EQU2 JMP2r
|
||||||
|
&g #fffe INC2 [ #ffff ] EQU2 JMP2r
|
||||||
|
&h #0000 INC2 [ #0001 ] EQU2 JMP2r
|
||||||
|
@op-pop ;Dict/pop !set
|
||||||
|
&a #0a #0b POP [ #0a ] EQU JMP2r
|
||||||
|
&b #0a #0b #0c POP POP [ #0a ] EQU JMP2r
|
||||||
|
&c #0a #0b #0c ADD POP [ #0a ] EQU JMP2r
|
||||||
|
&d #0a #0b #0c POP ADD [ #15 ] EQU JMP2r
|
||||||
|
&e #0a0b #0c0d POP2 [ #0a0b ] EQU2 JMP2r
|
||||||
|
&f #0a0b #0c0d #0e0f POP2 POP2 [ #0a0b ] EQU2 JMP2r
|
||||||
|
&g #0a0b #0c0d #0e0f ADD2 POP2 [ #0a0b ] EQU2 JMP2r
|
||||||
|
&h #0a0b #0c0d #0e0f POP2 ADD2 [ #1618 ] EQU2 JMP2r
|
||||||
|
@op-dup ;Dict/dup !set
|
||||||
|
&a #0a #0b DUP ADD ADD [ #20 ] EQU JMP2r
|
||||||
|
&b #0a0b DUP2 ADD2 [ #1416 ] EQU2 JMP2r
|
||||||
|
@op-nip ;Dict/nip !set
|
||||||
|
&a #12 #34 #56 NIP ADD [ #68 ] EQU JMP2r
|
||||||
|
&b #12 #34 #56 NIPk ADD2 ADD [ #f2 ] EQU JMP2r
|
||||||
|
&c #1234 #5678 #9abc NIP2 ADD2 [ #acf0 ] EQU2 JMP2r
|
||||||
|
&d #1234 #5678 #9abc NIP2k ADD2 ADD2 ADD2 [ #9e24 ] EQU2 JMP2r
|
||||||
|
@op-swp ;Dict/swp !set
|
||||||
|
&a #02 #10 SWP DIV [ #08 ] EQU JMP2r
|
||||||
|
&b #0a0b #0c0d SWP2 NIP2 [ #0a0b ] EQU2 JMP2r
|
||||||
|
@op-ovr ;Dict/ovr !set
|
||||||
|
&a #02 #10 OVR DIV ADD [ #0a ] EQU JMP2r
|
||||||
|
&b #0a0b #0c0d OVR2 NIP2 ADD2 [ #1416 ] EQU2 JMP2r
|
||||||
|
@op-rot ;Dict/rot !set
|
||||||
|
&a #02 #04 #10 ROT DIV ADD [ #0c ] EQU JMP2r
|
||||||
|
&b #0a0b #0c0d #0c0f ROT2 ADD2 NIP2 [ #161a ] EQU2 JMP2r
|
||||||
|
@op-and ;Dict/and !set
|
||||||
|
&a #fc #3f AND [ #3c ] EQU JMP2r
|
||||||
|
&b #f0 #0f AND [ #00 ] EQU JMP2r
|
||||||
|
&c #ff #3c AND [ #3c ] EQU JMP2r
|
||||||
|
&d #02 #03 AND [ #02 ] EQU JMP2r
|
||||||
|
&e #f0f0 #00f0 AND2 [ #00f0 ] EQU2 JMP2r
|
||||||
|
&f #aaaa #5555 AND2 [ #0000 ] EQU2 JMP2r
|
||||||
|
&g #ffff #1234 AND2 [ #1234 ] EQU2 JMP2r
|
||||||
|
&h #abcd #0a0c AND2 [ #0a0c ] EQU2 JMP2r
|
||||||
|
@op-ora ;Dict/ora !set
|
||||||
|
&a #0f #f0 ORA [ #ff ] EQU JMP2r
|
||||||
|
&b #ab #cd ORA [ #ef ] EQU JMP2r
|
||||||
|
&c #12 #34 ORA [ #36 ] EQU JMP2r
|
||||||
|
&d #88 #10 ORA [ #98 ] EQU JMP2r
|
||||||
|
&e #0f0f #f0f0 ORA2 [ #ffff ] EQU2 JMP2r
|
||||||
|
&f #abab #cdcd ORA2 [ #efef ] EQU2 JMP2r
|
||||||
|
&g #1122 #1234 ORA2 [ #1336 ] EQU2 JMP2r
|
||||||
|
&h #8888 #1000 ORA2 [ #9888 ] EQU2 JMP2r
|
||||||
|
@op-eor ;Dict/eor !set
|
||||||
|
&a #00 #00 EOR [ #00 ] EQU JMP2r
|
||||||
|
&b #ff #00 EOR [ #ff ] EQU JMP2r
|
||||||
|
&c #aa #55 EOR [ #ff ] EQU JMP2r
|
||||||
|
&d #ff #ff EOR [ #00 ] EQU JMP2r
|
||||||
|
&e #ffff #ff00 EOR2 [ #00ff ] EQU2 JMP2r
|
||||||
|
&f #aaaa #5555 EOR2 [ #ffff ] EQU2 JMP2r
|
||||||
|
&g #1122 #1234 EOR2 [ #0316 ] EQU2 JMP2r
|
||||||
|
&h #8888 #1000 EOR2 [ #9888 ] EQU2 JMP2r
|
||||||
|
@op-sft ;Dict/sft !set
|
||||||
|
&a #ff #08 SFT [ #00 ] EQU JMP2r
|
||||||
|
&b #ff #e0 SFT [ #00 ] EQU JMP2r
|
||||||
|
&c #ff #11 SFT [ #fe ] EQU JMP2r
|
||||||
|
&d #ff #12 SFT [ #7e ] EQU JMP2r
|
||||||
|
&e #ffff #01 SFT2 [ #7fff ] EQU2 JMP2r
|
||||||
|
&f #ffff #70 SFT2 [ #ff80 ] EQU2 JMP2r
|
||||||
|
&g #ffff #7e SFT2 [ #0180 ] EQU2 JMP2r
|
||||||
|
&h #ffff #e3 SFT2 [ #c000 ] EQU2 JMP2r
|
||||||
|
@op-stz ;Dict/stz !set
|
||||||
|
&a #ab .Zeropage/byte STZ .Zeropage/byte LDZ [ #ab ] EQU JMP2r
|
||||||
|
&b #cd .Zeropage/byte STZ .Zeropage/byte LDZ [ #cd ] EQU JMP2r
|
||||||
|
&c #1234 .Zeropage/short STZ2 .Zeropage/short LDZ2 [ #1234 ] EQU2 JMP2r
|
||||||
|
&d #5678 .Zeropage/short STZ2 .Zeropage/short LDZ2 [ #5678 ] EQU2 JMP2r
|
||||||
|
@op-str ;Dict/str !set
|
||||||
|
[ LIT &before1 $1 ] [ LIT2 &before2 $2 ]
|
||||||
|
&a #22 ,&before1 STR ,&before1 LDR [ #22 ] EQU JMP2r
|
||||||
|
&b #ef ,&after1 STR ,&after1 LDR [ #ef ] EQU JMP2r
|
||||||
|
&c #1234 ,&before2 STR2 ,&before2 LDR2 [ #1234 ] EQU2 JMP2r
|
||||||
|
&d #5678 ,&after2 STR2 ,&after2 LDR2 [ #5678 ] EQU2 JMP2r
|
||||||
|
[ LIT &after1 $1 ] [ LIT2 &after2 $2 ]
|
||||||
|
@op-sta ;Dict/sta !set
|
||||||
|
&a #34 ;Absolute/byte STA ;Absolute/byte LDA [ #34 ] EQU JMP2r
|
||||||
|
&b #56 ;Absolute/byte STA ;Absolute/byte LDA [ #56 ] EQU JMP2r
|
||||||
|
&c #1234 ;Absolute/short STA2 ;Absolute/short LDA2 [ #1234 ] EQU2 JMP2r
|
||||||
|
&d #5678 ;Absolute/short STA2 ;Absolute/short LDA2 [ #5678 ] EQU2 JMP2r
|
||||||
|
@op-jmp ;Dict/jmp !set
|
||||||
|
&a #12 #34 ,&reljmp JMP SWP &reljmp POP [ #12 ] EQU JMP2r
|
||||||
|
&b #56 #78 ;&absjmp JMP2 SWP &absjmp POP [ #56 ] EQU JMP2r
|
||||||
|
@op-jcn ;Dict/jcn !set
|
||||||
|
&a #23 #01 ,&reljcn-y JCN INC &reljcn-y [ #23 ] EQU JMP2r
|
||||||
|
&b #23 #00 ,&reljcn-n JCN INC &reljcn-n [ #24 ] EQU JMP2r
|
||||||
|
&c #23 #01 ;&absjcn-y JCN2 INC &absjcn-y [ #23 ] EQU JMP2r
|
||||||
|
&d #23 #00 ;&absjcn-n JCN2 INC &absjcn-n [ #24 ] EQU JMP2r
|
||||||
|
@op-jsr ;Dict/jsr !set
|
||||||
|
&a #1234 #5678 ,&routine JSR [ #68ac ] EQU2 JMP2r
|
||||||
|
&b #12 #34 ;routine JSR2 [ #46 ] EQU JMP2r
|
||||||
|
&routine ADD2 JMP2r
|
||||||
|
@op-sth ;Dict/sth !set
|
||||||
|
&a #0a STH #0b STH ADDr STHr [ #15 ] EQU JMP2r
|
||||||
|
&b #000a STH2 #000b STH2 ADD2r STH2r [ #0015 ] EQU2 JMP2r
|
||||||
|
@op-jci ;Dict/jci !set
|
||||||
|
&before #01 JMP2r
|
||||||
|
&a #01 ?&skip-a #00 JMP2r &skip-a #01 JMP2r
|
||||||
|
&b #00 ?&skip-b #01 JMP2r &skip-b #00 JMP2r
|
||||||
|
&c #01 ?&before #00 JMP2r
|
||||||
|
@op-jmi ;Dict/jmi !set
|
||||||
|
&a !&skip-a #00 JMP2r &skip-a #01 JMP2r
|
||||||
|
@op-jsi ;Dict/jsi !set
|
||||||
|
&a #02 #04 routine #06 EQU JMP2r
|
||||||
|
&b ;&return special &return JMP2r
|
||||||
|
|
||||||
|
@special ( routine* -- f )
|
||||||
|
|
||||||
|
( test the stack order )
|
||||||
|
DUP2 STH2kr EQU2
|
||||||
|
ROT ROT DUP2r STHr STHr SWP EQU2 AND
|
||||||
|
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@routine ( a b -- c ) ADD JMP2r
|
||||||
|
@subroutine ( -- ) LIT2 "kO #18 DEO #18 DEO #0a18 DEO JMP2r
|
||||||
|
@Absolute &byte $1 &short $2
|
||||||
|
@phex ( short* -- ) SWP phex/b &b ( byte -- ) DUP #04 SFT phex/c &c ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r
|
||||||
|
|
||||||
|
@Dict [
|
||||||
|
&ok "Ok $1
|
||||||
|
&done "Tests 20 "Complete. 0a $1
|
||||||
|
&failed "-- 20 "failed: 20 $1
|
||||||
|
&equ "EQU $1 &neq "NEQ $1 >h "GTH $1 <h "LTH $1
|
||||||
|
&add "ADD $1 &sub "SUB $1 &mul "MUL $1 &div "DIV $1
|
||||||
|
&inc "INC $1 &pop "POP $1 &dup "DUP $1 &nip "NIP $1
|
||||||
|
&swp "SWP $1 &ovr "OVR $1 &rot "ROT $1
|
||||||
|
&and "AND $1 &ora "ORA $1 &eor "EOR $1 &sft "SFT $1
|
||||||
|
&stz "STZ $1 &str "STR $1 &sta "STA $1
|
||||||
|
&jmp "JMP $1 &jcn "JCN $1 &jsr "JSR $1 &sth "STH $1
|
||||||
|
&jmi "JMI $1 &jci "JCI $1 &jsi "JSI $1
|
||||||
|
]
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@on-ready ( -> )
|
@on-ready ( -> )
|
||||||
;src load-rom run #800f DEO
|
;src load-rom reset run #800f DEO
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
@load-rom ( filename* -- )
|
@load-rom ( filename* -- )
|
||||||
.File/name DEO2
|
.File/name DEO2
|
||||||
#fff0 ;rom SUB2 .File/length DEO2
|
#fff0 ;rom/reset SUB2 .File/length DEO2
|
||||||
;rom .File/read DEO2
|
;rom/reset .File/read DEO2
|
||||||
.File/success DEI2 #fff0 ;rom SUB2 EQU2 ?&err-overflow
|
.File/success DEI2 #fff0 ;rom/reset SUB2 EQU2 ?&err-overflow
|
||||||
.File/success DEI2 #0000 EQU2 ?&err-empty
|
.File/success DEI2 #0000 EQU2 ?&err-empty
|
||||||
JMP2r
|
JMP2r
|
||||||
&err-empty ( -- )
|
&err-empty ( -- )
|
||||||
|
@ -70,6 +70,7 @@
|
||||||
POP #19 DEO
|
POP #19 DEO
|
||||||
POP JMP2r &>no-err
|
POP JMP2r &>no-err
|
||||||
( | error )
|
( | error )
|
||||||
|
LIT "! #18 DEO
|
||||||
<phex>/b
|
<phex>/b
|
||||||
#2018 DEO
|
#2018 DEO
|
||||||
<phex>
|
<phex>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#0100 .uxn/pc STZ2
|
#0100 .uxn/pc STZ2
|
||||||
#0000 ;wst/ptr STA2
|
#0000 ;wst/ptr STA2
|
||||||
#0000 ;rst/ptr STA2
|
#0000 ;rst/ptr STA2
|
||||||
|
#0000 ;step/cycles STA2
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@step ( -- )
|
@step ( -- )
|
||||||
|
@ -235,5 +236,6 @@
|
||||||
|
|
||||||
@dev $100
|
@dev $100
|
||||||
|
|
||||||
@rom
|
@rom $100
|
||||||
|
&reset
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue