Jump to content

Recommended Posts

Lee, I'm booting fbforth from tipi,(drv 4) but it always comes back to floppy disk 1 for fblocks. How can I keep fbforth looking for drive 4 for fblocks instead of drive 1.(DR0)

Thx

Also, I've got everything loaded up and personalized. I just now need to start working on SAMs for it.

 

IMG_20201009_150929606.jpg

Edited by GDMike
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650511
Share on other sites

1 hour ago, GDMike said:

Lee, I'm booting fbforth from tipi,(drv 4) but it always comes back to floppy disk 1 for fblocks. How can I keep fbforth looking for drive 4 for fblocks instead of drive 1.(DR0)

Thx

 

That is built into fbForth 1.0. I will see what I can do to make it possible to change that. It may take me a little time to re-orient myself to fbForth 1.0.

 

...lee

  • Thanks 1
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650573
Share on other sites

On 10/8/2020 at 3:12 PM, Lee Stewart said:

 

The code for TurboForth is in TMS9900 ALC as is the  code for fbForth 2.0. I would use fbForth 2.0’s code because the Forth-system-register numbers are the same as used by TI Forth. If using the Forth Assembler, you will need to translate the TMS9900 ALC to Forth ALC. Also, you cannot use low-expansion RAM for paging because you would step on the system support code and the Forth block buffers. For that, you should use the high end of high-expansion RAM and relocate S0 (Parameter Stack Base) and TIB (Text Input Buffer), which is effected in fbForth 2.0 with S0&TIB! . Before all of this, you need words to turn SAMS on and off. I do not think you can initialize SAMS to anything different from the default mapping once TI Forth is booted (page numbers to corresponding 4-KiB-RAM boundaries, viz., page 2:>2000, ..., page >F:>F000).

 

Of course, the above scenario can also be implemented in high-level Forth code. I will put together a set of words for TI Forth that will manage SAMS as described above, first in Forth and then in Forth Assembler.

 

I have included the ALC and comments for fbForth 2.0’s >MAP in the spoiler for your delectation:

  Hide contents


;[*** >MAP ***       ( bank addr --- )
* ...originally ported from TurboForth code courtesy of Mark Wills
* ...modified to handle 128 KiB -- 16 MiB
* 
* Address, addr, should be a valid address on a 4K boundary (e.g., >2000,
* >3000, >A000, >B000, >C000, >D000, >E000 or >F000). Bank should be a number
* between 0 and >0FFF. >0FFF is the top page of 4096 possible with 16 MiB SAMS.
*
* Important Notes: 
* 
* When a SAMS memory expansion card is fitted, the 32K of CPU RAM is actually
* taken from the SAMS memory. At startup fbForth reserves the following banks
* of SAMS memory for "standard" 32K RAM, which are the default startup banks:
* 
*        Bank   Description
*        -----  -----------
*        >0002  4K @ >2000
*        >0003  4K @ >3000
*        >000A  4K @ >A000
*        >000B  4K @ >B000
*        >000C  4K @ >C000
*        >000D  4K @ >D000
*        >000E  4K @ >E000
*        >000F  4K @ >F000
* 
* fbForth reserves lower RAM (>2000..>3FFF) for 4 block buffers, low-level
* support, system variables and the return stack, therefore extreme care
* should be taken when paging banks >0002 and >0003 out of >2000 and >3000,
* respectively.  The same care should be taken with upper RAM when paging
* banks >000A and >000F out of >A000 (start of User Dictionary) and >F000
* (TIB and base of parameter stack).
*
* Because the RAM portion of the dictionary grows up from >A030 and the
* parameter stack grows down from >FFA0, extreme care must be taken mapping
* SAMS memory.  It is probably advisable to limit SAMS mapping to one or two
* 4KiBb window(s) at >E000 and/or >F000.  If >E000 is used, the stack is
* limited to 2000 cells, which is probably sufficient for most programming.
*
* S0&TIB! can be used to change S0 and TIB (same address) to just below the
* the lower SAMS paging area. This will also restore the TIB and copy S0 and
* TIB to the default values table so that the settings will survive a COLD
* start. If you were to decide to use >E000 and >F000 for 2 SAMS blocks, you
* would type 
*             >D000 S0&TIB!
* to set S0 and TIB to >DFA0 and to copy the old TIB contents to the new.
*
* Previous builds of fbForth assumed a 1 MiB SAMS memory card, but since build
* 13, 128 KiB -- 16 MiB SAMS cards are allowed.
* 
* If a SAMS card is present, >MAP maps memory bank "bank" to address "addr"
*
*        DATA SOUN_N
* TOMP_N .name_field 4, '>MAP '
* TOMAP  DATA $+2
*        BL   @BLF2A
*        DATA _TOMAP->6000+BANK2

_TOMAP MOV  *SP+,R1           get address
       MOV  *SP+,R2           get bank
       ANDI R1,>F000          set to 4KiB boundary
       SRL  R1,11             divide by 2048
       AI   R1,>4000          convert to SAMS register address
       MOV  @SAMSFL,R0        get SAMS flag to R0
       INV  R0                invert it for mask
       SZC  R0,R2             mask off pages too high
       SWPB R2                reverse byte order for writing to SAMS register
       LI   CRU,>1E00         CRU address of SAMS
       SBO  0                 enable SAMS registers
       MOV  R2,*R1            poke SAMS register
       SBZ  0                 disable SAMS registers
       B    @RTNEXT           back to inner interpreter
;]

 

