Skip to content

Commit

Permalink
fixing update
Browse files Browse the repository at this point in the history
  • Loading branch information
chitselb committed Jul 5, 2018
1 parent 403ee00 commit 02d655b
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 140 deletions.
166 changes: 145 additions & 21 deletions core/src/core-vm.a65
Expand Up @@ -377,10 +377,9 @@ psize
;--------------------------------------------------------------
#if 0
name=>PKT
stack=( u -- pkt )
stack=( u -- )
tags=vm,ext
Return the `pkt` address of block `u`,
* set `n8` to `pkt`
Set `n8` to `pkt` address of block `u`

```
: >pkt
Expand All @@ -391,7 +390,7 @@ Return the `pkt` address of block `u`,
1-under
@+ psize - 2-
repeat
nip >n8 ;
n8 ! ;
```
~#packrat
#endif
Expand Down Expand Up @@ -422,12 +421,12 @@ topktb01
#include "pass.i65"
.word branch
.byt <(topktb01-*+1)
#include "page.i65"
topktb02
.word nip
#include "pass.i65"
.word tozp
topktb02
.word clit
.byt ACC+2*N8
#include "page.i65"
.word store
#include "pass.i65"
.word exit

Expand Down Expand Up @@ -898,7 +897,10 @@ name=DWRAP@
stack=( -- wrapd )
tags=vm,ext,nosymbol

~#packrat
```
: dwrap@ ( -- wrapd )
3c@ benjamin or ;
```
#endif
#include "align.i65"
_dwrapfetch
Expand Down Expand Up @@ -1003,6 +1005,42 @@ user is in the editor or not, and whether the packet is screen or data.
|>|^ not [[SCRPKT?]]|[[BLKBUF]] initialized to nulls<br>1024 bytes of data expanded to [[BLKBUF]]|

```
: ?mkpkts ( u -- )
begin \ make packets loop
#blk @ over 1+ <
while
pkt+
repeat
>pkt drop ; \ sets `n8`

: curbuf ( -- buf )
editing? ?: vidram blkbuf ;

: block ( u -- addr )
?mkpkts curbuf ( addr )
prev 2@ =
editing? 0= and ?exit \ block already loaded?
blk @ prev ! \ inhibit redundant reloading
dup b/buf isscr?
?: blank erase \ wipe the buffer
dup pkt.size tuck -
isscr?
if
3-under <n8 3- dwrap@
editing? ?: wrap! bufwrap!
then
-rot uncompressed?
?: cmove rldecode ;

: curpkt ( -- )
editing? ?: scr prev
>pkt drop ;

: update ( -- )
curpkt

bufwrap dwrap!

: block ( u -- addr )
begin \ make packets loop
#blk @ over 1+ <
Expand Down Expand Up @@ -1059,8 +1097,6 @@ qmkpkts02
.word pquerycolon
.word vidram
.word blkbuf
#include "page.i65"
.word nip
#include "page.i65"
.word prev
#include "page.i65"
Expand Down Expand Up @@ -1242,9 +1278,9 @@ _sup
#include "page.i65"
.word _pktsize
#include "page.i65"
.word bperbuf
.word nip
#include "page.i65"
.word twonip
.word bperbuf
#include "page.i65"
.word vmbuf
#include "page.i65"
Expand Down Expand Up @@ -1314,6 +1350,78 @@ sup03
#include "pass.i65"
.word exit

;--------------------------------------------------------------
#if 0
name=BOTTOM
stack=( -- )
tags=vm
returns the actual bottom of `vmbuf` even when a screen has been prepended
by using `STOP-DEL` (cut screen) in the editor

```
: bottom ( -- addr )
vmbuf @ dup @ ( vmbuf size )
?dup
if
psize -
then ;
```
#endif
#include "align.i65"
_bottom
jsr enter
#include "page.i65"
.word vmbuf
#include "page.i65"
.word fetch
#include "page.i65"
.word dup
#include "page.i65"
.word fetch
#include "page.i65"
.word qdup
#include "pass.i65"
.word qbranch
.byt <(bottom01-*+1)
#include "page.i65"
.word psize
#include "page.i65"
.word minus
#include "pass.i65"
bottom01
.word exit

;--------------------------------------------------------------
#if 0
name=FLOOR
stack=( -- addr )
tags=forth-83,vm

```
: floor ( -- addr )
<n8 dup @ psize - 2+ ;
```
~#packrat
#endif
#include "align.i65"
_floor
jsr enter
#include "pass.i65"
.word zpfrom
.byt ACC+2*N8
#include "page.i65"
.word dup
#include "page.i65"
.word fetch
#include "page.i65"
.word psize
#include "page.i65"
.word minus
#include "page.i65"
.word twoplus
#include "pass.i65"
.word exit

;--------------------------------------------------------------
#if 0
name=UPDATE
Expand Down Expand Up @@ -1343,11 +1451,15 @@ tests:
~\ fill blkbuf all with '!'

```

<n8 3- drwap@ \ get wrap from the packet
editing? ?: wrap! bufwrap! \ block


: update ( -- )
\ source is either `vidram` or `blkbuf`
\ target is always pkt.floor
editing? ?: scr blk
@ >pkt drop
editing? ?: scr blk @ >pkt
editing?
if
isscr?
Expand All @@ -1358,15 +1470,29 @@ tests:
\ nothing to do -- vidram can't hold data block
then
else
upd01
isscr?
if
blkbuf 1000 + 3c@
then
blkbuf prev sup
then
upd02
;
then ;

