Jump to content
IGNORED

Supernotes


GDMike

Recommended Posts

here is my SAMS routines

****************************************
* FILE: SAMS                           *
*                                      *
* Super AMS Card Routine.              *
*                                      *
*  START DATE:2/16/20                  *
*  LAST UPDATE: 10/17/20               *
*                                      *
*     (C)2020 By Michael Lunsford      *
*   Guidance FROM LEE STEWART AND THEBF, and others     *
****************************************
 
****
*
*
* TURN OFF SAMS CARD
*
*
****
SAVRTN DATA 0
SAMOFF MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBZ  0
       SBZ  1
       MOV  @SAVRTN,R11
       RT   *R11
 
 
****
*
*
* TURN ON SAMS CARD
*
****
 
SAMON  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  1
       MOV  @SAVRTN,R11
       RT   *R11
 
 
****
*
* MAP ON MODE
*
****
 
MAPPG  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006          * MUST HAVE A VALUE IN R1
       MOV  R1,*R3            * PRIOR!
       SBO  1
       MOV  @SAVRTN,R11
       RT   *R11
 
 
*****
*
       RT   *R11
 
 
* INIT MEMORY TO >20 (BLANK SPACES)
 
INZS   MOV  R11,@SAVRTN
       LI   R1,>2020          * >SPACES
       LI   R2,>FFE           * 4094 (D)
       LI   R3,>3000
IZS1   MOV  R1,*R3+
       DECT R2
       JNE  IZS1
       MOV  @SAVRTN,R11
       RT   *R11
 
 
       END

 

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

I had to go back to fixing a microphone. :)

 

Here is what I would do.  

Separate code for Mapper on/off.

 

Then use the MAP3K routine to pull any page that you want. (stay above >10 to be safe)

That's the ONLY time you need to turn the card on, when you want to changed the register.

(So you do it for a SAMSINIT routine as well of course) 

 

So the sequence to get going is:

 

BL @samsinit       done only once. MUST TURN OFF THE CARD HERE AFTER INIT!

BL @MAPON       Oops  forgot this one. Now card is ready to use

.

.

.

.

.

MOV XX00,@BANK    so we have a record of which bank has been pulled in

BL @MAP3K             the page XX is now visible at >3000 in your program

 

That's it!

 

Edit: add a LI in MAP3K Usage code

 


SAVRTN DATA 0

****
*
* SAMS MAPPER CONTROL
*
****
 
MAPON  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  1
       MOV  @SAVRTN,R11
       RT   *R11
 
MAPOFF MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBZ  1
       MOV  @SAVRTN,R11
       RT   *R11
 
 

***************************************************************************
*
*  MAP3K maps a SAMS page into your memory at >3000
*
*
* Usage example:
*      LI   R1,>FF00      get your page# into R1 
*      MOV  R1,@BANK      Put your page# into low byte of BANK
*      BL   @MAP3K        call MAP3K
 
BANK   DATA 0000           SAMS bank that we have paged into CPU RAM >3000

MAP3K  MOV  R11,@SAVRTN
       LI   R12,>1E00      CRU address of SAMS
       SBO  0              Turn on SAMS card 
       MOV  @BANK,@4006    move the BANK we want into the register for CPU addr >3000
       SBZ  0              Turn off SAMS card
       MOV  @SAVRTN,R11
	   RT
	   

 
* INIT MEMORY TO >20 (BLANK SPACES)
 
INZS   MOV  R11,@SAVRTN
       LI   R1,>2020          * >SPACES
       LI   R2,>FFE           * 4094 (D)
       LI   R3,>3000          * start address 
IZS1   MOV  R1,*R3+
       DECT R2
       JNE  IZS1
       MOV  @SAVRTN,R11
       RT   *R11
 
 
       END

 

 

 

  • Like 1
Link to comment
Share on other sites

Hmm. Since I don't understand it I'll leave my working code alone. Only because it's working. But as I learn it I'll feel better about changing it out.

But it's taken quite awhile to get here.

And I'll definitely screw it up. And I'll be another 2 months trying to get it right..