...lee

Can someone compile this for me?

 

Edited by GDMike
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650648
Share on other sites

2 hours ago, GDMike said:

Turboforth had a  S." DSK1.BLOCKS" USE

Word. I think it was

 

If the FBLOCKS file you want to use is on DSK3:

USEBFL DSK3.FBLOCKS

To create MYBLOCKS (use whatever name you like, of course) on DSK4 with 80, 1-KiB empty blocks:

MKBFL DSK4.MYBLOCKS 80

See Chapter 3 for the above information.

 

...lee

  • Thanks 1
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650666
Share on other sites

31 minutes ago, Lee Stewart said:

 

If the FBLOCKS file you want to use is on DSK3:


USEBFL DSK3.FBLOCKS

To create MYBLOCKS (use whatever name you like, of course) on DSK4 with 80, 1-KiB empty blocks:


MKBFL DSK4.MYBLOCKS 80

See Chapter 3 for the above information.

 

...lee

Yes. I understand that "MKBFL" very well. 

Thank you!!!

Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650683
Share on other sites

1 hour ago, TheBF said:

I know a Forth system that uses DV80 files and the E/A cartridge editor :)

 

Just kidding.  Better docs with the other systems. Stick with what you know.

The docs are saving my butt for sure. I find that when im writing a lengthy routine, as I was last night, when I got to near the bottom of my 2nd or 3rd block/screen, I said to myself, I think that's right, if not I'd have to go rewrite the whole thing over because I couldn't remember my 2nd routine I just wrote 10 mins earlier.  Oh my my.

Lucky for me, it usually works out. But I was like, damn!! It better work or im screwed... lol that's my internal issue.. nuff said

Edited by GDMike
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650692
Share on other sites

13 minutes ago, GDMike said:

The docs are saving my butt for sure. I find that when im writing a lengthy routine, as I was last night, when I got to near the bottom of my 2nd or 3rd block/screen, I said to myself, I think that's right, if not I'd have to go rewrite the whole thing over because I couldn't remember my 2nd routine I just wrote 10 mins earlier.  Oh my my.

Lucky for me, it usually works out. But I was like, damn!! It better work or im screwed... lol that's my internal issue.. nuff said

Secret to the block editor and Forth is test each routine before you move on.

Don't (never) write long routines. Keep each Forth word you write small and to the point.   

Chuck's word definitions were 7 to 9 words long on average. Then use those words together to make the next word etc.

If you test as you go you can trust each block when you move to the next one.

 

Later when it all works you can consolidate easily if you need to.

 

My 2 cents

 

  • Like 2
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650705
Share on other sites

6 hours ago, GDMike said:

Can someone compile this for me?

6 hours ago, Lee Stewart said:

Workin’ on it...

 

Here are the necessary SAMS words:

Spoiler

