Jump to content
IGNORED

Supernotes


GDMike

Recommended Posts

Well it's almost quitting time time to go home, oh well I'm already home, well I'm thinking I'll go ahead and get back into my assembly program and see what I can't figure out because a lot of the program is written already and I would have to rewrite that stuff into forth, and just think of all the fun I'll be missing. Well I got plans on writing something else anyway in forth later down the road. but I really got to get this done yeah I've been spending way too much time I've spent three months on Sam's alone

Edited by GDMike
  • Haha 1
Link to comment
Share on other sites

2 hours ago, GDMike said:

Lee, should I shout out to wilsy and ask him about his init routine? But then I'd be like, uh yeah...hmmm

 

Well, I have his source code and it’s also available on his website. Here is his startup code (done for ASM994A Assembler, so he did not capitalize or use first-column *s) for the code:

;[ initialise SAMS card if fitted
        li   r12,>1e00              ; sams CRU base
        sbo  0                      ; enable access to mapper registers
        sbz  1                      ; disable mapping while we set it up
        li   r0,>4004               ; register for >2000
        li   r1,>f8f8               ; map bank >f8 into >2000
        mov  r1,*r0+                ; do it
        li   r1,>f9f9               ; map bank >f9...
        mov  r1,*r0+                ; ...into >3000
    ; now set up the banks for high memory...
        li   r0,>4014               ; register address
        li   r1,>fafa               ; register value
        li   r2,6                   ; loop count
sams    mov  r1,*r0+                ; write to the register
        ai   r1,>0101               ; next register value
        dec  r2                     ; finished?
        jne  sams                   ; loop if not
        sbo  1                      ; enable mapping
        sbz  0                      ; lock the mapper registers
;]

The above code will only ever work for a 1 MiB SAMS because of the copying of the LSB to the MSB for writing to the mapper registers. My code for fbForth 2.0 is practically identical because I got it from @Willsy (except that it now works for 128 KiB to 32 MiB SAMS because I use the SAMS bank number and swap bytes before writing to the registers).

 

...lee

  • Like 3
Link to comment
Share on other sites

Ok. After I saw that FbForth doesn't init to the default pass through values for SAMS I could make this work. :)

 

Tested on FbForth v2.0:12

 

This SAMSINI should work on real iron with TI-FORTH but I did not try it.

 

*BUT*   change ALL

 

ASM:        ;ASM 

 

to   

 

CODE      NEXT, 

 

The word you were looking for is called DMAP  here. 

It takes a bank# and pages it into the address called DMEM. 

I set that to >D000. 

*You wanted to use E000 Believe so change the value of DMEM and the code figures out the rest. :) 

 

You don't need all the SEGMENT and PAGED stuff if you don't want to use it.

Edit: TI-FORTH doesn't have ABORT"  and it needs the pass through SAMS memory because it loads into RAM. Oops.

This spoiler is for TI-FORTH

Spoiler

\ SAMS CARD support for TI-FORTH   Oct 2020  B Fox
\ Inits SAMS to pass through memory pages

HERE

HEX
: CELLS  1 SLA ;

8300 0C CELLS + CONSTANT 'R12   \ workspace=>8300

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

D000 CONSTANT DMEM    \ CPU RAM memory block location
0020 CONSTANT #REGS   \ # sams Registers, ie: size of card >20 is 1Mbyte
   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*
  CODE 0SBO ( -- ) 1D00 ,  NEXT,
  CODE 0SBZ ( -- ) 1E00 ,  NEXT,
  CODE 1SBO ( -- ) 1D01 ,  NEXT,
  CODE 1SBZ ( -- ) 1E01 ,  NEXT,

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


\ These are arrays of sams registers values for TI-FORTH pass thru
\ 1ST                2nd     3rd   4th    etc.
0202 VARIABLE LOSAMS 0303 ,
0A0A VARIABLE HISAMS 0B0B , 0C0C , 0D0D , 0E0E , 0F0F ,