Rt now, the way it works for me, is, I set R1 with the page and do a bl @mappg.

And it works. My >3000 is already plugged in as it's hard coded.

I'm good at adjusting out, but I've been having a real rough time with this.

Forth makes it easy since you guys already tackled this, but, yeah. Thanks.

I'll use it in the next app.

Hehe

 

  • Like 1
Link to comment
Share on other sites

This code leaves the SAMS card on (bit 0):

****
*
* MAP ON MODE
*
****
 
MAPPG  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006          * MUST HAVE A VALUE IN R1
       MOV  R1,*R3            * PRIOR!
       SBO  1
       MOV  @SAVRTN,R11
       RT   *R11

You should NEVER leave the card on. That makes the card’s >4000 – >5FFF address space accessible to the CPU. Only one card at a time should have that space turned on. If you leave it on and try to access another card, weird stuff will happen. Each time you write to the SAMS registers you should always turn the card off immediately after writing to the last register. Your routine above (and any like it) should

  • Turn SAMS card on.
  • Write to SAMS register(s).
  • Turn SAMS card off just before returning.

The above routine turns mapping on (bit 1) at the end, which should be on all the time you are using SAMS once you have initialized the card, so this instruction is superfluous. It should be replaced with an instruction to turn off the card (bit 0) as in the code below:

****
*
* MAP ON MODE
*
****
 
MAPPG  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006          * MUST HAVE A VALUE IN R1
       MOV  R1,*R3            * PRIOR!
       SBZ  0            <---turn OFF SAMS card   <----<<
       MOV  @SAVRTN,R11
       RT                <---don't need "*R11", "RT" means "B *R11"

 

...lee

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

I'm looking to see if I have some missing routines going on..

...

So far, I pass the init process.

But hangs at the main editor screen..

Still looking...

I'm placing a break at my point to the refresh screen area. I think that's where my Problem is. 

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

Analyzing

MAPPG  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006          * MUST HAVE A VALUE IN R1
       MOV  R1,*R3            * PRIOR!
       SBZ  0
       MOV  @SAVRTN,R11
       RT   *R11
 
 
SINIT  MOV  R11,@SAVRTN
       LI   R12,>1E00
       LI   R2,>4006
       LI   R1,>0300
       LI   R0,14
       SBO  0
LP1    MOV  R1,*R2+
       AI   R1,>100
       DEC  R0
       JNE  LP1
       SBZ  0
       MOV  @SAVRTN,R11
       RT   *R11

 

 

It was kinda working until I rebooted because it hung on my refresh screen.

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

I reverted my code to the way I had it before I made the changes to MAPPG.

I tested import of the data from the supercart AND tested my tipi clock for functionality. Both work.

The clock is running on the screen.

I'll make some more adjustments tommorow afternoon, and see how things go.

 

Because what I need to happen is:

I need the card on and mapper on while I read the mapped pages and push them to the screen. Then the mapper can go off. But with writing to the registers and immediately turning it off doesn't give me that.

Maybe I need a command that turns on the card and another that turns it off.

 

Edited by GDMike
Link to comment
Share on other sites

3 hours ago, GDMike said:

Analyzing

   . . .

It was kinda working until I rebooted because it hung on my refresh screen.

 

I am not sure you are understanding exactly how SAMS mapping works. Your SINIT code should exit by setting mapping mode. SINIT is not doing that. When you initialize the SAMS card, you should

  • Enable the mapper registers (bit 0) [also termed “turning on the card’ because it exposes the card’s >4000 – >5FFF memory space to the CPU]
  • Set transparent mode (clear bit 1) [for mapping mode, bit 1 is set; for transparent (pass-through) mode, bit 1 is reset (cleared)]
  • Initialize the mapper registers by writing the proper bank numbers to the proper registers
  • Set mapping mode (set bit 1) and NEVER set transparent mode unless you are totally done with SAMS
  • Disable the mapper registers (bit 0) [NEVER leave these enabled!]