( CRU words must be loaded: block 20)
HEX
( Change this constant's value to the highest SAMS page in your system.)
( The setting below is for page 255, the highest page for 1 MiB SAMS.)
0FF CONSTANT SAMS?  ( highest SAMS page)

: SAMS-ON   ( -- )
   0F01 SBO       ( enable SAMS mapping )
;
: SAMS-OFF  ( -- )
   0F01 SBZ       ( disable SAMS mapping)
; 
( Initialize SAMS and, eventually, set SAMS? .)
: SAMS!  ( -- )   ( to be written)
;
( *** S0&TIB! *** Set S0 and TIB [same address] to a new value.)
( This word is primarily for use in a SAMS environment, where it is or may)
( be necessary to move the stack base and TIB buffer, both of which start)
( up at the same address, viz., >FFA0.  S0&TIB! forces addr1 to >DFA0,)
( >EFA0 or >FFA0; copies it to the User Variables, S0 and TIB, in the table)
( of default values so the settings will survive COLD; copies the old TIB)
( to the new TIB; ignores the old stack; clears the new stack;  and leaves)
( the new address on the new stack as addr2.  The lower limit is forced)
( above HERE so as not to destroy the user's dictionary.)

: S0&TIB!  ( addr1 --- addr2 )
   F000 AND                   ( force to 4 KiB boundary n)
   DUP HERE U< IF             ( corrected addr1 >= HERE?)
      ." S0 too low! " ABORT  ( no..abort)
   THEN
   0FA0 OR                    ( force addr1 to nFA0)
   >R                         ( copy new address [addr2] to return stack)
   TIB @ R 052 CMOVE          ( copy 82 bytes from old TIB to new TIB)
   R UCONS$ @ 08 + !          ( store new default S0 )
   R UCONS$ @ 0E + !          ( store new default TIB)
   R TIB !                    ( store new TIB)
   R S0 !                     ( store new S0)
   SP!                        ( reset top of stack)
   R>                         ( new address to new stack)
;
( >MAP presumes the SAMS card mapping is enabled.)
: >MAP   ( bank addr -- )
   ( set up SAMS register address)
   F000 AND                ( set to 4KiB boundary)
   0B SRL                  ( divide by 2048)
   4000 OR                 ( convert to SAMS register address)
   ( set up bank information)
   SWAP SAMS? AND          ( mask off pages too high)
   SWPB                    ( reverse byte order to write to SAMS register)
   ( map bank)
   0F00 SBO                ( enable SAMS registers)
   SWAP !                  ( poke SAMS register)
   0F00 SBZ                ( disable SAMS registers)
;
DECIMAL

 

I have not yet written SAMS! , the SAMS initializing word. Right now, you can probably get away with the normal mappings until I do. Until you figure out how much dictionary space you need, you should probably only mess around with banking in the >F000 block. You might get away with adding the >E000 block, but I wouldn't push it. To use just >F000, move TIB and stack to >EFA0 and turn on SAMS mapping:

HEX E000 S0&TIB!
SAMS-ON

If you must use two blocks, this will move the TIB/stack to >DFA0:

HEX D000 S0&TIB!
SAMS-ON

Right now, S0&TIB! will not allow you to put the TIB/stack in the same block as HERE , but we can change that.

 

You should set SAMS? to your highest SAMS page. The word, as supplied, is set for 00FF16, the highest page for 1 MiB SAMS. For Classic99’s 32 MiB SAMS, you can set it at 1FFF16. Now, you can map, say, bank >00F0 to >F000:

HEX 0F0 F000 >MAP

 

...lee

  • Thanks 1
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4650848
Share on other sites

The word >MAP isn't recognized after I defined it and I got no errors at run time during compile. And it doesn't show up in vlist.

 

MAP-ON and MAP-OFF seem to be ok.

I may just wait until you have a working SAMs code for FB 1,l.

I do have things I can get out of the way in the meantime if you want to fool with SAMs and FB 1 so as not to rush you if you don't mind building it. 

I have no issues, btw of just using >F000, but I was hoping for something like TF uses, I can say... for example

 "2 BANK" and start defining words, and my new word 'FREE" that you put together shows 4096 or something like that, bytes free, and if I needed another bank, I just do 3 BANK..etc.

But yes sir. It would be nice.

And an instruction set would be something I'll probably need, as maybe I'm just not doing something right here. ? 

 

Edited by GDMike
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4651004
Share on other sites

Very sorry. I have been awol on helping out here but I have not used TI-Forth for a very long time.

I took a quick run at porting my SAMSFTH.FTH file to FbForth but I am missing something.

 

The features that it has that might be useful are:

1. DMAP is like SETBANK (rename it for your needs) but it records the bank# in a variable called BANK#.

2. It uses to 4 machine code words to save space from loading the CRU library blocks

3. After you set the DMEM constant to RAM address you want to use, it computes the SAMS register to use when you compile DMAP so it so it runs pretty fast.

3. The PAGED word lets you access any 64K section of SAMS at the cell/byte level although you take a speed hit.

 

However since it doesn't run on FbForth it's not much use except maybe for ideas.

CON:  It currently is only for DATA not CODE

 

 

Spoiler

\ SAMS CARD support for FbForth   Oct 2020  B Fox
\ 64K segmented memory model for DATA

HERE

HEX
8300 0C 2 * + CONSTANT 'R12   \ Assumes workspace=>8300

\ *** SET DMEM TO YOUR RAM PAGE ***
\ Legal values: 2000,3000,A000,B000,C000,D000,E000,F000

C000 CONSTANT DMEM    \ CPU RAM memory block location

   0 VARIABLE SEG     \ holds current 64K segment
   0 VARIABLE BANK#   \ current mapped bank

\ using machine code so we don't need the CRU library
HEX
\ *set the CRU address in 'R12 before using these words*
  ASM: 0SBO ( -- ) 1D00 ,  ;ASM
  ASM: 0SBZ ( -- ) 1E00 ,  ;ASM
  ASM: 1SBO ( -- ) 1D01 ,  ;ASM
  ASM: 1SBZ ( -- ) 1E01 ,  ;ASM

: SAMSCARD  ( -- ) 1E00 'R12 ! ;    \ select sams card
: SAMS-ON   ( -- ) SAMSCARD 1SBO ;  \ enable mapper
: SAMS-OFF  ( -- ) SAMSCARD 1SBZ ;  \ disable mapper

\ safely set the 64K segment that you want to use
: WITHIN  ( n lo hi -- ?)  OVER - >R - R> U< ;
: SEGMENT ( 1..F -- ) \ don't allow segment 0
         DUP 01 10 WITHIN 0= ABORT" SAMS segment err"
         SEG ! ;

1 SEGMENT

\ * SAMSINI sets card to "power-up" condition
: SAMSINI
       SAMSCARD          \ select SAMS card CRU address
       0SBO              \ turn card on
       0                 \ 1st value
       4000 20           \ register address, # SAMS regs
       OVER + SWAP  ( -- 4100 4000)
       DO
           DUP I !       \ I is reg. address
 \          I @ OVER ABORT" SAMS card err"
           0100 +        \ next value
       2 +LOOP
       0SBZ              \ turn off card
       DROP
;

: DMAP ( bank# -- )   \ map a DATA page at DMEM address
      DUP BANK# !     \ remember the bank#
      SWPB            \ swap bytes, bank# must be in left byte
      SAMSCARD 0SBO   \ turn on the card
    ( bank#)
\ compute the SAMS card register based on DMEM at compile time for speed
    [ 4000  DMEM 0B SRL + ] LITERAL ! \ store bank in SAMS register
      0SBZ            \ turn off card
;

HEX
: PAGED  ( virtual-addr -- real-addr)
      SEG @ 1000 M/MOD DROP  ( -- offset bank#)
      DUP BANK# @ -     \ different page
      IF   DMAP
      ELSE DROP
      THEN DMEM +       \ then add offset to paged mem block
;

CR HERE SWAP - DECIMAL .

\ SAMSINI
SAMS-ON
CR ." SAMS card activated"
 

 

 

Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4651081
Share on other sites

Everything loaded and my little help menu, which is just for me for development. I forgot to mention, the assembler is also loaded in. I don't have sound though, other than beep honk,  like Turboforth and probably the latest fb Forth, but not sure if have memory at this point anyway.

But I think I got some toys in the box.

 

Edited by GDMike
Link to comment
https://forums.atariage.com/topic/306864-supernotes/page/14/#findComment-4651157
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...