(m291) Messages OOP

This commit is contained in:
Devine Lu Linvega 2024-08-25 19:07:48 -07:00
parent 557cb3f051
commit d92740530d
2 changed files with 32 additions and 19 deletions

View File

@ -354,5 +354,5 @@
&roms $200
&misc $200
@buffer $200 &pos $2
@message &buf $200 &pos $2

View File

@ -36,7 +36,7 @@
;on-control .Controller/vector DEO2
;on-console .Console/vector DEO2
( | play something )
;buffer ;buffer/pos STA2
message/<new>
;dict/mpg-cmd .Console/addr DEO2
#03 .Console/mode DEO
#01 .Console/exec DEO
@ -49,23 +49,10 @@
( date ) "25 20 "Aug 20 "2024 $2
@on-console ( -> brk )
.Console/type DEI #01 EQU ?{ BRK }
.Console/read DEI #0a EQU ?{
;buffer/pos LDA2k STH2k .Console/read DEI STH2r STA
INC2 SWP2 STA2
BRK }
#0000 ;buffer/pos LDA2 STA2
( | parse line )
;buffer LDAk [ LIT "@ ] EQU ?{ POP2 JMP2r }
( INC2k LDA LIT "F EQU ?on-frame
| INC2k LDA LIT "H EQU ?on-help
| INC2k LDA LIT "I EQU ?on-id3
| INC2k LDA LIT "P EQU ?on-paused
| INC2k LDA LIT "R EQU ?on-revision
| INC2k LDA LIT "S EQU ?on-status
| INC2k LDA LIT "T EQU ?on-tag ) <perr>
#0a19 DEO
( reset ) ;buffer ;buffer/pos STA2
[ LIT2 01 -Console/type ] DEI EQU ?{ BRK }
[ LIT2 0a -Console/read ] DEI EQUk ?{ message/<append>
POP BRK }
POP2 message/<parse>
BRK
@on-mouse ( -> )
@ -115,6 +102,32 @@
( A ) DUP #01 NEQ ?{ .selection LDZ <pick> }
POP BRK
(
@|message )
@message/<parse> ( -- )
#0000 ;message/pos LDA2 STA2
( | parse line )
;message/buf LDAk [ LIT "@ ] EQU ?{ POP2 JMP2r }
( INC2k LDA LIT "F EQU ?on-frame
| INC2k LDA LIT "H EQU ?on-help
| INC2k LDA LIT "I EQU ?on-id3
| INC2k LDA LIT "P EQU ?on-paused
| INC2k LDA LIT "R EQU ?on-revision
| INC2k LDA LIT "S EQU ?on-status
| INC2k LDA LIT "T EQU ?on-tag ) <perr>
#0a19 DEO
( >> )
@message/<new> ( -- )
( reset ) ;message/buf ;message/pos STA2
JMP2r
@message/<append> ( c -- )
POP ;message/pos LDA2k STH2k .Console/read DEI STH2r STA
INC2 SWP2 STA2
JMP2r
(
@|core )