Extended write hooks and debugged sound

This commit is contained in:
Luxferre
2022-07-28 22:55:10 +03:00
parent 1d68fc8d4a
commit 61018ab06d
5 changed files with 82 additions and 30 deletions
+46
View File
@@ -1,9 +1,55 @@
( ESOP stdlib )
|00 @Control [ &framevec $2 &input $2 &random $1 &status $1 &sound $1 &syscall $1 ]
( byte to short )
( x -- 00 x )
%BTS { #00 SWP }
( screen is #54 x #30 )
%SETSCRVEC { .Control/framevec DEO2 }
%RND { .Control/random DEI }
%STACKTRACE { #ff .Control/random DEO }
%SYS { .Control/syscall DEO }
%INKEY { .Control/input DEI2 }
%DBG { #20 SYS SYS }
%SND { .Control/sound DEO }
( x y -- ref* )
%COORD { BTS ROT BTS SWP2 #0054 MUL2 ADD2 }
( x y -- bitshift byteptr* )
%PXLOFFSET { COORD DUP2 #03 SFT2 DUP2 #30 SFT2 ROT2 SWP2 SUB2 SWP POP ROT #fe00 ADD2 }
( x y -- )
%PXL { PXLOFFSET DUP2 LDA #01 ROT #40 SFT SFT ORA ROT ROT STA }
( subtract #20 from the ASCII code and you get the offset from the nanofont label )
%CHAR-TO-NF { #20 SUB ;nanofont ADD }
|0100
#03 #02 #01
ROT
DBG DBG DBG
;on-frame SETSCRVEC
#30
BRK
@on-frame
DUP SND
INC
( #10 #12 PXL )
BRK
@putc
JMP2r
@draw-str ( s* -> )
&loop LDAk #00 EQU ,&eof JCN ( did we reach \0 ? )
LDAk ;putc JSR2 INC2 ,&loop JMP ( no so emit a char and repeat )
&eof POP2 JMP2r ( yes so return )
( nanofont glyphs for ESOP, courtesy of Michaelangel007 )