Jump to content
IGNORED

fbForth—TI Forth with File-based Block I/O [Post #1 UPDATED: 06/09/2023]


Lee Stewart

Recommended Posts

I just posted the latest FBLOCKS (November 17, 2015) to post #1. It includes the TI Forth block utilities from my last post above (with a slight modification noted in the above post and below).

 

A few notes regarding the TI Forth block utilities—

  • TIFBLK and TIFIDX include PAUSE , which will pause the display when any key except <break> is pressed and resume when any key except <break> is again pressed. If <break> is pressed, the display is aborted. Eventually, I may write a viewer that will scroll sideways the 64 columns of a Forth block or a screenful of index lines.
  • TIFBLK and TIFIDX will pause and await a key-press with a blinking cursor after a screenful of lines has been displayed. This is useful for TIFBLK when using 40-column Text mode and for TIFIDX for the same reason or when the user requests more index lines than can be displayed on the screen.
  • In Classic99, none of these utilities can access a TI Forth disk if block #0 has been used as a Forth block. This is due to the fact that Classic99 checks the disk for a valid sector 0, even if classic99.ini has been edited to mark that disk as “Type=3”. TI Forth does not care whether a blocks-only disk has a valid sector 0. MESS and real iron handle this situation just fine. Many TI Forth programmers avoided using block #0 so that the disk could be set up to show a single file (SCREENS) that filled the entire disk. I have not checked other emulators to see whether using block #0 is a problem—just be advised that there are TI Forth blocks disks out there that have Forth code on block #0.

 

...lee

Link to comment
Share on other sites

Curiosity got the best of me this evening. I reasoned that, since TurboForth and FB Forth have the same BLOCKS structure (i.e., D/F 128), it should be possible to import FBLOCKS blocks directly into TurboForth (and probably vice-versa). That is absolutely true!! Using CPYBLK running in TurboForth, I was able to easily import blocks from the FBLOCKS file. Although I didn't test it, the CPYBLK function running in its native FB Forth should be able to to exactly the same thing with TurboForth blocks. However, since the code is different, the applications likely wouldn't run but you could at least import and edit the files between the two Forth dialects to create a form that would run. Interesting possibilities, indeed!!!.

  • Like 3
Link to comment
Share on other sites

Curiosity got the best of me this evening. I reasoned that, since TurboForth and FB Forth have the same BLOCKS structure (i.e., D/F 128), it should be possible to import FBLOCKS blocks directly into TurboForth (and probably vice-versa). That is absolutely true!! Using CPYBLK running in TurboForth, I was able to easily import blocks from the FBLOCKS file. Although I didn't test it, the CPYBLK function running in its native FB Forth should be able to to exactly the same thing with TurboForth blocks. However, since the code is different, the applications likely wouldn't run but you could at least import and edit the files between the two Forth dialects to create a form that would run. Interesting possibilities, indeed!!!.

 

Yup. Before I had an 80-column system working, I was using TurboForth's editor all of the time to edit my fbForth blocks files!

 

...lee

Link to comment
Share on other sites

I have a working version of TIFVU that allows browsing a TI Forth disk much as the 40/80-column editor does. It also will allow saving one or more TI Forth blocks to an fbForth blocks file (not yet implemented). The following command will invoke the viewer/copier with block #2 from TI Forth DSK2 in the viewer window:

 

TIFVU 2 DSK2

 

Here is the current code. I need to add the Save function and tighten up the code, if possible. I think it's a bit unwieldy as it stands. You need to have FBLOCKS as the current blocks file before loading this code because block #61 ( DATA[ , ]DATA ,... ) must be loaded. It includes the previous code (modified, yet again) for TIFBLK , TIFIDX and TIF2FBF :

 

 

 

( TI Forth disk browser/copier---)
( Read and display TI Forth blocks)
HEX 3D CLOAD SPDCHAR
1154 CONSTANT VTIbuf ( VRAM sector buffer address)
0110 VARIABLE TIPAB ( 2-byte, level 1, read/write sector PAB contents)
1 VARIABLE Dsk ( 1-based disk #, i.e., 1 for DSK1)
0 VARIABLE DFL ( pointer to destination filename string)
0 VARIABLE outBFL 10 ALLOT
0 VARIABLE curBFL 10 ALLOT
: GNUM BL WORD HERE NUMBER DROP ; ( get number from terminal)
( Get DO limit and index to stack from input stream [iS])
: getDOidx ( --- limit index ) ( IS: startBlk# endBlk#)
GNUM GNUM OVER OVER ( get start & end block#s and dup them)
> IF SWAP THEN ( if start# > end#, swap them)
1+ ( increment limit)
SWAP ; ( get in index order for DO ... LOOP)
: BlkBuf PREV @ 2+ ; ( use last accessed block buffer)
: getDsk ( IS:DSKn) BL WORD HERE 4 + C@ 30 - Dsk ! ; ( get source disk#)
( Trap read error)
: RdErr? ( err -- ) -DUP IF CR ." Disk I/O error " BASE->R
[COMPILE] HEX . R->BASE ABORT THEN ;
: DSRLNK10 0A 0E SYSTEM 8350 C@ RdErr? ; ( DSR suprogram link)
: getTIblock ( blk# -- )
FLUSH ( flush any dirty buffers)
TIPAB VTIbuf 2- 2 VMBW ( copy PAB to VRAM)
VTIbuf 834E ! ( VRAM buffer address to transfer block)
Dsk @ SWPB 1+ 834C ! ( disk# and read opcode to transfer block)
2 SLA ( sec#) ( calculate starting sector#)
BlkBuf DUP 400 + SWAP DO ( RAM buffer max and start of DO index to stack)
DUP 8350 ! ( sector# to transfer block)
1+ ( sec#+1) ( increment sector# for next go-round)
VTIbuf 2- 8356 ! ( PAB address to subprogram pointer)
DSRLNK10 ( get the sector contents to VRAM)
VTIbuf I 100 VMBR ( coipy 256 bytes to next slot in RAM buffer)
100 +LOOP ( get next sector)
DROP ; ( drop leftover sector#)
: dnLeft CURPOS @ SCRN_WIDTH @ MOD ( cursor at beginning of line?)
IF CR THEN ; ( move text cursor to start of next line if so)
: TYPE8 ( addr cnt -- )
-DUP IF
OVER + SWAP DO
I C@ EMIT8
LOOP
ELSE
DROP
THEN ;
: dspLine ( line# -- ) 40 * BlkBuf + 40 TYPE8 ; ( type 1 line)
: 64page? ( check that next 64 chars will stay on screen)
CURPOS @ 40 + SCRN_END @ > ( check for full screen)
IF
KEY DROP PAGE ( wait for keystroke before continuing display)
THEN ;
: TIFBLK ( IS:blk# DSKn ) ( type TI Forth block)
GNUM ( get block# from IS)
getDsk ( store disk# for getTIblock)
getTIblock ( get the block to RAM buffer)
PAGE ( clear screen with cursor to screen start)
10 0 DO ( process 16 lines)
64page? ( check for end of page)
dnLeft ( cursor to beginning of current/next line)
I 2 .R ." | " ( type line#)
I dspLine ( type next line)
PAUSE IF LEAVE THEN ( check for pause or <BREAK> key)
LOOP ;
( Type index lines of 1 or more TI Forth blocks)
: TIFIDX ( IS:startblk endblk DSKn)
getDOidx ( get DO limit and index from IS)
getDsk ( store disk# for getTIblock)
PAGE ( clear screen with cursor to screen start)
DO ( process startBlock – endBlock index lines)
I getTIblock ( get the block to RAM buffer)
64page? ( check for end of page)
dnLeft ( cursor to beginning of current/next line)
I 3 .R ." | " ( type block#)
0 dspLine ( type block's line 0 [index line])
PAUSE IF LEAVE THEN ( check for pause or <BREAK> key)
LOOP
CR ." ...done" ; ( announce completion)
( GBFL gets HERE to stack; stores filename at HERE; establishes new HERE;)
( stores string address in variable passed on stack)
( <<<< Change this to use curBFL and outBFL variable >>>>)
: GBFL ( addrvar -- ) BL WORD HERE DUP C@ 1+ =CELLS ALLOT SWAP ! ;
: TIF2FBF ( IS:srcStartBlock srcEndBlock DSKn dstStartBlock dstBlocksFile)
HERE ( save address where we'll copy current blocks filename)
BPB BPOFF @ + 9 + ( get address of blocks filename's char-count byte)
DUP VSBR 1+ ( get count byte and increment it for copy count)
( Get current blocks name to HERE and move HERE past it.)
HERE SWAP DUP =CELLS ALLOT VMBR
getDOidx ( get DO limit and index from IS)
getDsk ( get source disk#)
GNUM ( get destination start block#)
DFL GBFL ( dst filename to HERE; store address, moving HERE)
DFL @ (UB) ( open destination blocks file)
ROT ROT ( get limit and index to top of stack)
DO ( endBlock+1 startBlock DO)
I . ( type src)
I getTIblock ( load next TI Forth src block)
DUP ( dup dst block#)
PREV @ ! ( store dst block# at head of block buffer)
UPDATE FLUSH ( write block to destination blocks file)
1+ ( calculate next dst block#)
LOOP
DROP ( drop the leftover dst block#)
DUP ( DUP old HERE)
(UB) ( restore original blocks file to 'current' status)
DP ! ( restore dictionary pointer)
;
( Patterns for display box [chars 201-215]...)
: BOXCHRS DATA[ 0000 003C 3C30 3030 ( ASCII 201, C9h, top left corner)
0000 00F0 F030 3030 ( ASCII 202, CAh, top right corner)
3030 303C 3C00 0000 ( ASCII 203, CBh, bottom left corner)
3030 30F0 F000 0000 ( ASCII 204, CCh, bottom right corner)
0000 00FC FC00 0000 ( ASCII 205, CDh, horizontal line segment)
0000 00FC FC30 3030 ( ASCII 206, CEh, hashed horizontal line segment)
3030 3030 3030 3030 ( ASCII 207, CFh, vertical line segment)
3060 C070 380C 1830 ( ASCII 208, D0h, broken vertical line segment)
40A0 A8B4 5414 0800 ( ASCII 209, D1h, 00)
40C0 4854 F414 0800 ( ASCII 210, D2h, 10)
40A0 2854 F414 0800 ( ASCII 211, D3h, 20)
C020 4834 D414 0800 ( ASCII 212, D4h, 30)
2060 A8F4 3414 0800 ( ASCII 213, D5h, 40)
E080 6834 D414 0800 ( ASCII 214, D6h, 50)
4080 C8B4 5414 0800 ( ASCII 215, D7h, 60)
]DATA C9 DCHAR ;
D1CD VARIABLE TLDATA DATA[ CDCD CDCE CDCD CDCD D2CD CDCD CDCE
CDCD CDCD D3CD CDCD CDCE CDCD CDCD D4CD CDCD CDCE CDCD CDCD
D5CD CDCD CDCE CDCD CDCD D6CD CDCD CDCE CDCD CDCD D7CD CDCD
]DATA DROP DROP
( TI Forth 40/80-column viewer/copier...)
( View TI Forth blocks and, optionally, copy them one at a time to an)
( fbForth blocks file.)
0 VARIABLE TIFblk 0 VARIABLE fbFblk 0 CONSTANT OFFSET
0 VARIABLE OutBFL 10 ALLOT 0 VARIABLE CurBFL 10 ALLOT
: WINWID ( -- winwid ) SCRN_WIDTH @ 28 = IF 22 ELSE 40 THEN ;
: CORNERS 3 3 1 0C9 HCHAR ( top left)
3 14 1 0CB HCHAR ( bottom left)
4 WINWID + DUP 3 1 0CA HCHAR ( top right)
( DUPed column) 14 1 0CC HCHAR ( bottom right)
;
: TOPLN ( -- ) OFFSET TLDATA + 4 3 GOTOXY WINWID TYPE8 ;
: BOTLN 4 14 WINWID 0CD HCHAR ;
: SIDELN ( col chr -- ) 4 10 ROT VCHAR ;
: SIDELNS 3 0CF SIDELN WINWID 4 + 0CF SIDELN ;
: drawScrn PAGE
." --TI Forth Block Viewer/Copier--" CR
." TI Forth:DSK fbForth:" CR
." Block Block"
0 ' OFFSET !
CORNERS
TOPLN
BOTLN
SIDELNS
SCRN_WIDTH @ DUP 4 *
BASE->R DECIMAL
10 0 DO
DUP CURPOS !
I 3 .R
OVER +
LOOP R->BASE DROP DROP CR CR
." F4:+Block F6:-Block FD:+Panel FS:-Panel "
." FT:TI# FF:fb# ^F:BlkFil ^S:TI>fb F9:Xit"
;
: dspLnSeg ( line# -- )
40 * BlkBuf OFFSET + + WINWID TYPE8 ;
: dspBlock ( -- ) SCRN_WIDTH @ 28 =
IF ( take care of 40-column side borders)
3 26 ( left column; right column)
OFFSET CASE ( check offset for appropriate border chars)
00 OF 0CF 0D0 ENDOF ( left)
0F OF 0D0 0D0 ENDOF ( middle)
1E OF 0D0 0CF ENDOF ( right)
ELSEOF 0CF 0CF ENDOF ( catch-all)
ENDCASE
ROT SWAP SIDELN SIDELN ( draw the 40-column side borders)
TOPLN ( redo top border)
THEN
10 0 DO ( process 16 lines)
SCRN_WIDTH @ I 4 + * ( CURPOS of next row)
4 + ( CURPOS of starting column)
CURPOS ! ( store new CURPOS)
I dspLnSeg ( display line segment)
LOOP
;
: calcOff ( -1|0|+1 -- )
DUP IF ( calculate only if not 0)
0F * OFFSET + DUP ( calculate new OFFSET and DUP it)
0< IF DROP 1E THEN DUP ( if < 0, 30; DUP it)
1E > IF DROP 0 THEN ( if > 30, 0)
THEN
' OFFSET ! ( store new OFFSET)
;
: dspPanel ( +1|-1 -- )
WINWID 22 = IF ( do this only with 40-column mode)
calcOff dspBlock ( calculate new OFFSET and display panel)
ELSE
DROP ( drop unused direction)
THEN
;
: getCmd ( -- key )
?KEY
DUP IF ( de-bounce)
BEGIN
?KEY 0=
UNTIL
THEN
;
: saveCurBFL
BPB BPOFF @ + 9 + ( get address of blocks filename's char-count byte)
DUP VSBR ( get count byte)
curBFL ( address to copy current blocks filename)
SWAP 1+ ( get copy count)
VMBR ( copy filename)
;
: getBFL
TIB @ 0F EXPECT ( input filename)
0 IN ! ( reset IN)
BL WORD ( get filename packed string to HERE)
HERE outBFL HERE C@ 1+ CMOVE ( copy string to outBFL)
;
: dspBlk# ( n col row -- )
GOTOXY 3 .R
;
: getBlk# ( min col row -- n )
ROT >R
OVER OVER GOTOXY CURPOS @
DUP 3 20 VFILL
CURPOS !
TIB @ 3 EXPECT 0 IN !
BL WORD HERE NUMBER DROP
DUP R < IF
DROP R>
ELSE
R> DROP
THEN
DUP >R ROT ROT dspBlk# R>
;
: cmd ( get command key)
BEGIN
getCmd CASE
02 OF ( next TI Forth block)
1 TIFblk +! TIFblk @ DUP 8 2 dspBlk#
getTIblock 0 calcOff dspBlock
0 ENDOF
0C OF ( previous TI Forth block)
TIFblk @ IF
-1 TIFblk +! TIFblk @
DUP 8 2 dspBlk#
getTIblock 0 calcOff dspBlock
THEN
0 ENDOF
09 OF 1 dspPanel 0 ENDOF ( next panel)
08 OF -1 dspPanel 0 ENDOF ( previous panel)
5D OF ( new TI Forth block#)
0 8 2 getBlk#
DUP TIFblk !
getTIblock 0 calcOff dspBlock
0 ENDOF
7B OF ( new fbForth block#)
1 18 2 getBlk#
fbFblk !
0 ENDOF
06 OF ( enter fbForth blocks file name)
18 1 GOTOXY CURPOS @ ( set CURPOS to after "fbForth:")
DUP 10 20 VFILL
CURPOS !
getBFL outBFL (UB)
0 ENDOF
13 OF 0 ENDOF ( save TI Forth block to fbForth blocks file)
0F OF PAGE 1 ENDOF ( Exit)
ELSEOF 0 ENDOF
ENDCASE
UNTIL
;
: TIFVU ( IS:blk# DSKn)
GNUM DUP TIFblk ! getDsk getTIblock
VDPMDE @ 2 < IF
saveCurBFL
BOXCHRS
drawScrn
0C 1 GOTOXY Dsk @ .
TIFblk @ 8 2 dspBlk#
dspBlock
cmd
curBFL (UB)
ELSE
CR ." TEXT or TEXT80 modes only!"
THEN
;
DECIMAL

 

 

 

Please, try it and give me suggestions for improvement, report bugs , etc.

 

...lee

Link to comment
Share on other sites

I discovered a problem with the resident word (ABORT) while looking for a way to manage errors differently from the way they are normally handled by fbForth and its antecedent, TI Forth. The user variable WARNING affects how errors get handled. If WARNING contains a positive value (which is the default), an error message is displayed, the stack is cleared, the values of IN and BLK are left on the stack and QUIT is executed, which restarts the interpreter. If WARNING contains 0, the same thing happens except that the message is the message #. Finally, if WARNING contains a negative value, (ABORT) is executed.

 

All (ABORT) does is execute ABORT , which resets everything and restarts the interpreter. (ABORT) is actually a hook that can be used to execute the user's error procedure (UEP). All the user needs to do is to replace the CFA of ABORT in the definition of (ABORT) with the CFA of the UEP and set WARNING to -1. This is pretty easy to do because the CFA of ABORT is sitting in the parameter field of (ABORT) . All that is necessary to install the UEP is to copy its CFA to the PFA of (ABORT) . You have probably already figured out the nature of the problem. (ABORT) is defined in ROM and obviously cannot be changed. What I need to do is to put the definition of (ABORT) into low RAM as I did with FORTH and ASSEMBLER so that fields that need to be modified can be. I will make this change ere long for the next build of fbForth 2.0. No one has been knocking down my doors for the fix :waving:, so there is probably no hurry. :ponder:

 

...lee

  • Like 1
Link to comment
Share on other sites

I wanted to take full advantage of my HSGPL Card and my RAMdisk(s) when using fbFORTH..So, I decided to (on my system) alter fbFORTH to load the FBLOCKS from DSKF to take advantage of the increased loading speed from a RAMdisk. For those of you who are burning their own cartriges, the fix is simple. Use a hex editor to do an ASCII search for DSK (or DSK1.FBLOCKS) and change the drive number to your preferred drive. In my case, it was DSKF. The string only appears once in the entire .bin file. Go ahead and burn the changed file.

 

For those of you using the HSGPL files, the string appears in file # 3.

  • Like 1
Link to comment
Share on other sites

I wanted to take full advantage of my HSGPL Card and my RAMdisk(s) when using fbFORTH..So, I decided to (on my system) alter fbFORTH to load the FBLOCKS from DSKF to take advantage of the increased loading speed from a RAMdisk. For those of you who are burning their own cartriges, the fix is simple. Use a hex editor to do an ASCII search for DSK (or DSK1.FBLOCKS) and change the drive number to your preferred drive. In my case, it was DSKF. The string only appears once in the entire .bin file. Go ahead and burn the changed file.

 

For those of you using the HSGPL files, the string appears in file # 3.

 

While your mod certainly makes it automatic, it is easy enough to hold down the 'F' key at boot-up time (since build #3, I believe).

 

...lee

Link to comment
Share on other sites

True, I find it easier to go directly to the FBLOCKS file. If you hold down the space key to bypass the automatic DSK1.FBLOCKS, you still have to type in USEBFL DSKx.filename (in this case FBLOCKS) from the command line. That option is still available should you widh to use a file besides FBLOCKS at boot. I just find it a bit more convenient on my system.

Link to comment
Share on other sites

True, I find it easier to go directly to the FBLOCKS file. If you hold down the space key to bypass the automatic DSK1.FBLOCKS, you still have to type in USEBFL DSKx.filename (in this case FBLOCKS) from the command line. That option is still available should you widh to use a file besides FBLOCKS at boot. I just find it a bit more convenient on my system.

 

As I mentioned, it is only one additional step if you hold down 'F' (or wherever your FBLOCKS file resides)—no additonal USEBFL command.

 

...lee

Link to comment
Share on other sites

Lee, when you get old (like me) you sometimes forget that you have to press F when fbFORTH boots. That results in <expletive deleted> and re-starting fbFORTH again. I prefer idiot-proofing my boot system as much as possible. BTW, what is the difference between DIR and CAT?

 

DIR is a port of TurboForth's DIR and uses the DSR's “Catalog” facility.

 

CAT uses a disk's VIB, FDIR and FDRs to get the information directly.

 

...lee

  • Like 1
Link to comment
Share on other sites

I am almost done with the TI Forth Viewer/Copier. It is taking longer than it would have had I not decided to upgrade to Win10Pro. It has been problematic, to say the least! Everything is slower than Win7Pro and there are constant, unpredictable freezes. I don't think I have shut down normally more than once or twice since the "upgrade" three days ago! :mad: I may restore Win7Pro.

 

...lee

  • Like 2
Link to comment
Share on other sites

I think this is pretty close to final form—unless someone has changes to suggest or notes any bugs:

 

 

 

( TI Forth disk browser/copier---)
( Read, display and copy TI Forth blocks)
HEX 3D CLOAD SPDCHAR
1154 CONSTANT VTIbuf ( VRAM sector buffer address)
0110 VARIABLE TIPAB ( 2-byte, level 1, read/write sector PAB contents)
1 VARIABLE Dsk ( 1-based disk #, i.e., 1 for DSK1)
0 VARIABLE DFL ( pointer to destination filename string)
0 VARIABLE outBFL 10 ALLOT
0 VARIABLE curBFL 10 ALLOT
: GNUM BL WORD HERE NUMBER DROP ; ( get number from terminal)
( Get DO limit and index to stack from input stream [iS])
: getDOidx ( --- limit index ) ( IS: startBlk# endBlk#)
GNUM GNUM OVER OVER ( get start & end block#s and dup them)
> IF SWAP THEN ( if start# > end#, swap them)
1+ ( increment limit)
SWAP ; ( get in index order for DO ... LOOP)
: BlkBuf PREV @ 2+ ; ( use last accessed block buffer)
: getDsk ( IS:DSKn) BL WORD HERE 4 + C@ 30 - Dsk ! ; ( get source disk#)
( Trap read error)
: RdErr? ( err -- ) -DUP IF CR ." Disk I/O error " BASE->R
[COMPILE] HEX . R->BASE ABORT THEN ;
: DSRLNK10 0A 0E SYSTEM 8350 C@ RdErr? ; ( DSR suprogram link)
: getTIblock ( blk# -- )
FLUSH ( flush any dirty buffers)
TIPAB VTIbuf 2- 2 VMBW ( copy PAB to VRAM)
VTIbuf 834E ! ( VRAM buffer address to transfer block)
Dsk @ SWPB 1+ 834C ! ( disk# and read opcode to transfer block)
2 SLA ( sec#) ( calculate starting sector#)
BlkBuf DUP 400 + SWAP DO ( RAM buffer max and start of DO index to stack)
DUP 8350 ! ( sector# to transfer block)
1+ ( sec#+1) ( increment sector# for next go-round)
VTIbuf 2- 8356 ! ( PAB address to subprogram pointer)
DSRLNK10 ( get the sector contents to VRAM)
VTIbuf I 100 VMBR ( coipy 256 bytes to next slot in RAM buffer)
100 +LOOP ( get next sector)
DROP ; ( drop leftover sector#)
: dnLeft CURPOS @ SCRN_WIDTH @ MOD ( cursor at beginning of line?)
IF CR THEN ; ( move text cursor to start of next line if so)
: TYPE8 ( addr cnt -- )
-DUP IF
OVER + SWAP DO
I C@ EMIT8
LOOP
ELSE
DROP
THEN ;
: dspLine ( line# -- ) 40 * BlkBuf + 40 TYPE8 ; ( type 1 line)
: 64page? ( check that next 64 chars will stay on screen)
CURPOS @ 40 + SCRN_END @ > ( check for full screen)
IF
KEY DROP PAGE ( wait for keystroke before continuing display)
THEN ;
: TIFBLK ( IS:blk# DSKn ) ( type TI Forth block)
GNUM ( get block# from IS)
getDsk ( store disk# for getTIblock)
getTIblock ( get the block to RAM buffer)
PAGE ( clear screen with cursor to screen start)
10 0 DO ( process 16 lines)
64page? ( check for end of page)
dnLeft ( cursor to beginning of current/next line)
I 2 .R ." | " ( type line#)
I dspLine ( type next line)
PAUSE IF LEAVE THEN ( check for pause or <BREAK> key)
LOOP ;
( Type index lines of 1 or more TI Forth blocks)
: TIFIDX ( IS:startblk endblk DSKn)
getDOidx ( get DO limit and index from IS)
getDsk ( store disk# for getTIblock)
PAGE ( clear screen with cursor to screen start)
DO ( process startBlock – endBlock index lines)
I getTIblock ( get the block to RAM buffer)
64page? ( check for end of page)
dnLeft ( cursor to beginning of current/next line)
I 3 .R ." | " ( type block#)
0 dspLine ( type block's line 0 [index line])
PAUSE IF LEAVE THEN ( check for pause or <BREAK> key)
LOOP
CR ." ...done" ( announce completion)
;
: gBFL ( -- ) BL WORD ( get filename packed string to HERE)
HERE outBFL HERE C@ 1+ CMOVE ( copy string to outBFL)
;
: saveCurBFL
BPB BPOFF @ + 9 + ( get address of blocks filename's char-count byte)
DUP VSBR ( get count byte)
curBFL ( address to copy current blocks filename)
SWAP 1+ ( get copy count)
VMBR ( copy filename)
;
: getBFL
TIB @ 0F EXPECT ( input filename)
0 IN ! ( reset IN)
gBFL ( get filename packed string to outBFL)
;
( Copy a range of TI Forth blocks to fbForth blocks file.)
: cpyTI2FB ( dstBlk# lim idx -- )
CURPOS @ >R ( save cursor position to return stack)
DO ( endBlock+1 startBlock DO)
J CURPOS ! ( restore CURPOS)
I 3 .R ( type src)
I getTIblock ( load next TI Forth src block)
DUP ( dup dst block#)
PREV @ ! ( store dst block# at head of block buffer)
UPDATE FLUSH ( write block to destination blocks file)
1+ ( calculate next dst block#)
LOOP
DROP ( drop the leftover dst block#)
R> DROP ( clean up return stack)
;
: TIF2FBF ( IS:srcStartBlock srcEndBlock DSKn dstStartBlock dstBlocksFile)
saveCurBFL ( save current blocks file)
getDOidx ( get DO limit and index from IS)
getDsk ( get source disk#)
GNUM ( get destination start block#)
gBFL ( dst filename to outBFL)
outBFL (UB) ( open destination blocks file)
ROT ROT ( get limit and index to top of stack)
cpyTI2FB ( copy src TI Forth blocks to dst file)
curBFL (UB) ( restore original blocks file to 'current' status)
;
( Patterns for display box [chars 201-215]...)
: BOXCHRS DATA[ 0000 003C 3C30 3030 ( ASCII 201, C9h, top left corner)
0000 00F0 F030 3030 ( ASCII 202, CAh, top right corner)
3030 303C 3C00 0000 ( ASCII 203, CBh, bottom left corner)
3030 30F0 F000 0000 ( ASCII 204, CCh, bottom right corner)
0000 00FC FC00 0000 ( ASCII 205, CDh, horizontal line segment)
0000 00FC FC30 3030 ( ASCII 206, CEh, hashed horizontal line segment)
3030 3030 3030 3030 ( ASCII 207, CFh, vertical line segment)
3060 C070 380C 1830 ( ASCII 208, D0h, broken vertical line segment)
40A0 A8B4 5414 0800 ( ASCII 209, D1h, 00)
40C0 4854 F414 0800 ( ASCII 210, D2h, 10)
40A0 2854 F414 0800 ( ASCII 211, D3h, 20)
C020 4834 D414 0800 ( ASCII 212, D4h, 30)
2060 A8F4 3414 0800 ( ASCII 213, D5h, 40)
E080 6834 D414 0800 ( ASCII 214, D6h, 50)
4080 C8B4 5414 0800 ( ASCII 215, D7h, 60)
0000 FC00 FC00 FC00 ( ASCII 216, D8h, 3-line)
]DATA C9 DCHAR ;
D1CD VARIABLE TLDATA DATA[ CDCD CDCE CDCD CDCD D2CD CDCD CDCE
CDCD CDCD D3CD CDCD CDCE CDCD CDCD D4CD CDCD CDCE CDCD CDCD
D5CD CDCD CDCE CDCD CDCD D6CD CDCD CDCE CDCD CDCD D7CD CDCD
]DATA DROP DROP
( TI Forth 40/80-column viewer/copier...)
( View TI Forth blocks and, optionally, copy them one at a time to an)
( fbForth blocks file.)
0 VARIABLE TIFblk 0 VARIABLE fbFblk 0 CONSTANT OFFSET
: WINWID ( -- winwid ) SCRN_WIDTH @ 28 = IF 22 ELSE 40 THEN ;
: CORNERS 3 3 1 0C9 HCHAR ( top left)
3 14 1 0CB HCHAR ( bottom left)
4 WINWID + DUP 3 1 0CA HCHAR ( top right)
( DUPed column) 14 1 0CC HCHAR ( bottom right)
;
: TOPLN ( -- ) OFFSET TLDATA + 4 3 GOTOXY WINWID TYPE8 ;
: BOTLN 4 14 WINWID 0CD HCHAR ;
: SIDELN ( col chr -- ) 4 10 ROT VCHAR ;
: SIDELNS 3 0CF SIDELN WINWID 4 + 0CF SIDELN ;
: RPT ( chr cnt -- ) 0 DO DUP EMIT8 LOOP DROP ;
: drawScrn PAGE
0D8 6 RPT ." TI Forth Block Viewer/Copier" 0D8 6 RPT
VDPMDE @ 0= IF 0D8 28 RPT THEN
." TI Forth:DSK fbForth:" CR
." Block Block"
0 ' OFFSET !
CORNERS
TOPLN
BOTLN
SIDELNS
SCRN_WIDTH @ DUP 4 *
BASE->R DECIMAL
10 0 DO
DUP CURPOS !
I 3 .R
OVER +
LOOP R->BASE DROP DROP CR CR
." F4:+Block F6:-Block FD:+Panel FS:-Panel "
." FT:TI# FF:fb# ^F:BlkFil ^S:TI>fb F9:Xit"
;
: dspLnSeg ( line# -- )
40 * BlkBuf OFFSET + + WINWID TYPE8 ;
: dspBlock ( -- ) SCRN_WIDTH @ 28 =
IF ( take care of 40-column side borders)
3 26 ( left column; right column)
OFFSET CASE ( check offset for appropriate border chars)
00 OF 0CF 0D0 ENDOF ( left)
0F OF 0D0 0D0 ENDOF ( middle)
1E OF 0D0 0CF ENDOF ( right)
ELSEOF 0CF 0CF ENDOF ( catch-all)
ENDCASE
ROT SWAP SIDELN SIDELN ( draw the 40-column side borders)
TOPLN ( redo top border)
THEN
10 0 DO ( process 16 lines)
SCRN_WIDTH @ I 4 + * ( CURPOS of next row)
4 + ( CURPOS of starting column)
CURPOS ! ( store new CURPOS)
I dspLnSeg ( display line segment)
LOOP
;
: calcOff ( -1|0|+1 -- )
DUP IF ( calculate only if not 0)
0F * OFFSET + DUP ( calculate new OFFSET and DUP it)
0< IF DROP 1E THEN DUP ( if < 0, 30; DUP it)
1E > IF DROP 0 THEN ( if > 30, 0)
THEN
' OFFSET ! ( store new OFFSET)
;
: dspPanel ( +1|-1 -- )
WINWID 22 = IF ( do this only with 40-column mode)
calcOff dspBlock ( calculate new OFFSET and display panel)
ELSE
DROP ( drop unused direction)
THEN
;
: getCmd ( -- key )
?KEY
DUP IF ( de-bounce)
BEGIN
?KEY 0=
UNTIL
THEN
;
: dspBlk# ( n col row -- )
GOTOXY 3 .R
;
: get# ( -- n )
TIB @ 3 EXPECT 0 IN !
BL WORD HERE NUMBER DROP
;
: getBlk# ( min col row -- n )
ROT >R
OVER OVER GOTOXY CURPOS @
DUP 3 20 VFILL
CURPOS !
get#
DUP R < IF
DROP R>
ELSE
R> DROP
THEN
DUP >R ROT ROT dspBlk# R>
;
: nxtTIblk ( +1|-1 -- )
TIFblk +! TIFblk @
DUP 8 2 dspBlk#
getTIblock 0 calcOff dspBlock
;
: clrLstLn ( -- ) ( Clear last line of display)
0 17 SCRN_WIDTH @ 20 HCHAR ( clear last line to spaces)
0 17 GOTOXY ( to start of last line)
;
: keyPrompt
." ..tap key" ( issue prompt)
KEY DROP clrLstLn ( get key, DROP it and clear last line)
;
: cmd ( get command key)
BEGIN
getCmd CASE
02 OF 1 nxtTIblk 0 ENDOF ( next TI Forth block)
0C OF TIFblk @ IF -1 nxtTIblk THEN 0 ENDOF ( prev TI Forth block)
09 OF 1 dspPanel 0 ENDOF ( next panel)
08 OF -1 dspPanel 0 ENDOF ( previous panel)
5D OF ( new TI Forth block#)
0 8 2 getBlk#
DUP TIFblk !
getTIblock 0 calcOff dspBlock
0 ENDOF
7B OF ( new fbForth block#)
1 18 2 getBlk# ( get fbForth block#)
fbFblk ! ( store it)
0 ENDOF
06 OF ( enter fbForth blocks file name)
18 1 GOTOXY CURPOS @ ( set CURPOS to after "fbForth:")
DUP 10 20 VFILL ( DUP CURPOS and blank field)
CURPOS ! ( restore CURPOS for input)
getBFL outBFL (UB)
0 ENDOF
13 OF
fbFblk @ DUP IF ( check for valid fbForth block#)
outBFL @ DUP IF ( check for valid fbForth blocks file)
SWAP ( get starting dst block# to TOS)
TIFblk @ ( get starting src block#)
clrLstLn
." How many blocks? " get# ( ask for # of blocks to copy)
OVER + SWAP ( calculate lim and idx for cpyTI2FB)
clrLstLn ( put cursor where block#s copied will print)
cpyTI2FB ( copy src TI Forth blocks to dst file)
." done" keyPrompt
ELSE
SWAP DROP ( get rid of extra value)
THEN
THEN
0= IF ( check for error flag)
clrLstLn
." fbForth block#|file not set!" keyPrompt
THEN
0 ENDOF ( save TI Forth block to fbForth blocks file)
0F OF PAGE 1 ENDOF ( Exit)
ELSEOF 0 ENDOF
ENDCASE
UNTIL
;
DECIMAL
: TIFVU ( IS:blk# DSKn)
GNUM DUP TIFblk ! getDsk getTIblock
VDPMDE @ 2 < IF
saveCurBFL
BOXCHRS
drawScrn
12 1 GOTOXY Dsk @ .
TIFblk @ 8 2 dspBlk#
dspBlock
cmd
curBFL (UB)
ELSE
CR ." TEXT or TEXT80 modes only!"
THEN
;

 

 

 

The three commands, TIFBLK , TIFIDX and TIF2FBF work the same as before (see posts #1125 and #1126). TIFVU is invoked as before (see post #1129), but is now complete with block-copying.

 

With the completion of TIFVU , I suppose I could dispense with TIFBLK and TIF2FBF because their functions are included in TIFVU . Those two words only use 100 bytes of the 2804 bytes of the above code. There are support words unique to those two words that would also be removed; but, I don't know what the space savings would be, yet. What do you think I should do?

 

Whatever I decide to do, I will update FBLOCKS in post #1 in the next few days.

 

...lee

Link to comment
Share on other sites

WIN 10 is just a bad thing. . .nice features, but totally user unfriendly. It randomly removes programs it doesn't like, monitors your every move and provides the data back to Microsoft for them to sell to advertisers, and updates things it shouldn't be touching at all by replacing vendor tuned drivers with vanilla Microsoft drivers that disable most of the features of the vendor-supplied hardware drivers. Really, an operating system to be avoided at all cost. last but not least, there have been instances of it doing the update from Windows 7 to Windows 10 without user input or assent--one day you wake up and your machine has been mutilated beyond recognition. . .it does not play well with others.

 

Glad to see you are getting close to final on the FBLOCKS code though.

Link to comment
Share on other sites

I updated my Windows partitions to Windows 10, but actually, there is nothing to be too happy about. Lots of stuff I'll probably never use (like tiles in the start menu or Cortana).

 

In order to allow the update to proceed I had to restore the original Master Boot Record, since I kept getting error messages like "8007001F". Now don't tell me that Linux is cryptic: I never got such error messages from Linux. By the way, 8007001F translates to "A device attached to the system is not functioning", and this can be fixed by restoring the MBR? Pack of noobs, sorry.

 

After installing I restored the MBRs to boot GRUB again, and things seem to run so far. With one exception: Up to Windows 7, I was at least able to watch Blurays on Windows. Now, after the upgrade, the "BD advisor" from CyberLink considers the same hardware configuration as inappropriate (blaming it on the AMD driver).

 

If you plan to do the same folly, beware of the "Express installation" option in the installation process and find the user-defined settings option in small font size on the far left side. You should turn off all those privacy-impairing options on the next screens.

Link to comment
Share on other sites

I'm using Win7 Enterprise... But I am thinking of jumping back to XP. Win7 is extremely resource-hungry...

 

Win10 sounds like the devil.

 

Maybe someone could write an OS in Forth so we could just forget Microsoft altogether. ;)

 

7 generally does better on lower end hardware than XP... what are you using to make the resource-hungry determination?

 

if you're just looking at memory usage, that doesn't count. The memory managers were changed in Vista to consume as much RAM as possible for caching to improve performance, but the cache is easily recycled when an application needs it.

 

If it's an actual feel of sluggishness and you're /actually/ hitting the walls, then you need to adjust the configuration. Out of the box it does load a lot of crap, but just like XP and every earlier version, you can turn that crap off. Properly configured, 7 will work as well as XP if not better.

 

10... I'm still out on. it's running on my tablet acceptably but rarely has access to the internet and is largely used for writing text. As for the "unintended" upgrades from 7 to 10... I doubt it was completely without user interaction. But a single misplaced click is all it takes thanks to the genuinely annoying "upgrade to 10 for free" push. It's really how hard they are pushing that which has me hesitating as well...

Link to comment
Share on other sites

 

To prevent Win 7/8/8.1 from tracking you, uninstall and lock the following updates (if exists):

KB2876229,KB2923545,KB2990214,KB3021917,KB3022345,KB3035583,KB3050265,KB3068708,KB3075249,KB3080149

 

Did it, scared the heck out of me... it took 50 minutes of.. "Preparing to configure Windows Do not turn off your computer" before I got control back.

Link to comment
Share on other sites

yes, I rmember one update that says this "do not power off bla" for hours, but if you pressed Ctrl-Alt-Del once, zack there was the login-screen.

But in general, if you can wait, this is a clear advantage! These are almost the .NET-updates which take so long. you can see the harddisk-activies.

 

Once uninstalled all this updates I mentioned here, you should go to Microsoft/Windows-Updates again,

and PRESS <Search> for updates. Normally the just uninstalled updates are re-offered then,

and you have to left-klick and <hide> them, to prevent from coming back at the next update :)

 

It was interesting to see people here on AA updateing their machines, you could seee that in the last months,

by this AA-messenger here, that they "changed" or "entered" their location. Maybe you remember this.

This came from a telemetry-"security"-update, maybe KB3068708. I think it "opened" something.....

 

Big Brother is smashing aargh watching us :)

Link to comment
Share on other sites

OK...Back to the TI Forth Viewer/Copier---

 

No one has commented about preferences; so, I will be keeping all of the utilities together for now. I have just posted the latest FBLOCKS file to post #1, which includes the TI Forth Block Utilities, TIFBLK , TIFIDX , TIF2FBF and TIFVU , starting at block #65. Check it out and give me feedback, please.

 

...lee

  • Like 1
Link to comment
Share on other sites

You can practice using the TI Forth Viewer/Copier on these disk images:

 

4TH14.DSK4TH15.DSK4TH16.DSK4TH23.DSK584.DSKCS09013.DSK

 

You will notice that things sometimes go awry when you view blocks that contain binary code, which happens with TI Forth system disks because blocks in the 6-19 range contain the Forth system programs (machine code). There will invariably be occurrences of backspace, linefeed, carriage return and bell that will mess up the screen and force you to exit and restart the viewer. This will, in all likelihood, also happen with BSAVEd blocks. I need to write a word for the viewer to replace EMIT8 --- one that will ignore those special ASCII codes. I will post an updated FBLOCKS when I get that done in the next day or two.

 

Perhaps I should also develop a utility for reading and writing DV80 files to and from fbForth blocks files. What do you think?

 

...lee

Link to comment
Share on other sites

That would be helpful.... Tonight I was beating my head against a wall trying to load a DV80 file into TI WRITER and eventually gave up. Being able to load 80 columns into a block for reading would be exceptional. :)

 

H-m-m-m...That wasn't quite what I had in mind. What you suggest is actually the beginnings of a more general-purpose text editor—something I have certainly been considering.

 

What I have in mind is simply the transfer to and from DV80 files to facilitate sharing and publication of Forth blocks. The easiest tack is to limit the line-length of DV80 files used by this utility to 64 characters. This would mean that DV80 files read by the utility would truncate any lines longer than 64 characters and read 16 lines per block, effectively making the DV80 file a pseudo blocks file, with 16 lines/block. This may seem obvious; but, blocks files do not have line delimiters as do DV80 files. They are simply 1024 contiguous characters/block in four 256-byte sectors (eight 128-byte, fixed-length records) of a DF128 file.

 

One problem with this scenario is that there is no easy way to know whether any lines have been truncated. One solution would be to change the last (64th) character of each line longer than 64 characters to a special, easily recognized character upon import—or, alternatively, to provide a pre-scan function that would report a list of lines that are too long.

 

There is a problem with the special-character-at-the-end-of-the-line solution, viz., Forth blocks can contain binary data. This would result in random occurrences of the special character in binary blocks.

 

You get the picture. Any suggestions will certainly be appreciated. We can design this thing together! :)

 

...lee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...