Jump to content
IGNORED

TurboForth V1.2 (Beta)--Evolution & Arcana


Lee Stewart

Recommended Posts

...

I am unable to get the Floating Point Library to load and run under either TF V1.1 or V1.2 for Ti994w.

 

Does anyone get the same thing from Ti994w ?

 

Rod

 

Rod...

 

I tried, but failed, to find a similar (the same?) problem solved in a PM between Mark and me. I think it was a missing or mangled hex code or two in a CODEd definition. Anyway, the BLOCKS file from my previous post should work for TF1.2. Another thing to check: Be sure the BLOCKS file in the DSK1 directory referenced by Ti994w is the one you think it is. I got tripped up because, in flipping back and forth among the various emulators, I forgot that their default TI disk directories are different! :-o

 

...lee

Link to comment
Share on other sites

Lee:

Thanks for all the good pointers and the files. I'll work with those, and we'll see what the problem is.

I think I have a trashed entry in a file or within a block. I hosed up Classic99 once, but I stepped through

that and brought everything back to normal.

 

Instead of erasing the older files, I rename them for easy identification. That way I can easily fall back to

the previous version while debugging stuff. Did I see a recent post that WORDS was not present in this next

build? I actually use that quite a bit when I'm tracing things down......!

 

Rod Van Orden

Link to comment
Share on other sites

Lee:

...

Did I see a recent post that WORDS was not present in this next

build? I actually use that quite a bit when I'm tracing things down......!

 

Rod Van Orden

 

Rod...

 

I put the code for WORDS, which Mark posted above in message #42, on block #55 of BLOCKS_LES02. I modified it as I mentioned above in message #46. When Mark corrects the LFA of EXIT (I think he conceded it was an error :twisted:), you'll need to undo my change.

 

...lee

Link to comment
Share on other sites

Lee/Rod

 

I have a build with the LFA of EXIT corrected. I'll post it this evening (late morning for you guys!).

 

TF is currently undergoing major open-heart surgery - I'm reversing the direction of the data stack. There is barely a routine that isn't affected by it, so it's going to need some serious testing!

 

Also, some of the libraries (the machine code bits) will need to change for V1.2 (sorry!).

 

For example:

 

*SP R0 MOV,

SP DECT,

 

The above moves data from the top of stack into R0 and reduces (pops) the stack pointer.

 

This can now be implemented as:

 

*SP+ R0 MOV,

 

Which pops the stack into R0 as a single instruction. Both a space improvement and a performance improvement. Should have bloody done it in the first place. That's what happens when you dive in and don't do a design first! :dunce:

Link to comment
Share on other sites

Lee/Rod

 

I have a build with the LFA of EXIT corrected. I'll post it this evening (late morning for you guys!).

 

TF is currently undergoing major open-heart surgery - I'm reversing the direction of the data stack. There is barely a routine that isn't affected by it, so it's going to need some serious testing!

 

Also, some of the libraries (the machine code bits) will need to change for V1.2 (sorry!).

 

For example:

 

*SP R0 MOV,

SP DECT,

 

The above moves data from the top of stack into R0 and reduces (pops) the stack pointer.

 

This can now be implemented as:

 

*SP+ R0 MOV,

 

Which pops the stack into R0 as a single instruction. Both a space improvement and a performance improvement. Should have bloody done it in the first place. That's what happens when you dive in and don't do a design first! :dunce:

 

Mark...

 

Wow! You've been busy! I suppose you expect us to do some of the testing, :D

 

Speaking of major changes, I am debating on how to manage the conversion of the VDP RAM stack for the FP/TR library. I am leaning towards putting it in non-scratchpad CPU RAM instead of trying to find the space in scratchpad RAM. Most of the time I think 2 values (16 bytes) is enough, but sometimes up to 4 values (32 bytes) may be necessary. I will definitely put the VDP rollout area, used by the TR routines, in non-scratchpad RAM. At least, putting the VDP stack in non-scratchpad RAM will be faster; but, of course, it would be faster still to find room for it in scratchpad RAM. Thoughts?

 

...lee

Link to comment
Share on other sites

...

latest BLOCKS_LES02 ... .

 

Rod...

 

After loading Willsy's latest build of TF v1.2, don't forget to remove the second @ in line 10 of block 55 of the above file. The rest of my addition (TERMINAL? IF DROP 0 THEN) allows aborting the word listing with <break> (FCTN 4).

 

...lee

Link to comment
Share on other sites

Mark: Thanks for the new build.

 

Lee:

I'll get set up with my emulators/simulators, etc. Thanks for the info. Also.........

 

I need to shut off the 80-column toggle when EDIT is invoked under Win994a. That simulator only supports 40-column,

and the current EDIT word of V1.2 R-15Sep12 freezes up. I thought there was a variable I needed to alter before invoking

the EDITor.....?

 

Rod

Link to comment
Share on other sites

I need to shut off the 80-column toggle when EDIT is invoked under Win994a. That simulator only supports 40-column,

and the current EDIT word of V1.2 R-15Sep12 freezes up. I thought there was a variable I needed to alter before invoking

the EDITor.....?

 

