This commit is contained in:
~d6 2024-12-17 12:42:59 -05:00
parent 4779ca7a7c
commit 9300fc5c47
2 changed files with 59 additions and 17 deletions

0
README.md Normal file
View File

View File

@ -60,14 +60,6 @@
&vect $2 &x $2 &y $2 &state $1 &pad1 $1
&pad2 $2 &scrollx $2 &scrolly $2 &pad3 $2 ]
( |a0 @File1 [ )
( &vect $2 &ok $2 &stat $2 &del $1 &append $1 )
( &name $2 &len $2 &r $2 &w $2 ] )
( |b0 @File2 [ )
( &vect $2 &ok $2 &stat $2 &del $1 &append $1 )
( &name $2 &len $2 &r $2 &w $2 ] )
|c0 @DateTime [
&year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1
&doty $2 &isdst $1 &pad $5 ]
@ -93,6 +85,11 @@
;on-mouse .Mouse/vect DEO2
;on-controller .Controller/vect DEO2
;on-stdin .Console/vect DEO2
( FIXME ) save-scan-time
( 320x256 resolution )
#0140 .Screen/w DEO2 #0100 .Screen/h DEO2 draw-ui
BRK
@ -103,12 +100,30 @@
@on-stdin ( -> BRK )
.Console/stdin DEI #0a EQU ?on-newline
.Console/stdin DEI ;buffer/ptr LDA2 STA
;buffer/ptr LDA2k INC2 SWP2 STA2 BRK
.Console/stdin DEI save-char BRK
@on-newline ( -> BRK )
( TODO: do something )
reset-buffer BRK
#00 save-char ;buffer readln reset-buffer BRK
@readln ( s* -> )
LIT "? .Console/stdout DEO
minutes-since-scan LIT "0 ADD .Console/stdout DEO
#0a .Console/stdout DEO
save-scan-time
LIT "< .Console/stdout DEO .Console/stdout !println
@sendln ( s* -> )
LIT "> .Console/stdout DEO
DUP2 .Console/stdout println
.Console/proc-put !println
@println ( s* d^ -> )
STH &loop LDAk ?{ POP2 #0a STHr DEO JMP2r } LDAk STHkr DEO INC2 !&loop
@save-char ( c^ -> )
;buffer/ptr LDA2 STA
;buffer/ptr LDA2k INC2 SWP2 STA2
JMP2r
@reset-buffer ( -> )
;buffer ;buffer/ptr STA2 JMP2r
@ -275,10 +290,24 @@
STH2kr STA INC2 INC2 INC2r ( buf+2* [dst+1*] ; dst<-byte )
LDAk #20 EQU ?{ INC2 !&do } POP2 STH2r JMP2r ( buf+k* [dst+1*] )
( last scan: "yyyy-mm-dd hh:mm" 16 chars )
@save-scan-time ( -> )
.DateTime/year DEI2 .scan-year STZ2
.DateTime/month DEI .scan-month STZ
.DateTime/day DEI .scan-day STZ
.DateTime/hour DEI .scan-hour STZ
.DateTime/minute DEI .scan-minute STZ
JMP2r
( lower bound on time since last scan; ignores hours/days/etc. )
@minutes-since-scan ( -> min^ )
.DateTime/minute DEI .scan-minute LDZ
LTHk ?&wrap SUB JMP2r
&wrap SUB #c4 SUB JMP2r
@hexdigit ( c^ -> h^ )
LIT "0 SUB DUP #0a LTH ?{ #27 SUB } JMP2r
( > scan_results )
( bssid / frequency / signal level / flags / ssid )
( 70:73:cb:b8:ce:b7 2437 -60 [WPA2-PSK-CCMP][ESS] timecrimes )
@ -286,6 +315,7 @@
( dBm to percentage mapping )
( see https://www.intuitibits.com/2016/03/23/dbm-to-percent-conversion/ )
@table
64 ( -0: 100% )
64 64 64 64 64 64 64 64 64 64 ( -1 to -10 dBm: 100% )
64 64 64 64 64 64 64 64 64 64 ( -11 to -20 dBm: 100% )
63 63 63 62 62 62 61 61 60 60 ( -21 to -30 dBm: 99 to 96% )
@ -299,6 +329,9 @@
@tiles ~tiles.tal
( buffer one line of input, until "\n"; up to 512 bytes )
@buffer [ $200 &ptr =buffer ]
( scan-line [43 bytes]: )
( - bssid, 6 bytes )
( - frequency, 2 bytes )
@ -310,8 +343,17 @@
( + 0x03 other )
( - ssid, 33 bytes )
( buffer one line of input, until "\n"; up to 512 bytes )
@buffer [ $200 &ptr :buffer ]
( store results, 43 bytes per entry; 11008 bytes means 256 entries )
( @networks [ $2b00 &ptr =networks ] )
$2100
@networks
1122 3344 5566 ff 30 02 "RadioX $1b
3e42 9f11 6733 ee 35 02 "interzone $18
3e42 9f11 6733 ee 40 02 "bee_happy_ $17
3e42 9f11 6733 ee 33 02 "DuckHunt $19
3e42 9f11 6733 ee 45 02 "LINKSYS6672 $16
3e42 9f11 6733 ee 50 02 "Public $1b
3e42 9f11 6733 ee 55 02 "Q-bert $1b
3e42 9f11 6733 ee 70 02 "xyzzy $1c
( store results, 33 bytes per entry; 8448 bytes means 256 entries )
@networks [ $2100 &ptr :networks ]
&ptr =networks ( FIXME )