esop-lib-macro.tal (1704B)
1 ( ESOP stdlib, macro part ) 2 ( by Luxferre, 2022, public domain ) 3 4 |00 @Control [ &framevec $2 &io $2 &random $1 &status $1 &sound $1 &syscall $1 ] 5 6 ( zero-page pseudo-vector to only be used with DATETIME-COMPAT macro ) 7 |c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &dst $1 ] 8 9 ( control block macros ) 10 11 %SETSCRVEC { .Control/framevec DEO2 } 12 %INKEY { .Control/io DEI2 } 13 %PXL { .Control/io DEO2 } 14 %PXLk { DUP2 PXL } 15 %RND { .Control/random DEI } 16 %STACKTRACE { #ff .Control/random DEO } 17 %DEVSTAT { .Control/status DEI } 18 %SND { .Control/sound DEO } 19 %SYS { .Control/syscall DEO } 20 21 ( some syscall macros ) 22 23 %HLT { #1f SYS } 24 ( val -- ) 25 %DBG { #20 SYS SYS } 26 ( val -- val ) 27 %DBGBYTE { DUP DBG } 28 ( val* -- val* ) 29 %DBGSHORT { DUP2 SWP DBG DBG } 30 ( addr* -- addr* ) 31 %DATETIME { DUP2 #46 SYS SWP SYS SYS } 32 ( load date and time into #00c0 similarly to Varvara or SPARTA specs ) 33 %DATETIME-COMPAT { #c000 #46 SYS SYS SYS } 34 35 ( input helper macros ) 36 37 %KP-0 { #0001 } 38 %KP-1 { #0002 } 39 %KP-2 { #0004 } 40 %KP-3 { #0008 } 41 %KP-4 { #0010 } 42 %KP-5 { #0020 } 43 %KP-6 { #0040 } 44 %KP-7 { #0080 } 45 %KP-8 { #0100 } 46 %KP-9 { #0200 } 47 %KP-A { #0400 } 48 %KP-B { #0800 } 49 %KP-C { #1000 } 50 %KP-D { #2000 } 51 %KP-STAR { #4000 } 52 %KP-HASH { #8000 } 53 54 ( jump to label or subroutine if a particular key is pressed ) 55 ( label* keymask* -- ) 56 %JMPKEY { INKEY AND2 ORA ROT ROT JCN2 } 57 %JSRKEY { INKEY AND2 SWP2 JSR2 } 58 59 ( misc macros ) 60 61 ( byte to short ) 62 %BTS { #00 SWP } 63 64 ( decrement ) 65 %DEC { #01 SUB } 66 67 ( get the bit or the nibble of a specific number ) 68 ( val bitnum -- bit ) 69 %GETBIT { SFT #01 AND } 70 ( val* bitnum -- bit ) 71 %GETBIT2 { SFT2 #0001 AND2 NIP } 72 ( val* nibnum -- nibble ) 73 %GETNIBBLE { #20 SFT SFT2 NIP #0f AND } 74