Rod

 

Rod...

 

In block 1, EDIT is redefined to change to 80-column mode for editing, use the previous EDIT definition for the actual editing and change back to 40-column mode upon exiting the editor. Because it is the last word defined, you can easily FORGET it to revert back to EDIT's using whatever mode you set---before you load or define other words, of course.

 

...lee

Edited by Lee Stewart
Link to comment
Share on other sites

Mark and Lee:

OK. I am all squared away on the updates in Classic99 and in Ti994w. I finished putting together the cart file and the disk file

for the Win994a simulator. The editor will now only open up in 40-columns under Win994a (BLOCKS File, block 1 was modified to

execute 0 GMODE instead of 2 GMODE. The BLOCKS file was also altered on line 10 block 55 to remove the extra @, as you

advised in Post #59. I am uploading the TiDisk and TiCart files for TF V1.2 Pre-Release 15-Sep-12. I hope you like the cartridge label....

 

Rod

Link to comment
Share on other sites

Well, AtariAge won't let me upload the TiDisk and TiCart files.........

Something about prohibiting that kind of file.........

Sorry about that.

I posted them to the TurboForth Group on Yahoo.

 

Rod

 

Rod, only a few file extensions are allowed. I usually wrap my files up in a zip file and that does the trick ;)

Link to comment
Share on other sites

OK.

I guess I got a little mixed up yesterday. There is a good possibility that the TiCart file for Win994a ----- the one I posted

yesterday------ got the wrong TurboForth C and D files......! Imagine my surprize when I got home, cracked open a cold

beer and loaded up the "latest" TF V1.2 for Win994a..................... As soon as I found WORDS missing, I knew the Byte

Gods had taken another bite once again. Ouch!

 

Soooo....... The attachment to this post should be the right one. The TiCart file has TurboForth V1.2 Pre-Release 15-Sep-12,

and the TiDisk file contains Lee's BLOCKS file. There are two modifications to his BLOCKS file:

 

Block #1

The video mode was changed from 2 (80-columns) to 0 (40-columns. Cory Burr's Win994a does not support 80-column (yet),

and doing a 2 GMODE will lock up your video system.

 

Block #55

Lee advised removing the second @ on line 10, and that's exactly what I did.......

 

For those of you (us?) who use Win994a, let everyone know how this all works for you........

 

 

ROD VAN ORDEN

San Diego, California

CORRECTED TF-V1.2 15-Sep12 for Win994a.zip

Link to comment
Share on other sites

I modified @Willsy's definition of words to include the capability of pausing the word list by importing (and modifying to accommodate using -1 instead of 0 for no keystroke) a TI Forth word ( PAUSE ) used for this purpose:

 

 

: PAUSE ( --- flag)

KEY? DUP 2 = IF DROP -1 \ <break>?, leave true

ELSE

0< IF 0 \ no key?, leave false

ELSE

BEGIN KEY? 0< UNTIL \ debounce

\ pause (loop) until a keystroke

BEGIN KEY? DUP 0< WHILE DROP REPEAT

2 = IF -1 \ <break>?, leave true

ELSE

BEGIN KEY? 0< UNTIL \ debounce

0 \ leave false

THEN

THEN

THEN ;

 

PAUSE checks for a keystroke and issues false if none, true if <break> or idles until a second keystroke before issuing false (or true if second keystroke is <break>). PAUSE must be defined before words .

 

To use PAUSE in the definition of words , modify words as shown in red below:

 

 

: words

0 \ word count

latest \ dictionary entry to start from

begin

@ dup PAUSE NOT AND while

dup .name

swap 1+ swap

repeat

drop cr . ." Words found" CR

;

 

When using words with PAUSE from the command line, key bounce will almost certainly display only the first word in the list, requiring a keystroke to continue. Note the two debounce sections after each keystroke is detected that wait for "no keystroke" before continuing.

 

...lee

Link to comment
Share on other sites

@Willsy...

...

And, while we're at it, do you think we should add an additional place to the exponent for FP strings displayed in scientific notation? It seems a bit silly that perfectly legitimate 3-digit exponents are displayed as two asterisks. For example, 1.234 x 10120 is displayed as 1.234E+**. It's a good TI FP number and IMHO ought to be displayed as 1.234E+120. This is a function of the console conversion routines, so TI Basic, XB and TI Forth all suffer the same malady; but, while(if) we rewrite those routines, we have the power |:) to change it.

...lee

 

Hm-m-m...It turns out that Hoddie, Charlton, et al.'s Floating Point package does have a provision for a third exponent digit. It has to be flagged going into the conversion routine, but we can arrange that. I am definitely going after converting this MDOS code for our purposes here! I've actually gotten to the point of understanding how the GPL/XML console routines work; but, converting them would require translating all of the GPL code to assembly, which, with minimally commented code would be very, very painful. The MDOS code will be much easier, once I get the taskframe stuff figured out because it has a lot of good comments in the code. Some of the comments look as though the authors did what I don't want to, i.e., converted the console routines. Anyway, thanks to @InsaneMultitasker's assistance, I should be able to do this. :ponder:

 