: SAMSINI
      SAMS-ON
      LOSAMS 4004  2 CELLS CMOVE    \ load low ram registers
      HISAMS 4014  6 CELLS CMOVE    \ load hi ram registers
      SAMS-OFF
;

: 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
;

CR HERE SWAP - DECIMAL .

SAMSINI MAP-ON
CR ." SAMS card activated"
 

 

 

This is for FbForth

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

D000 CONSTANT DMEM    \ CPU RAM memory block location
0020 CONSTANT #REGS   \ # sams Registers, ie: size of card >20 is 1Mbyte
   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 0SBO ;  \ enable card
: SAMS-OFF  ( -- ) SAMSCARD 0SBZ ;  \ disable card
: MAP-ON    ( -- ) SAMSCARD 1SBO ;  \ enable mapper
: MAP-OFF   ( -- ) SAMSCARD 1SBZ ;  \ disable mapper

: CELLS  1 SLA ;

\ These are arrays of sams registers values for TI-99 memory
\ 1ST                2nd     3rd   4th    etc.
F8F8 VARIABLE LOSAMS F9F9 ,
FAFA VARIABLE HISAMS FBFB , FCFC , FDFD , FEFE , FFFF ,

: SAMSINI
      SAMS-ON
      LOSAMS 4004  2 CELLS CMOVE    \ load low ram registers
      HISAMS 4014  6 CELLS CMOVE    \ load hi ram registers
      SAMS-OFF
;

\ 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 11 WITHIN 0= ABORT" SAMS segment err"
         SEG ! ;

1 SEGMENT

: 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   
MAP-ON
CR ." SAMS card activated"
 

 

 

 

Here is some test routines for the paged memory. It's not real speedy but it lets you get at bytes and cells 64K bytes at a chunk.

But DMAP is pretty quick because it's simple and the register address is computed at compile time.

\ testing read write to SAMS memory SEGMENTS 1 TO 15 only

DECIMAL 16 LOAD

HEX
1000 CONSTANT  4K
6000 CONSTANT 24K

1 SEGMENT  \ select the segment we will use

: SDUMP ( addr n -- ) SWAP PAGED SWAP DUMP ;  \ 4K limits

: ?BREAK   ?TERMINAL  ABORT" *BREAK*" ;

HEX
\ write 24k sequential integers to the segment
: 24KWORDS    24K 0 DO   I  I PAGED !   2 +LOOP ;

\ ERASE 6 4K blocks in 1 second
: 24KERASE    24K 0 DO   I PAGED 4K ERASE   4K +LOOP ;

 

 

  • Like 1
Link to comment
Share on other sites

26 minutes ago, GDMike said:

I'll try this and see how, but it's way above my pay scale.

I understand the fundamentals here, like how to key it in and run it. Lol bwhahaha

Thank you for taking the time.

Let's see how it acts.

 

We gotta get you a PC.  I thought about the typing after the post. 

 

So the TI-Forth version has never been tested but I think it's correct (Like no programmer ever said that before)

The big deal, is the SAMS card is initialized to look like normal RAM so TI-Forth won't disappear on you. :)

 

Instructions:

Use  DMAP with arguments from HEX 10  to HEX FF  for a 1M card and the SAMS will appear at whatever address you set DMEM to when you compile the code.

 

Change it to E000 from Lee's explanation of what you are doing. 

 

If nothing else you will have a test box to play with SAMS in Forth. That can help speed up exploration.

 

\ a way to test if it's working from the console

\ XXX LOAD    ( load the screens with my SAMS code)
HEX   ( easier to stay in HEX for this work)

10 DMAP      \ pulls in a page
1111 E000 !  \ DMEM was set to E000 BY YOU BEFORE COMPILING
E000 @  .    \ 1111 ok ( confirm we stored our number)

