uxn/projects/software/hypervisor.tal

93 lines
1.8 KiB
Tal
Raw Normal View History

2022-01-05 23:44:33 -05:00
( launcher )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
2022-01-06 00:18:46 -05:00
%AUTO-X { #01 .Screen/auto DEO }
%AUTO-Y { #02 .Screen/auto DEO }
2022-01-05 23:44:33 -05:00
%AUTO-YADDR { #06 .Screen/auto DEO }
2022-01-06 00:18:46 -05:00
%RTN { JMP2r }
%2// { #01 SFT2 }
2022-01-05 23:44:33 -05:00
( devices )
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
( variables )
|0000
( init )
|0100 ( -> )
2022-01-06 00:18:46 -05:00
;draw-cross JSR2
2022-01-05 23:44:33 -05:00
AUTO-YADDR
#0010 #0000
&wst
2022-01-06 00:18:46 -05:00
( working stack )
#0010 .Screen/y DEO2
DUP2 #0018 ** #0010 ++ .Screen/x DEO2
DUP #fe00 LDA ( ptr ) EQU #41 + STH
2022-01-05 23:44:33 -05:00
DUP2 #fe01 ++ LDA STHr ;draw-hex JSR2
2022-01-06 00:18:46 -05:00
( return stack )
#0028 .Screen/y DEO2
DUP2 #0018 ** #0010 ++ .Screen/x DEO2
DUP #ff00 LDA ( ptr ) EQU #41 + STH
DUP2 #ff01 ++ LDA STHr ;draw-hex JSR2
2022-01-05 23:44:33 -05:00
INC2 GTH2k ,&wst JCN
POP2 POP2
2022-01-06 00:18:46 -05:00
BRK
2022-01-05 23:44:33 -05:00
2022-01-06 00:18:46 -05:00
@draw-cross ( -- )
( ver )
AUTO-Y
#0000 .Screen/y DEO2
.Screen/width DEI2 2// .Screen/x DEO2
.Screen/height DEI2 #0000
&ver
#43 .Screen/pixel DEO
.Screen/y DEI2k INC2 ROT DEO2
INC2 GTH2k ,&ver JCN
2022-01-05 23:44:33 -05:00
POP2 POP2
2022-01-06 00:18:46 -05:00
( hor )
AUTO-X
#0000 .Screen/x DEO2
.Screen/height DEI2 2// .Screen/y DEO2
.Screen/width DEI2 #0000
&hor
#43 .Screen/pixel DEO
.Screen/x DEI2k INC2 ROT DEO2
INC2 GTH2k ,&hor JCN
POP2 POP2
RTN
2022-01-05 23:44:33 -05:00
@draw-hex ( byte color -- )
STH
2022-01-06 00:18:46 -05:00
DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR
#0f AND ,&parse JSR STHr ,draw-char JSR
2022-01-05 23:44:33 -05:00
RTN
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r
&above #57 ADD JMP2r
@draw-char ( char color -- )
SWP
[ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2
.Screen/sprite DEOk DEO
2022-01-06 00:18:46 -05:00
.Screen/x DEI2k #0008 ++ ROT DEO2
.Screen/y DEI2k #0010 -- ROT DEO2
2022-01-05 23:44:33 -05:00
JMP2r
2022-01-06 00:18:46 -05:00
~projects/assets/msx01x02.tal