Also, SINIT is starting at bank 3 and SAMS register 3 = >4006, but should start at bank 2 and SAMS register 2 = >4004. Here it is with all of the above changes:

SINIT  MOV  R11,@SAVRTN
       LI   R12,>1E00
       LI   R2,>4004        SAMS reg for >2000 block
       LI   R1,>0200        SAMS bank 2
       LI   R0,14           counter for 14 SAMS regs 
       SBO  0           <---enable mapper registers (turn card on)
       SBZ  1           <---set transparent mode
LP1    MOV  R1,*R2+
       AI   R1,>100
       DEC  R0
       JNE  LP1
       SBO  1           <---set mapping mode
       SBZ  0           <---disable mapper registers (turn card off)
       MOV  @SAVRTN,R11
       RT                   B *R11

 

...lee

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, GDMike said:

Because what I need to happen is:

I need the card on and mapper on while I read the mapped pages and push them to the screen. Then the mapper can go off. But with writing to the registers and immediately turning it off doesn't give me that.

Sounds like a good plan. However, if you use TheBF's MAP3K, the "card"(mapping registers) will be turned on/off(visible/hidden) at the appropriate intervals. But, this only accesses the >3000 thru >3FFF block.

 

To access other blocks of ram, you would need more routines, such as MAP2K, MAPAK, MAPBK, MAPCK, etc.

 

9 hours ago, TheBF said:

 


BANK   DATA 0000           SAMS bank that we have paged into CPU RAM >3000

MAP3K  MOV  R11,@SAVRTN
       LI   R12,>1E00      CRU address of SAMS
       SBO  0              Turn on SAMS card 
       MOV  @BANK,@4006    move the BANK we want into the register for CPU addr >3000
       SBZ  0              Turn off SAMS card
       MOV  @SAVRTN,R11
	   RT

 

 

3 hours ago, GDMike said:

Maybe I need a command that turns on the card and another that turns it off.

As an alternative to utilizing the MAPxK method above, you could use your own method of writing to the mapping registers. First turning the "card" on by using SBO 0, and then turning the "card" off  by using SBZ 0. But use judiciously, don't forget to turn off before allowing access to other cards(such as the DISK CONTROLLER)!:-o

 

 

  • Like 1
Link to comment
Share on other sites

Ok. Using @theBF code sounds like a plan, and at this moment in time I need only the >3000 - >3FFF address range. 

 

So do you have an sequence of commands, 

As in, do I run SINIT first followed by SAM ON? AND THEN map?

And does this need to be done each time I use the mapper?

I'm just trying to get clarification.

Right now here's my order

One time SINIT,SAMON

Map at leisure

Never SAMOFF because of the SBZ 1 in effect on the mapper currently.

But this of course this is my current use.

 

 

 

 

Edited by GDMike
Link to comment
Share on other sites

6 hours ago, Lee Stewart said:

Also, SINIT is starting at bank 3 and SAMS register 3 = >4006, but should start at bank 2 and SAMS register 2 = >4004.

You know, it's funny. I had this at >4004 and MR2 at 2 but I saw it and thought, whoa, I'm supposed to be using the>3000 Bank so I just changed it.

But you just reassured me that it was right on my side to begin with and I should not have touched it!

Slap hands ? here.

Well, I adjusted it because I was trying to find out why I was hanging at my screen refresh area in the program.

Sorry bout that.

 

 

 

Edited by GDMike
Link to comment
Share on other sites

8 hours ago, GDMike said:

Ok. Using @theBF code sounds like a plan, and at this moment in time I need only the >3000 - >3FFF address range. 

 

So do you have an sequence of commands, 

As in, do I run SINIT first followed by SAM ON? AND THEN map?

And does this need to be done each time I use the mapper?

I'm just trying to get clarification.

Right now here's my order

One time SINIT,SAMON

Map at leisure

Never SAMOFF because of the SBZ 1 in effect on the mapper currently.

But this of course this is my current use.

 