11 DMAP      \ change SAMS bank#
2222 E000 !  \ put a new number at E000 (but it's in a new bank now)
E000 @ .     \ 2222 ok ( it should come back)

10 DMAP     \ switch back to previous page
E000 @  .    \ 1111 OK  ( 1111 should still be there)

12 DMAP
E000 @ .  \ some random number will print cuz this is a different SAMS RAM

 

Edited by TheBF
PUT IN A MISSING '.'
Link to comment
Share on other sites

33 minutes ago, TheBF said:

Use  DMAP with arguments from HEX 10  to HEX FF  for a 1M card and the SAMS will appear at whatever address you set DMEM to when you compile the code.

 

My past issue, and it looks as if there's only one issue going on, is turning on, or running the Sams-on routine.

Seems that when running that code, that works perfectly on cl99, but for whatever reason, either puts the computer in a lockup or turns off every peb card.

I've been trying to, turn off the card first, then running the SAMS-ON for a first time, and that didn't work. That's where I think we really are. Like a one line piece of code away.

The >MAP procedure looked fine

Edited by GDMike
Link to comment
Share on other sites

Right.  If you turn on the SAMS card and the mapping tables are not set up for "pass through" addresses

ALL YOUR RAM with TI-Forth in it changes to some other random blocks of RAM.  :)

That will lock it up for sure.

 

So you must at least try my SAMSINI code.   Then use >DMAP and test at the console.

Note: 

>MAP is actually more code than needed because it computes the register every time.

If you know you are using only 1 page in RAM you know the register address. It never changes. :) 

 

  • Like 1
Link to comment
Share on other sites

Hmm. Not sure how to implement this.

 

"Here is some test routines for the paged memory. It's not real speedy but it lets you get at bytes and cells 64K bytes at a chunk".

 

I have no idea what is reqd by me to make this work? Are you saying, if I got this right, that I don't need to load CRU words as previously done, AND that I now need to invoke the assembler and just make changes to the assm and stop assm words?

And I think we were using >F000 not >E000.

And do I need to have a certain level of free ram Available to do this, as before. Because we had figured that I needed to be around 10k free ram or so..

It's all good, but im not seeing how to get there. Lol

Edited by GDMike
Link to comment
Share on other sites

11 hours ago, TheBF said:


: SAMSCARD  ( -- ) 1E00 'R12 ! ;    \ select sams card
: SAMS-ON   ( -- ) SAMSCA      \ 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   
MAP-ON
CR ." SAMS card activated"
 

 

 

 

Here is some test routines for the paged memory. It's not real speedy but it lets you get at bytes and cells 64K bytes at a chunk.

But DMAP is pretty quick because it's simple and the register address is computed at compile time.


\ testing read write to SAMS memory SEGMENTS 1 TO 15 only

DECIMAL 16 LOAD

HEX
1000 CONSTANT  4K
6000 CONSTANT 24K

1 SEGMENT  \ select the segment we will use

: SDUMP ( addr n -- ) SWAP PAGED SWAP DUMP ;  \ 4K limits

: ?BREAK   ?TERMINAL  ABORT" *BREAK*" ;

HEX
\ write 24k sequential integers to the segment
: 24KWORDS    24K 0 DO   I  I PAGED !   2 +LOOP ;

\ ERASE 6 4K blocks in 1 second
: 24KERASE    24K 0 DO   I PAGED 4K ERASE   4K +LOOP ;

*IGNORE the above code. My copy paste didn't work out..

Edited by GDMike
Link to comment
Share on other sites

DO I still need this done below?

 

*BUT*   change ALL

ASM:        ;ASM 

to   

CODE      NEXT, 

 

I think it's already done for me? It's confusing when you said this and then it's already done.. lol ok..I see it's done.

 

 

Edited by GDMike
Link to comment
Share on other sites

Update. Looks like I didn't see samsini.. but just now found it.

 

Older info

Now, i see the words samscard,

sams-on, Sams-off, map-on, map-off

Are in my dictionary.

How do I use those.

Note: Sams-on by itself runs

But MAP-on by itself shuts down the peb.

 

Edited by GDMike
Link to comment
Share on other sites

Today I fixed a Problem with the DATE display issue in the assembly version.

When I wrote the code back in June or July I didn't give enough space to allow a double digit month to display, so when it was October and I hit the key to bring up the date and time it displayed 0/ instead of 10/ for the month. I don't know what I was thinking that day.

