Jump to content

Photo

fbForth—TI Forth with File-based Block I/O [Post #1 UPDATED: 04/28/2017]

fbForth Forth TI Forth

1390 replies to this topic

#1376 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Mon Apr 17, 2017 7:54 AM

And if you are taking extra space for 2 INCT instructions, ADDI is faster no?

 

B

 

At 14 clock cycles and 4 memory accesses, indeed it is!

 

...lee



#1377 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Sat Apr 22, 2017 8:28 PM

I have updated post #1 with the latest FBLOCKS file in ZIP format.  It now includes the Compact Flash Utilities, CF? , CFMOUNT , CFVOLS discussed a few posts back.

 

I am still working on updating the manual and still hoping to have that done by Fest West time—we shall see.  |:)

 

...lee



#1378 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Sat Apr 29, 2017 9:29 PM

The April 28, 2017 update to fbForth 2.0: A File-Based Cartridge Implementation of TI Forth (the manual) has been announced at Fest West 2017 and is posted to post #1 of this thread.  It includes all changes since the June 20, 2015 revision.  It is up to date as of fbForth 2.0:9 and FBLOCKS 19APR2017.

 

...lee



#1379 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Sun May 28, 2017 12:41 PM

I am in the process of getting the manual, fbForth 2.0: A File-Based Cartridge Implementation of TI Forth, in shape to publish as a book that will be available on Amazon.com.  My knee surgery (successful and recovering fast!) has slowed this down considerably.

 

While reviewing Chapter 18 “Signed Integer Division”, I noticed several instances of “signed integer division” that should be “symmetric integer division”.  I don't think I will post a revised copy of the manual to post #1 until I publish the book.  Both symmetric and floored division are signed, so it should be obvious that “signed integer division” should be “symmetric integer division” where it is compared to “floored integer division”.

 

...lee



#1380 apersson850 OFFLINE  

apersson850

    Moonsweeper

  • 361 posts

Posted Tue May 30, 2017 12:16 PM

I noticed at the beginning of this thread that a Forth verson places "NO" in a lot of words of memory. The UCSD p-system places "NO" at a specific memory location when you halt it, to prevent it from starting the next time you warm start your computer.



#1381 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 253 posts
  • Location:The Great White North

Posted Thu Jun 8, 2017 3:54 PM

I noticed at the beginning of this thread that a Forth verson places "NO" in a lot of words of memory. The UCSD p-system places "NO" at a specific memory location when you halt it, to prevent it from starting the next time you warm start your computer.

 

By NO do you mean  no-OP instruction?

 

Which Forth system were you looking at?

 

I am wondering if you were looking at threaded code that is just the same numeric value as 'NO'. 

There is not inherent reason I can think of for adding NOPs to a Forth system.

 

BF



#1382 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Thu Jun 8, 2017 9:44 PM

By NO do you mean  no-OP instruction?

 

Which Forth system were you looking at?

 

I am wondering if you were looking at threaded code that is just the same numeric value as 'NO'. 

There is not inherent reason I can think of for adding NOPs to a Forth system.

 

BF

 

Anders' (apersson850) observation is from TI Forth's definition of MON ("monitor"), the functional equivalent of FCTN+=, which performs a soft system reset of the TI-99/4A.  The code fills the lower 8 KiB of expansion RAM with the ASCII code for the capital letters “NO” or 4E4Fh.  It effectively fills low RAM with nonsense code.  The TI Forth Assembler for MON follows:

 

HEX
CODE MON
   0 4E4F LI, 
   1 2000 LI,
   BEGIN,
      0 1 *?+ MOV,
      1 4000 CI,
   EQ UNTIL,
   0 @() BLWP,

 

[EDIT]
 
Note that the code above does not end with NEXT, (as it normally should to return to the Forth interpreter) because the last instruction never returns to Forth.
 
In the interest of clarity for those who are unfamiliar with TI Forth, the equivalent fbForth code is
 
HEX
ASM:  MON
   R0 4E4F LI, 
   R1 2000 LI,
   BEGIN,
      R0 *R1+ MOV,
      R1 4000 CI,
   EQ UNTIL,
   0 @() BLWP,
 
The above has no terminating ;ASM for the reason already cited.
 
The actual fbForth code for MON only clears the ISR hook before branching to the console's startup code (also, no terminating ;ASM ):
 
ASM:  MON
   83C4 CLR,
   0 @() BLWP,
 
[/EDIT]
 

...lee



#1383 apersson850 OFFLINE  

apersson850

    Moonsweeper

  • 361 posts

Posted Fri Jun 9, 2017 2:16 AM

Yes, that's what I referred to. I associated this with a similar behavior in the UCSD p-system. Normally, when you start up the TI 99/4A, and have an active p-code card in the machine, the p-code card will never return control to the machine after executing it's power up routine. That's why they gave the p-code card CRU base address >1F00, so that it would always be the last one to run.

 

But if you let the p-code card start, then stop it by the Halt instruction, it will load "NO" in a certain memory location in 8 K RAM. If you then reboot the 99/4A, the p-code card will find "NO" at this location and then return from the power up routine, without taking over the console.

 

Back when I used the 99/4A a lot, I knew the correct CALL LOAD(xxxx,78,79) from BASIC to disable the p-system, but I don't remember the address any longer. The p-system only stores "NO" in one place, to prevent a start.

 

This has nothing to do with the opcode for JMP 0, sometimes called NOP.