There may be some confusion in the use of the word “ON”. That is why I am trying now to avoid its use when talking about toggling SAMS modes (mapping/transparent) with bit 1. We talk about turning the SAMS card “ON” and “OFF” with bit 0, but that only refers to toggling the card’s activity LED and to gaining CPU access to the >4000 – >5FFF memory space. You must have that access when you write to the SAMS mapper registers because that is where they  are located: >4000, >4002, >4004, >4006, >4008, >400A, >400C, >400E, >4010, >4012, >4014, >4016, >4018, >401A, >401C, >401E. You will note That I struck through the eight SAMS registers that have no effect on mapping (at least, currently) so can be ignored. Those in this color are the SAMS registers that affect the 32 KiB expansion memory and, hence, the only ones that should concern us. Access to the SAMS registers should only ever be enabled (bit 0 set) when changing them. I cannot stress enough that SAMS register access should be disabled (bit 0 cleared) at all other times. That is why a routine that maps a SAMS bank must turn the SAMS card “ON” (set bit 0) to do it and must turn it “OFF” (clear bit 0) before returning. Bad things will happen if you leave the card “ON”!

 

Furthermore, you can toggle the SAMS mode (bit 1) regardless of whether the SAMS card is “ON” or “OFF”. Initializing the SAMS card (SINIT) to have whatever mapping you want (I always map to transparent mode settings) generally only needs to be done once at powerup (or first SAMS use), with the SAMS mode toggled to mapping (bit 1 set) upon returning from SINIT. You should not need to mess with the SAMS mode after that unless you really only want transparent mode (bit 1 cleared). As I said before, fbForth 2.0 powers up by unconditionally initializing SAMS to mapper settings that are the same as transparent mode and then toggling SAMS to mapping mode (bit 1 set) and never toggles SAMS to transparent mode (bit 1 cleared) after that.

 

If you insist on separate routines for toggling SAMS modes, I would lose the names, “SAMS-ON” and “SAMS-OFF” in favor of something like “MAP-MODE” and “TRANS-MODE”. You could use “SAMS-ON” and “SAMS-OFF” for access to the mapper registers and toggling the card’s LED, but, frankly, I do not see the point in ALC of having separately called routines for toggling SAMS modes or turning the card on/off. SINIT toggles mapping mode and MAP (in place of the name, MAP-ON) or MAP3K would do the actual mapper register modifications—MAP, requiring bank number and RAM block address, and MAP3K, requiring only bank number because it knows to write the bank number to the >3000 block register (>4006).

 

...lee

  • Like 2
Link to comment
Share on other sites

Ok. I'll give it a try tommorow. Today I spent, well, little time on the computer, but I was able to"clean up" some things and removed all mapping scenarios.

I had portions scattered around and depending on keyboard responses would "map" things. Well, I created variables and I'll just pass the variables on to one component, and THAT resource can call ALL the mapping I need from various locations.

Anyway, that's s a personal Problem.

I like how you went the extra mile in explanation. I appreciate that, as it ties into things I've read which makes it easier to grasp and the reminder is great. BIG Thank you.

Yes, I totally agree, with some of the terminology changes needed.

IF you're talking to me! That is...hehe

I got confused on "ON/OFF" and also

The word "PAGE" early on.

I can get by with, "enable, disable, activate,deactivate, transparent, emulate"

and I do a lot of speculat/e..ion

And I got in trouble for it.

Do I assume, MAP MODE will NOT do a SBZ 1 but TRANS MODE will?

 

This sounds like what I need. Because I just need to enable mapping, send 840 bytes from my mapped >3000- address area to my screen, then disable mapping completely with TRANSMDE

Thank you.

I Know it's simple, to a few people, just like me, whipping around the screen image table and pattern table blind, it's easy. But I'm in new territory.

Sorry for being a pain ?

 

 

 

 

 

 

Link to comment
Share on other sites

56 minutes ago, GDMike said:

Ok. I'll give it a try tommorow. Today I spent, well, little time on the computer, but I was able to"clean up" some things and removed all mapping scenarios.

I had portions scattered around and depending on keyboard responses would "map" things. Well, I created variables and I'll just pass the variables on to one component, and THAT resource can call ALL the mapping I need from various locations.