But it's corrected.

 

Link to comment
Share on other sites

13 hours ago, TheBF said:

: SAMSINI
   SAMS-ON
   LOSAMS 4004 2 CELLS CMOVE \ load low ram registers
   HISAMS 4014 6 CELLS CMOVE \ load hi ram registers
   SAMS-OFF ;

 

 

As I said here, I think this is a Catch-22 situation. I am thinking that we need to write a small ALC program to set up SAMS pass-through banks followed by a “BLWP @0” to get back to the title screen, at which time fbForth 1.0 can be loaded normally. I could also update fbForth 1.0 with SAMS-initializing code, but that will likely take me awhile.

 

...lee

  • Thanks 1
Link to comment
Share on other sites

39 minutes ago, Lee Stewart said:

 

As I said here, I think this is a Catch-22 situation. I am thinking that we need to write a small ALC program to set up SAMS pass-through banks followed by a “BLWP @0” to get back to the title screen, at which time fbForth 1.0 can be loaded normally. I could also update fbForth 1.0 with SAMS-initializing code, but that will likely take me awhile.

 

...lee

I agree, but maybe not BLWP @ 0, but rather wipe, or  forget some stuff. I dont think patching is going to solve this well, it's going to require speed and agility so to speak. A good FB1.0 with a working SAMs would entice a lot of beginners. I'm thinking of a world where I can load from tipi, FB 1x and I can load everything available, from graphics to rs232 and sound to I/o and speech with only a ea. Cart.

I think SAMs stands in the way.

But how cool is that! I think it's still possible without tipi though, but would be slower.

 

 

Edited by GDMike
Link to comment
Share on other sites

34 minutes ago, GDMike said:

I agree, but maybe not BLWP @ 0, but rather wipe, or  forget some stuff. I dont think patching is going to solve this well, it's going to require speed and agility so to speak. A good FB1.0 with a working SAMs would entice a lot of beginners. I'm thinking of a world where I can load from tipi, FB 1x and I can load everything available, from graphics to rs232 and sound to I/o and speech with only a ea. Cart.

I think SAMs stands in the way.

But how cool is that! I think it's still possible without tipi though, but would be slower.

 

All of these problems were solved with fbForth 2.0.

 

...lee

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Lee Stewart said:

 

As I said here, I think this is a Catch-22 situation. I am thinking that we need to write a small ALC program to set up SAMS pass-through banks followed by a “BLWP @0” to get back to the title screen, at which time fbForth 1.0 can be loaded normally. I could also update fbForth 1.0 with SAMS-initializing code, but that will likely take me awhile.

 

...lee

I used to be confused but now I am not sure.

 

I thought he was using TI-Forth. Oh well. At least I figured out something for SAMS segments in FbForth 2.0.

 

Is there a technical reason for paging in upper pages of the SAMS card when you boot FbForth?

It seem to boot with the defaults because I don't init it unless I include the SAMS library file.

 

So would a word like this work if were added to the SAMS code.  (it would only be 1 instruction of machine code I think)

 

ASM: BLWP ( addr -- )  *SP+ BLWP,  ;ASM

 

Link to comment
Share on other sites

8 minutes ago, TheBF said:

Is there a technical reason for paging in upper pages of the SAMS card when you boot FbForth?

 

The reason was that I did it the way @Willsy did it. I think his reasoning was that the user could have all of the banks in a contiguous run from 0 – >F7 without running into the default pages. I have changed all that for Build 13 to the pass-through values. You can get the beta in the link in the last sentence.

 

...lee

  • Like 2
Link to comment
Share on other sites

I ran this simple code and the computer hangs and never displays the asterisk to let me know that the "mov" was done.

I ran the same code in classic 99 and it runs fine.

I rebooted (power off 4 times and ran the code 4 times).

When I finally let the computer stay off for a couple mins and re ran this code, then the screen flashed over and over again.

 

IMG_20201014_215105285.jpg

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