#1384 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Mon Jul 17, 2017 9:45 AM

Not that I really want to suggest that anyone not use the structured Assembler constructs detailed in Sections 9.6 – 9.8 of the fbForth 2.0 Manual (inherited from the TI Forth Manual), but Chapter 9 includes Forth definitions the TMS 9900 Assembler jump instructions ( JMP, , JEQ, , ... ) and I am considering showing how to use them if someone insists or is just curious.
 
The defining word for JMP, , JEQ, , ... is
 
HEX  : DOP <BUILDS , DOES> @ SWAP 00FF AND OR , ;
 
and, JEQ, is defined as follows:
 
HEX  1300 DOP JEQ,
 
which expects a word offset of -128 – +127—see the ANDing of the offset with >00FF in the definition of defining word DOP above.
 
That is straightforward enough, but I would like to suggest a way to use labels and have not yet figured that out
 
Any ideas?
 
...lee


#1385 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 253 posts
  • Location:The Great White North

Posted Mon Jul 17, 2017 1:25 PM

For labels I stole an idea from Win32Forth Assembler. It was an older version. Not sure if it still works this way.

It creates pre-defined labels. It's kinda complicated, but it works with one caveat.

Forward jumps can only go to one label.  ie for each forward jump, you must use a separate label.

It could be fixed with a stack but I did not get to it yet.

 

Notes:

1. the ]ASMerr stuff inside IF statements could be replaced with ABORT" .  

2. CODE words need to start by erasing the jump-table. (CLR-JMPTABLE word)

3. THERE can be replaced with HERE.  THERE is my word for "target" HERE for my cross-compiler

 

As noted in the comments, I also create labels in this assembler which are just constants that record the dictionary pointer.

The labels are used by B BLWP and BL.

 

It could use a re-write so that the labels would work with the jump instructions. That would require a little word and then all

jumps would have to be PREFIX because they would have to parse the label string.  

 

Hope this is useful.

 

Spoiler


#1386 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Mon Jul 17, 2017 10:21 PM

H-m-m-m...Thanks for that, TheBF, but I really do think it is far better to use the structured Assembler constructs:

 

IF, … THEN,
IF, … ELSE, … THEN,
BEGIN, … UNTIL,
BEGIN, … AGAIN,
BEGIN, … WHILE, … REPEAT,
 

rather than the branch and jump instructions,

 

B, BL, BLWP, JMP, JNE, JGT, JLT, JLE, JL, JHE, JH, JLT, JGT, JOC, JEQ, JNO, JOP, JNC, JNO, JOP,

 

because Forth words should be short routines and the structured constructs do not require the difficult-to-manage labels as do the branch and jump instructions.  Furthermore, the structured constructs are easier to follow.

 

That said, I think I will work out some explanation of the branch and jump instructions because they are, after all, defined and I think it a disservice to Forth programmers to mention them in Chapter 9 without comment of any kind as was done by the TI Forth developers and, consequently, by me in fbForth.

 

...lee



#1387 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 253 posts
  • Location:The Great White North

Posted Tue Jul 18, 2017 7:32 AM

Ah I see now that I misunderstood your needs.  You want to document them, not actually use them.

 

Then I might suggest that you simply show how the offset for a jump instruction is calculated and then show a definition for something like my +$$ word so they could see it in action. (?)

 

Just my 2 cents Canadian  ( that's only worth 1.58 cents USD these days) :-)

 

 

B



#1388 Willsy OFFLINE  

Willsy

    River Patroller

  • 2,996 posts
  • Location:Uzbekistan (no, really!)

Posted Tue Jul 18, 2017 1:36 PM

Maybe sections 6 and 7 of the TF Assembler manual might provide inspiration?

 

Looking at it now, some years after I wrote it, I think I could write a better manual. :?



#1389 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Tue Jul 18, 2017 8:59 PM

Maybe sections 6 and 7 of the TF Assembler manual might provide inspiration?

 

Looking at it now, some years after I wrote it, I think I could write a better manual. :?

 

Nope.  I think I have what's discussed there pretty well covered in the fbForth 2.0 Manual,  Willsy,

 

Well...I should not be so quick to cast aside your suggestion to look for inspiration there.  I was actually thinking of doing something for the jump instructions similar to how the structured constructs manage their jumps, but that would not work for the branch instructions.

 

...lee



#1390 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Sat Jul 22, 2017 8:05 AM

In the manual, I have included information on how to use the Forth Assembler jump instructions, which work differently in the Forth Assembler from how they work in the Editor/Assembler version.  I discourage their use, but tell you how to use them anyway.  Section 9.9 is the new section.

 

Also, note the corrected jump tokens table in Section 9.7.

 

Feel free to make suggestions/corrections in the attached Chapter 9:  Attached File  fbForth_2.0_Manual_Chapter9_20170722.pdf   203.21KB   5 downloads

 

...lee



#1391 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • Topic Starter
  • 3,240 posts
  • Location:Silver Run, Maryland

Posted Yesterday, 8:07 AM

I am in the final stages of publishing my manual, fbForth 2.0: A File-Based Cartridge Implementation of TI Forth.  It should be available on CreateSpace.com and Amazon.com in 2 – 3 weeks.  I will also bring a few copies to the Chicago Faire for interested attendees.  A public “Thank you!” to jedimatt42 for editing assistance and proofreading.

 

...lee







Also tagged with one or more of these keywords: fbForth, Forth, TI Forth

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users