improve statusbar

main
Jeremy Penner 2023-10-12 23:00:42 -04:00
parent a5c95a04b4
commit f00bd76589
6 changed files with 47 additions and 11 deletions

Binary file not shown.

View File

@ -54,10 +54,34 @@ array dtmf-row 697 freq>div , 770 freq>div , 852 freq>div , 941 freq>div ,
300 fullduplex ;
( statusbar words )
var connected-time
var connected-site
s" DISCONNECTED" const DISCONNECTED
DISCONNECTED var, status
var status-timer
: start-status-timer ticks status-timer ! ;
: stop-status-timer 0 status-timer ! ;
: space-to ( x -- ) textx - sp draw-hrepeat ;
: .digit ( v -- ) [ key 0 lit ] + draw-char ;
: .2digit ( v -- ) 10 /mod swap 10 % .digit .digit ;
: .: [ key : lit ] draw-char ;
: draw-status-timer
status-timer @ dup if ticks swap - 18 / 60 /mod swap 60 /mod swap
.2digit .: .2digit .: .2digit else drop then ;
: draw-status
magenta bg! white fg! 0 0 textxy!
1 space-to status @ draw-text
55 space-to draw-status-timer
65 space-to s" | ESC for menu" draw-text
80 space-to ;
: init-statusbar
:| begin textpos @ textpen @ draw-status textpen ! textpos ! suspend again |;
spawn-task drop ;
( terminal words )
: sleep-key begin key-waiting? not while suspend repeat wait-key ;
: fixcursor
texty 24 - dup 0 > if times each 1 24 scrollup next 24 texty! else drop then
texty 8 << textx | movecursor ;
@ -74,9 +98,7 @@ array rick-welcome-rle
{ : lines-of pagew 2* * take ;
s" rickclub.bin" open filebytes 18 lines-of encode-rle }
: xmit-screen ( rle -- ) 0 0 textxy! rle-decode each
i 8 >> textpen ! i emit
next ;
: xmit-screen ( rle -- ) rle-decode each i 8 >> textpen ! i emit next ;
: rick-welcome rick-welcome-rle xmit-screen ;
@ -155,17 +177,20 @@ var curr-logobit
logobit-count 3 * times each draw-logo 10 sleep-csec nextlogo next ;
: splash
blue bg! lgray fg! 32 fill-page lcyan fg! animate-logo
blue bg! lgray fg! sp fill-page lcyan fg! animate-logo
nl nl 15 textx! lblue bg! lred fg! s" Unregistered version" xmit
blue bg! lcyan fg! s" - you have used 13246 / 30" xmit nl
15 textx! s" days of your limited trial!" xmit nl nl 200 sleep-csec
lgray fg! ;
: login black bg! white fg!
begin wait-key nl key>scan %esc != while s" LOGON PLEASE: " xmit repeat ;
begin sleep-key nl key>scan %esc != while s" LOGON PLEASE: " xmit repeat ;
: go splash 0 15 textxy!
s" 5551212" connect s" CONNECT 57600" xmit nl rick-welcome login ;
: go init-statusbar splash 0 15 textxy!
s" 5551212" connect
s" CONNECTED AT 57600 BAUD" status ! start-status-timer
s" CONNECT 57600" xmit nl
rick-welcome login ;
' go ' main redefine

View File

@ -10,6 +10,16 @@
PUSH AX
NEXT
:asm key-waiting? ( -- f )
MOV AH 1 #
INT 0x16 #
JNZ 0 @>
PUSH FALSE
NEXT
0 <:
PUSH TRUE
NEXT
: key>scan 8 >> ;
: key>ch 0xff & ;
: scanup 0x80 | ;

View File

@ -196,9 +196,10 @@ var boxstyle
MOV DS BX
NEXT
32 const sp
: scrollup ( y ybottom -- )
>r r@ over - pagew * swap
pagew 2* * textpage @ +
dup pagew 2* + <rot SCREENSEG segwordmove
textpos @ 0 <r textxy! pagew 32 draw-hrepeat textpos ! ;
textpos @ 0 <r textxy! pagew sp draw-hrepeat textpos ! ;

Binary file not shown.

Binary file not shown.