...lee

Edited by Lee Stewart
  • Like 1
Link to comment
Share on other sites

...

Next, each OS task or program has its own header for multitasking, interrupts, and info passing. In this snippet we find the task map is DORG'd to 0x8114. The calling XOP or interrupt saves some or all of its calling memory map registers so the called routine knows how to reference its caller.

 

File:HDS2.MDOS.HEAD.OSTASK Page: 3 Date: 10-30-04 Time: 01:50:13
DORG >8100
TSKTBL BYTE 00		 TASK ID #
MAXDRV BYTE 'G'		 MAXIMUM ALIAS LETTER USER CAN SPECIFY
STATE BYTE >FF		 PROCESS STATE
SLICE BYTE 6		 NUMBER OF SLICES LEFT UNTIL SWAPPED OUT
PNAME TEXT '	 ' NAME OF THIS TASK
UWP DATA >F000	 USER WORKSPACE POINTER
UPC DATA >0400	 USER PROGRAM COUNTER
UST DATA >0002	 USER STATUS REGISTER
MEMLST DATA 0		 POINTER TO MEMORY LIST
TSKMAP DATA 0,0,0,0	 SAVED MEMORY MAP USED DURING XOPS AND INTERRUPTS
CURDRV DATA ALIASA	 POINTER TO CURRENT DRIVE ENTRY

You could probably convert these routines fairly easily once you get past the initial memory mapping code.

 

Not that this matters except for my sanity, by my count TSKMAP is DORGed to 0x8112. Did I miss something?

 

...lee

Link to comment
Share on other sites

I modified @Willsy's definition of words to include the capability of pausing the word list by importing (and modifying to accommodate using -1 instead of 0 for no keystroke) a TI Forth word ( PAUSE ) used for this purpose:

 

 

: PAUSE ( --- flag)

KEY? DUP 2 = IF DROP -1 \ <break>?, leave true

ELSE

0< IF 0 \ no key?, leave false

ELSE

BEGIN KEY? 0< UNTIL \ debounce

\ pause (loop) until a keystroke

BEGIN KEY? DUP 0< WHILE DROP REPEAT

2 = IF -1 \ <break>?, leave true

ELSE

BEGIN KEY? 0< UNTIL \ debounce

0 \ leave false

THEN

THEN

THEN ;

 

PAUSE checks for a keystroke and issues false if none, true if <break> or idles until a second keystroke before issuing false (or true if second keystroke is <break>). PAUSE must be defined before words .

 

To use PAUSE in the definition of words , modify words as shown in red below:

 

 

: words

0 \ word count

latest \ dictionary entry to start from

begin

@ dup PAUSE NOT AND while

dup .name

swap 1+ swap

repeat

drop cr . ." Words found" CR

;

 

When using words with PAUSE from the command line, key bounce will almost certainly display only the first word in the list, requiring a keystroke to continue. Note the two debounce sections after each keystroke is detected that wait for "no keystroke" before continuing.

 

...lee

 

Here's a shorter version that does the same thing: Hold any key to pause the listing. Press FCTN 4 to stop the listing. It occurred to me that checking the keyboard after displaying each word was somewhat wasteful... Might as well just check once per line. Well, a good place to do that is in WRAP which does a word-wrap:

 

: wwrap ( len -- len)
 \ move to next line if string won't fit on remainder of line
 dup xy? drop + xmax >= if cr break? begin key? -1 = until then ;

: .name ( dict_addr -- )
 \ display name of word at dict_addr
 2+ dup @ 15 and swap 2+ swap wwrap type  2 spaces ;

: words
 0 \ word count
 latest \ dictionary entry to start from
 begin
    @ dup while
    dup .name
    swap 1+ swap
 repeat
 drop  cr . ." Words found" CR
;

 

I think my 'pause' code is much clearer than TI Forth's PAUSE. Do I get a prize? ;)

  • Like 1
Link to comment
Share on other sites

A bit of an update: I finally got the latest version of 1.2 to boot today. I have been going through the code, reversing the direction of the data stack. I worked from a print-out of the code but still made many errors; changing the stack direction had many subtle effects in errors that I hadn't thought about. It's saved a load of code space though, and actually seems to be a bit faster - though it might be my imagination*.

 

Lee, would you mind stress-testing the following Math words:

  • */
  • UM*
  • /MOD
  • */MOD
  • UM/MOD

I've checked the other math words and they seem to be fine. It boots from the blocks disk, so that is a VERY good sign. I'm sure there will be a few more bugs lurking in there somewhere though.

 

The REALLY good news is that changing the stack direction has freed up (at the time of writing) an extra 166 bytes in bank 0 (326 bytes free) and an extra 66 bytes in bank 1. Bank 0 = 326 bytes free. Bank 1 = 222 bytes free. Where code is smaller, it is faster!

 

I'll keep checking through various words over the next few days. I tried the snake demo, and to my delight it ran just fine.

 

Bare in mind that libraries that use machine code will probably blow up - they need the machine code changing to account for the reversed data stack. I'll get to it after testing!

 

TF-V1.2-26-Sept-2012.zip

 

Mark

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...