/ pv.fs
pv.fs
 1  ( ----- 000 )
 2  PocketViewer MASTER INDEX
 3  
 4  401 PV App builder
 5  
 6  ( ----- 001 )
 7  \ ROM header, helper words
 8  : xemitted ( -- n ) here xorg - ;
 9  : xtrace ."  $" xemitted .x nl> ;
10  : xpadck dup 0< if .S abort" fuck" else drop then ;
11  : xpfill ( c n -- ) xemitted - dup xpadck here swap rot fill ;
12  : xpad ( c n -- ) tuck xpfill xorg + to here ;
13  $100 xstart \ TODO C_INIT_ offset
14  \ header(
15  $ff00 t, ," CASIO" 3 c, ," Z4880100" $0101 t, $08ff t,
16  ( name ) ," PVForth" 0  c, ( size ) $ff $24 xpad
17  \ reserve size field
18  0 $28 xpad ( date, versions )
19  ," 20240902085601002000021509400100"
20  ( icons ) $ff $100 xpad
21  ( ----- 002 )
22  \ CLI, CLD, AX $8000 MOVxI,
23  \ DS AX MOVsx, ES AX MOVsx, SS AX MOVsx,
24  ( ----- 003 )
25  \ code (int86)
26  [BX] $e DS []+s MOV[], [BX] $10 DS []+s MOV[], BP PUSHx,
27  CX PUSHx, DX PUSHx, SI PUSHx, DI PUSHx, DS PUSHs, DX $cb MOVxI,
28  DX PUSHx, AH AL MOVrr, AL $cd MOVri, AX PUSHx, DS PUSHs,
29  CS PUSHs, AX $41 MOVxI, AX PUSHx, SS PUSHs, AX SP MOVxx,
30  $a ADDAXI, AX PUSHx, AX [BX] x[] MOV[], CX [BX] 4 x[]+ MOV[],
31  DX [BX]  6 x[]+ MOV[], SI [BX] 8 x[]+ MOV[], DI [BX] $a x[]+
32  MOV[], BP [BX] $c x[]+ MOV[], [BX] $e [w]+ PUSH[], ES [BX] $10
33  s[]+ MOV[], BX [BX] 2 x[]+ MOV[], DS POPs, RETF, PUSHF, BX
34  PUSHx, BP PUSHx, BP SP MOVxx, DS PUSHs, BX [BP] x[]+ LDS[],
35  \ ;code
36  \ C init
37  \ $1900 ESI $8016 DS 0 SI 0 DI $4a4 CX
38  \ AX $1900 MOVxI, ES AX MOVsx, AX $8016 MOVxI, DS AX MOVsx,
39  \ SI SI XORxx, DI 0 MOVxI, CX $4a4 MOVxI, CLD, MOVSB, REPZ,
40  \ ES PUSHx, DS POPx,
41  ( ----- 004 )
42  \ epilogue
43  xemitted xorg $24 .S + ! \ write size