Anyway, that's s a personal Problem.

I like how you went the extra mile in explanation. I appreciate that, as it ties into things I've read which makes it easier to grasp and the reminder is great. BIG Thank you.

Yes, I totally agree, with some of the terminology changes needed.

IF you're talking to me! That is...hehe

I got confused on "ON/OFF" and also

The word "PAGE" early on.

I can get by with, "enable, disable, activate,deactivate, transparent, emulate"

and I do a lot of speculat/e..ion

And I got in trouble for it.

Do I assume, MAP MODE will NOT do a SBZ 1 but TRANS MODE will?

 

This sounds like what I need. Because I just need to enable mapping, send 840 bytes from my mapped >3000- address area to my screen, then disable mapping completely with TRANSMDE

Thank you.

I Know it's simple, to a few people, just like me, whipping around the screen image table and pattern table blind, it's easy. But I'm in new territory.

Sorry for being a pain ?

 

 

 

 

 

 

If you are always using >3000 for SAMS data then you never turn Mapping off. 

 

INIT the registers, run some kind of MAP-ON code and forget it. 

 

If for some reason you want to use the memory that is the default for >3000 just use MAP or MAP3K and use 0300 as the value and you will get the RAM that normally lives there.

 

Another way to think of it:

 

>3000 is your window that lets you see one of the 256 4K chunks of SAMS memory at a time.  (the chunks are sometimes called pages)

 

Does that help at all?

  • Thanks 1
Link to comment
Share on other sites

The first section helps, I'm already having to break down the 4k of my >3000 ->3FFF into 4 segments of 840 bytes with the extra space reserved for hypertext storage.

But I still have to turn off the mapper because I access dsk controller (TBD),and tipi clock(completed)

 

 

Edited by GDMike
Link to comment
Share on other sites

1 minute ago, GDMike said:

The first section helps, I'm already having to break down the 4k of my >3000 ->3FFF into 4 segments of 840 bytes with the extra space reserved for hypertext storage.

But I still have to turn off the mapper because I access dsk controller and tipi clock.

 

 

But that is my point.  The "MAPPER"  is NOT the "card".

You have to turn off the card so the other cards can use >4000 address  yes.

 

But the MAPPER does not use that space.  So I think that is your confusion. 

 

So to be clear 

1E00 -> R12  SBO 0    ->  card is on. No other card can work.

                    SBZ 0 card is off. All other cards can work.

  

1E00 -> R12   SBO 1  MAPPER is on. All other cards are UN-affected.

 

 MAPPER on just means any time the CPU reaches for >3000...>3FFF is gets a 4K chunk of SAMS instead! Cool stuff. :) 

 

 Lesson: Never turn off the mapper if you use SAMS data all the time.

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

And to change the SAMS chunk that you can see at >3000 you turn on the card (SBO 0) ,  change the number in the 4006 register, and slam that sucker off again. (SBZ 0)

That's the whole thing when you are dealing with a single "window" like your are doing.

(It's what I do for ED99)

  • Like 2
Link to comment
Share on other sites

Just now, GDMike said:

1E00 -> R12  SBO 0    ->  card is on.

So so if I leave the mapper pointing to a particular page and turn off the card and when I turn the card back on then the mapper will still be already mapped?

The card can always see its own internal registers even when you turn it "off".  Really you just hiding  the card from the >4000 address of the TI-99.

The MAPPER is alway on and when a program tries to read >3000...>3FFF the mapper substitutes the SAMS page that you put in the register. The register at >4006 never changes unless you do it.

  • Thanks 1
Link to comment
Share on other sites

All right very good now that I know the difference between on and on and off and off hehe if that makes any damn sense okay I got it I think I'll be okay tomorrow. What I did today is I restructured my keyboard calls to different maps I have the import cartridge mapper I have the initialization in the beginning mapping and then I have my pages up and pages down mapping so I grabbed all of that and threw them all into variables and I just do the map in one location that way I have mapping location in my program

 

Edited by GDMike
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...