\ replace packet `scr`
: bottom
vmbuf @ dup @ ( vmbuf size )
?dup
if
psize -
then ;

: floor
<n8 dup @ psize - 2+ ;

: update ( -- )
( bottom ) ( bottom - 1024 + floor ) ( floor - bottom )

cmove
rlencode
```
~#packrat
#endif
Expand All @@ -1383,8 +1509,6 @@ _update
.word fetch
#include "page.i65"
.word _topkt
#include "page.i65"
.word drop
#include "page.i65"
.word editingq
#include "pass.i65"
Expand Down
6 changes: 3 additions & 3 deletions core/src/pettil-core.a65
Expand Up @@ -1045,9 +1045,9 @@ setupmsg01
#include "pass.i65"
.word _pdq
.byt (bannermsg01-*-1) ; length of bannermsg
.asc "VERSION: 2018-06-24",CR
.asc "1812 NAPOLEON CROSSES THE NEMAN RIVER",CR
.asc " AND INVADES RUSSIA",CR
.asc "VERSION: 2018-07-05",CR
.asc "1946 FRENCH DESIGNER LOUIS REARD",CR
.asc " INTRODUCES THE BIKINI",CR
;123456789.123456789.123456789.123456789.
bannermsg01
#include "pass.i65"
Expand Down
36 changes: 20 additions & 16 deletions docs/sizes.csv
Expand Up @@ -315,14 +315,16 @@ DWRAP@,11
BUFWRAP,11
BUFWRAP!,9
EMPTY-BUFFERS,15
BLOCK,109
BLOCK,107
(UPD1),21
(UPD2),23
SUP,78
UPDATE,55
BOTTOM,22
FLOOR,18
UPDATE,53
STASH-FORTH,12
RESTORE-FORTH,9
DOTAPEIO,20
DOTAPEIO,17
(SAVEPRG),5
(READHEAD),5
(READDATA),5
Expand Down Expand Up @@ -352,7 +354,7 @@ SIGN,15
(DIGIT),13
#,17
#S,14
(UD.),13
(UD.),11
(D.),19
(U.),9
(.),9
Expand Down Expand Up @@ -387,7 +389,7 @@ BARF.CTR,2
FLIPPER,50
DOLETTER,792
SPLASH,22
BANNER,19128
BANNER,19097
STUDIO,54
MACKINAC,50
(FORGET).PASS,16
Expand All @@ -397,7 +399,8 @@ WARM,24
TDICTEND,6
SKIP,3
SCAN,35
NAME,48
NFA!,13
NAME,39
'STREAM,30
REFILL,29
LINESIZE,75
Expand Down Expand Up @@ -476,7 +479,7 @@ PASSBITS!,9
(FORGET).KEEP,21
SYM.NEXT,9
(FORGET).PASS1,52
(FORGET).PASS2,17
(FORGET).PASS2,19
INIT.411,7
(FORGET),71
SYMTAIL!,7
Expand All @@ -487,9 +490,10 @@ ERROR.MSG,21
?CHAR,11
-->,11
\,8
INTERPRET,41
INTERPRET.CFA,15
INTERPRET,29
EOS?,13
QUIT,35
QUIT,34
ABORT,11
LOAD,42
EXISTS?,19
Expand All @@ -504,7 +508,7 @@ PAGEMARGIN,14
PAGEALIGN,17
?COMP,10
"XT,",10
UNDEFINE,25
UNDEFINE,28
COMPILING?,9
COMPILE,17
CREATE,11
Expand All @@ -519,7 +523,7 @@ BISHWHET,25
DISPATCH,5
CONSTANT,13
CCONSTANT,13
2CONSTANT,18
2CONSTANT,15
VARIABLE,11
LATEST,9
"$,",17
Expand Down Expand Up @@ -568,7 +572,7 @@ AGAIN,12
REPEAT,20
"PETSCII""",14
.S,47
H.,31
H.,29
4H.,15
XLATE,15
DUMP,78
Expand All @@ -590,14 +594,14 @@ WRAPDEL,30
WRAPCOPY?,39
EDITCOPIER,17
EDITCOPY,3
:EDITCOPY,12
:EDITDEL,30
:EDITCOPY,14
:EDITDEL,28
:EDITPASTE,30
:EDITNOWRAP,15
:EDITTOPSCR,6
:EDITQUIT,12
:EDITINDEX,2
:EDITINFO,171
:EDITINFO,173
:EDITSAVE,9
:EDITLOAD,11
LIST,17
Expand Down Expand Up @@ -648,7 +652,7 @@ DECODE1,75
M/CPU1,11
"IF,1",19
"ELSE,1",36
"THEN,1",27
"THEN,1",28
"BEGIN,1",13
"WHILE,1",19
"UNTIL,1",21
Expand Down
6 changes: 3 additions & 3 deletions docs/sizes.txt
@@ -1,3 +1,3 @@
6910 pettil-core.obj
5861 pettil-studio.obj
3318 pettil.sym
6939 pettil-core.obj
5870 pettil-studio.obj
3335 pettil.sym
Binary file modified pettil.prg
Binary file not shown.

0 comments on commit 02d655b

Please sign in to comment.