esop

Essential Stack-Operated Phone (concept)
git clone git://git.luxferre.top/esop.git
Log | Files | Refs | README | LICENSE

commit 66e23c966d810f4c15b52f5af088f2f79e283a2b
parent 6cd8c459bbca435048ce6dceb8f56572be83a68d
Author: Luxferre <3335173-suborg@users.noreply.gitlab.com>
Date:   Fri, 29 Jul 2022 12:55:53 +0300

continue fixing inputs

Diffstat:
Mtal-lib/esop-lib.tal | 9++++++++-
Mtal-lib/font.tal | 12+++++++++---
Mweb/esop-ext.js | 4++--
3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/tal-lib/esop-lib.tal b/tal-lib/esop-lib.tal @@ -7,6 +7,7 @@ %SETSCRVEC { .Control/framevec DEO2 } %INKEY { .Control/io DEI2 } %PXL { .Control/io DEO2 } +%PXLk { .Control/io DEO2k } %RND { .Control/random DEI } %STACKTRACE { #ff .Control/random DEO } %DEVSTAT { .Control/status DEI } @@ -16,8 +17,11 @@ ( some syscall macros ) %HLT { #1f SYS } +( val -- ) %DBG { #20 SYS SYS } +( val -- val ) %DBGBYTE { DUP DBG } +( val* -- val* ) %DBGSHORT { DUP2 SWP DBG DBG } ( input helper macros ) @@ -41,7 +45,7 @@ ( jump to label or subroutine if a particular key is pressed ) ( label* keymask* -- ) -%JMPKEY { INKEY AND2 SWP2 JCN2 } +%JMPKEY { INKEY AND2 ORA DBGBYTE ROT ROT JCN2 } %JSRKEY { INKEY AND2 SWP2 JSR2 } ( misc macros ) @@ -49,3 +53,6 @@ ( byte to short ) %BTS { #00 SWP } +( decrement ) +%DEC { #01 SUB } + diff --git a/tal-lib/font.tal b/tal-lib/font.tal @@ -9,12 +9,18 @@ BRK @on-frame - DUP2 PXL - ,&adv KP-A JMPKEY + PXLk + ;&adv KP-A JMPKEY + ;&back KP-B JMPKEY BRK &adv + #fa DBG INC -BRK + BRK + &back + #fb DBG + DEC + BRK @putc diff --git a/web/esop-ext.js b/web/esop-ext.js @@ -120,7 +120,7 @@ function ESOPExtensions() { var k = e.key if(k in livemap) { var keyval = livemap[k], - portnum = keyval>7 ? 3 : 2, + portnum = keyval>7 ? 2 : 3, bitmask = (~(1<<(keyval&7)))&255 vm.setdev(portnum, vm.getdev(portnum) & bitmask) } @@ -175,7 +175,7 @@ function ESOPExtensions() { function runSyscall(vm, buf) { var call = buf[0] if(call === 0x00) //simulate writing a byte to the debug port - console.log(('[DBG] 00' + buf[1].toString(16)).slice(-2)) + console.log('[DBG] ' + ('00' + buf[1].toString(16)).slice(-2)) else if(call === 0x06) { //read datetime info into 5 bytes starting from addr //not very optimal but a future-proof approach for now var tm = ('00' + (0|(Date.now()/1000)).toString(16)).slice(-10).match(/.{2}/g).map(function(x){return parseInt(x, 16)}),