Jump to content
gregallenwarner

SAMS usage in Assembly

Recommended Posts

12 minutes ago, GDMike said:

Well, ok from 10-240. I didn't really know if that system 32k came in at the top or bottom, so now I know it's at the bottom side. So I'll need to make bank 1 start at 10 instead of 1. When I'm creating banks, Right?

 

The default SAMS mapping at power-up maps pages 2, 3, A, B, C, D, E and F as the 32 KiB expansion RAM at >2000, >3000, >A000, >B000, >C000, >D000, >E000 and >F000, respectively. Remember that when SAMS is in the system, SAMS supplies the expansion RAM. You should probably not touch those pages except in your paging window(s). That is why it is a good idea to start paging at SAMS page >0010 (16, not 10). You, obviously, can use the in-between pages (0, 1, 4, 5, 6, 7, 8, 9), but, unless you actually need them, it is better to leave everything below >0010 alone, except, of course, those whose mapping you are screwing with, which, If you use only one mapping window at >3000, would be page 3. That is, mapping, say page 20 into >3000 (mapper register >4006) obviously maps page 3 out, so, if you need that page again, you would then map page 3 back into >3000.

 

...lee

Share this post


Link to post
Share on other sites

I'm sure I have been burned by assuming a start-up stage when the mapper is turned on. I think Classic99 is setting this up, but it's not what my hardware is doing, which has an older SAMS card. Also, if another program has been using the SAMS before, you cannot assume anything.

  • Like 3

Share this post


Link to post
Share on other sites

Correct, i never assume that SAMs page 1 is true at power up. That's why I made the SBZ routine to come in right after SAMON to make sure that, well page 1 is in fact >10 to start off with.

I had it starting at >1 but that's been corrected by TheBF.

 

 

 

Edited by GDMike

Share this post


Link to post
Share on other sites
3 minutes ago, GDMike said:

Correct, if never assume that. That's why I made the SBZ routine to come in right after SAMON to make sure that, well page 1 is in fact >10 to start off with.

I had it starting at >1 but that's been corrected by TheBF.

 

No. What @Asmusr is saying is that you should initialize the SAMS pages yourself that you expect for the 32 KiB expansion. That is, the mapping I suggested was the SAMS power-up default in my last post is what you should explicitly map yourself before you do anything else.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

Oh, oh. Even if I'm only using, or going to use one 4k area? So at program boot, just configure the Sam's map for everything. Ahhh.. now I see, because, like @asmusr said, don't take that for granted that it's orderly to start with.

Simple enough.

Did we cover the code I submitted earlier, so someone can tell me what I need to change other than SBZ start page change from 10 to 16?

Thx. 

 

Edited by GDMike

Share this post


Link to post
Share on other sites
28 minutes ago, GDMike said:

Did we cover the code I submitted earlier, so someone can tell me what I need to change other than SBZ start page change from 10 to 16?

 

I think we are all working on it. A couple of points:

  • Though “SBZ” is a perfectly fine label (at least, it is for the TI E/A), it is probably not a good idea to use an instruction mnemonic as a label.
  • Nowhere do you ever enable mapping (bit 1). Writing to the mapper registers (bit 0) is all you are enabling. You will never see the mapped pages at >3000 until you enable mapping. The way I do it in fbForth is, after startup initialization, I turn bit 1 on and leave it on.

...lee

  • Thanks 1

Share this post


Link to post
Share on other sites

I thought that when I exit with SBO 0 or SBZ 0 would set the mapper? So this should be SBZ 1 I suppose

 

 

" *** set to BANK 1

SBH    MOV  R11,@SAVRTN. * Label change
    LI   R12,>1E00
    SBO  0
    LI   R3,>4006
    LI   R1,>0100
    MOVB R1,*R3
        SBZ  0          * not sure this is needed
    MOV  @SAVRTN,R11
    RT"

 

Edited by GDMike

Share this post


Link to post
Share on other sites
6 hours ago, GDMike said:

I'll paste my code in a while after getting kids to school. Thx so much, I knew I was doing this as it was supposed to work. Hmm

Maybe we can determine what is going on.

So, I don't have a SAMS, I'm running this on Classic99.

 

The main issue for me now is that I don't know what you really expect this code to do!:ponder:

 

If it weren't for the TRANSPARENT MODE issue. You would be printing from PAGE >0D(13) which you never write to in the first place!

 

I had to add 4 lines to your code.:grin:

       DEF  TEST
       REF  VSBW
SAVRTN DATA 0

***** turn off SAMS Mapper

SAMOFF MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBZ  0
       SBZ  1             *this is a problem ...you're switching to TRANSPARENT MODE here!
       MOV  @SAVRTN,R11
       RT

***** turn on Mapper and set for >3000->3FFF

SAMON  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R1,>0300
       LI   R3,>4006
       MOV  R1,*R3     * not sure if the "plus" is actually needed ...I removed the "plus". not sure it was causing an issue here ...but probably not what you wanted.
       SBZ  0
       MOV  @SAVRTN,R11
       RT

**** set to BANK 1

SBZ    MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       LI   R1,>0100
       MOVB R1,*R3
       SBZ  0               * not sure this is needed
       MOV  @SAVRTN,R11
       RT

***** ADD A BANK

ADPG   MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  *R3,R1
       AI   R1,>0100
       MOV  R1,*R3
       SBZ  0                  * not sure if this is needed
       RT

*******PROGRAM

TEST   BL   @SAMON
       BL   @SBZ   *sets >3000 to page >01
       CLR  R5
       CLR  R4
INC1   BL   @ADPG  *sets >3000 to page >02 ...now both >2000 and >3000 are on page >02
       INC  R5     *****************************
       CI   R5,10  * keep switching pages until >3000 is set to page >0B(11) ...this page is also the default page at >B000, specified in >4016
       JLT  INC1
       LI   R3,>3000
       LI   R1,>4142
INC2   MOV  R1,*R3+  *write >4142 to >3000 ...set to page >0B(11)
       INC  R4
       CI   R4,>240
       JLT  INC2
       BL   @SAMOFF  *This enters and leaves us in TRANSPARENT MODE. There is no code in this program to reenter MAPPING MODE!!! So, no changes to the mapping happen after this line!!!
       BL   @SAMON   *and >3000 to page >03
       BL   @SBZ     *sets>3000 to page >01
       CLR  R4
       CLR  R5

INC3   BL   @ADPG    *sets >3000 to page >02 ...now both >2000 and >3000 are on page >02(but not mapped)
       INC  R5       *****************************
       CI   R5,12    ** keep switching pages until >3000 is set to page >0D(13) ...this page is also the default page at >D000, specified in >401A(but not mapped)
       JLT  INC3
       LI   R0,0
       LI   R3,>3000
INC4   MOV  *R3+,R1  *read the word at >3000 and write it into R1
       BLWP @VSBW    *prints every other byte starting from >3000, while in TRANSPARENT MODE, these are the utils now...
       INC  R0
       CI   R0,960
       JLT  INC4
       BL   @SAMOFF
       B    @STOP

**********************

STOP   LIMI 2
       LIMI 0
       JMP  STOP
       END

 

    P.S. It only took me about 30 min. to align this code! I don't know how you copied it, but a code box, set to "no syntax highlighting" might help somewhat.
 

    P.P.S. If you like... I can attach the SOURCE and OBJECT code on disk or FIAD.

  • Like 2

Share this post


Link to post
Share on other sites

Oh, this code is supposed to place >4142 into 4k of bank 10, but we've decided it should be bank 16 >3000->3FFF or close to 4k data, I might be off by a couple words in my original length. Not the issue, then I have to verify that the 4K of data indeed stuck in address

>3000->3FFF bank 16 and by me reading bank xxx (any bank other than 16) I should not be seeing >4142. My code, as I'm finding out by Lee, isn't turning on the mapper? I suppose by not doing a

SBO 1? Not sure yet. But I was getting >4142 so I knew something wasn't right.

 

 

No need to send me the corrections, thx for that offer. 

 

Share this post


Link to post
Share on other sites
25 minutes ago, GDMike said:

I thought that when I exit with SBO 0 or SBZ 0 would set the mapper? So this should be SBZ 1 I suppose

 

 

" *** set to BANK 1

SBH    MOV  R11,@SAVRTN. * Label change
    LI   R12,>1E00
    SBO  0
    LI   R3,>4006
    LI   R1,>0100
    MOVB R1,*R3
        SBZ  0          * not sure this is needed
    MOV  @SAVRTN,R11
    RT"

 

SAMS card CRU bit 0 controls the card ON/OFF so you can read a write the registers starting at address >4000.

So that last SBZ 0 turns off the SAMS card. It MUST be done because other cards occupy that same space at >4000.  (DISK, RS232 etc.)

 

SAMS card CRU bit 1 controls the "mapper" which "maps" a SAMS page into the ti-99 memory space. (which is set by the SAMS register and its value)

 

Make sense?

  • Thanks 1

Share this post


Link to post
Share on other sites

Gotcha

3 minutes ago, TheBF said:

SAMS card CRU bit 1 controls the "mapper" which "maps" a SAMS page into the ti-99 memory space (which is set by the SAMS register and its value

Gotcha, and SBO 1 is needed to start the mapper.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
26 minutes ago, HOME AUTOMATION said:

INC1 BL @ADPG *sets >3000 to page >02 ...now both >2000 and >3000 are on page >02

I thought that adding 1 @>4006 msb would only add another bank of

>3000->3FFF. But apparently not what I should be doing to achieve that.

 

 

Share this post


Link to post
Share on other sites

The idea of adding a bank is not quite right. By writing to >4006 you choose which bank is mapped at >3000, but you don't add anything.

 

Edit: and if you add to the number stored at >4006 you just choose another bank.

Edited by Asmusr
  • Thanks 2

Share this post


Link to post
Share on other sites
30 minutes ago, GDMike said:

Oh, this code is supposed to place >4142 into 4k of bank 10

I did see the "AB" pattern being written to >B000! But could not see it at >3000. Little doubt this because you were already in TRANSPARENT MODE by then.

 

         P.S. I think you're getting CLOSER!!!:grin:

  • Haha 1

Share this post


Link to post
Share on other sites
15 hours ago, TheBF said:

Using the register at >4006 you can select safely any SAMS page from >10 .. >FF

 

So that means you can have 240 different 4K blocks living in your memory at >3000, but only one at a time.

It brings me back to this. Because I was merely interested in how to advance banks of >3000->3FFF and I saw this statement by @theBF, and again, like you said, it's only going to change the address to map, NOT increment my existing bank.

Ok, it's understandable. As that's how I got my desired address to begin with, but I'm still trying to figure out how do I get another bank of >3000->3FFF?

 

Share this post


Link to post
Share on other sites

Oh, and something else that confused me. In the titler example related to the SAMS document, they talk about splitting up the frames between the odd numbers and the even numbers and that got confusing so I didn't know if I had to apply that to this or not and then it said it could only be used between addresses >A000->D000 or something to that effect??

Oh, it says odd frames had to be within those odd addresses, and even frames in the even addresses.. yikes,! And it gets worse! Something about adding 3 and multiplying your first born and subtracting your mortgage payment!!

 

So then I started getting worried that I'm calling Banks frames or I'm supposed to be calling frames Banks so my terminology got lost somewhere in the titler example. 

So to make sure I have this right, "pages" are addresses I want to create in Sam's right? And"BANK" would be the product?

And do I want to know what frames are?

 

 

Edited by GDMike

Share this post


Link to post
Share on other sites
9 minutes ago, GDMike said:

So to make sure I have this right, "pages" are addresses I want to create in Sam's right? And"BANK" would be the product?

And do I want to know what frames are?

Pages and banks are the same thing. I don't know what they meant by frames.

 

18 minutes ago, GDMike said:

Because I was merely interested in how to advance banks of >3000->3FFF

What do you mean by "advance banks of >3000->3FFF"?

 

  • Like 1

Share this post


Link to post
Share on other sites

Another name for banks..hehe.  I think there are 240 available banks on my 1mb card. I'm just wanting to map >3000->3FFF AFTER the suggestion to map ALL banks.

And a sub routine that I can call to give me another bank of that area. 

Just like Turboforth, you can

call "5 setbank" and I then have bank 5 at my disposal.

But I just want to do like a "addbank"

That would, if called, set my >3000->3FFF to a bank higher as in 4K available space. I'm not wanting to change the address though.

But something I could possibly throw in a loop to reach a desired bank between 16 and 240. 

In hopes that my, label Change, SBH would always put me on bank 16 if called first.

Edited by GDMike

Share this post


Link to post
Share on other sites
1 hour ago, GDMike said:

Another name for banks..hehe.  I think there are 240 available banks on my 1mb card. I'm just wanting to map >3000->3FFF AFTER the suggestion to map ALL banks.

And a sub routine that I can call to give me another bank of that area. 

Just like Turboforth, you can

call "5 setbank" and I then have bank 5 at my disposal.

But I just want to do like a "addbank"

That would, if called, set my >3000->3FFF to a bank higher as in 4K available space. I'm not wanting to change the address though.

But something I could possibly throw in a loop to reach a desired bank between 16 and 240. 

In hopes that my, label Change, SBH would always put me on bank 16 if called first.

Hey GDMike don't know if this is needed. 

Might be all clear to you now, but I saw walls of words for explanations and sometimes a picture is worth... :) 

I thought I would make a picture of how I understand it.

Everybody can beat it (ME) up as needed. :) 

 

SAMS diagram.jpg

  • Like 2

Share this post


Link to post
Share on other sites
8 hours ago, GDMike said:

I Know there's a lot of information regarding how to use this card.

And the docs with example is good too, but it wasn't really explaining in a "simplistic" way, as the author just assumed ti artist was a good example of using odd/even frames and the comment saying, "clear as mud" was right on.

Pretty easy to turn on/off the card, and mapping, but I ended up stuck without moving the bank # above 0

 

Here's what ive been working with in my test

 

after making the bank a high number, as in the last section of the program, Im still getting the same data presented to me, as if my "ADPG" is not really incrementing a Bank.

Spoiler

***** turn off SAMS Mapper
SAMOFF  MOV R11,@SAVRTN
     LI R12,>1E00
     SBZ 0
     SBZ 1
     MOV @SAVRTN,R11
     RT

***** turn on Mapper and set for >3000->3FFF

SAMON    MOV  R11,@SAVRTN
    LI   R12,>1E00
    SBO  0
    LI   R1,>0300
    LI   R3,>4006
    MOV  R1,*R3+     * not sure if the "plus" is actually needed
    SBZ  0
    MOV @SAVRTN,R11
    RT


**** set to BANK 1

SBZ    MOV  R11,@SAVRTN
    LI   R12,>1E00
    SBO  0
    LI   R3,>4006
    LI   R1,>0100
    MOVB R1,*R3
        SBZ  0          * not sure this is needed
    MOV  @SAVRTN,R11
    RT

***** ADD A BANK
    
ADPG    MOV  R11,@SAVRTN
    LI   R12,>1E00
    SBO  0
    LI   R3,>4006
    MOV  *R3,R1
    AI   R1,>0100
    MOV  R1,*R3
    SBZ  0                  * not sure if this is needed

    RT

***************************
PROGRAM

TEST    BL    @SAMON
    BL      @SBZ
    CLR     R5
    CLR     R4
INC1    BL    @ADPG
    INC    R5
    CI      R5,10
    JLT     INC1
    LI    R3,>3000
    LI    R1,>4142
INC2    MOV    R1,*R3+
    INC    R4
    CI    R4,>2046     * this may NOT be accurate. but its testing
    JLT    INC2

    BL    @SAMOFF
    BL    @SAMON
    BL    @SBZ
    CLR    R4
    CLR    R5
    
INC3    BL    @ADPG
    INC    R5
    CI    R5,12
    JLT    INC3    
    LI    R0,0
    LI    R3,>3000
INC4    MOV    *R3+,R1
    BLWP    @VSBW
    INC    R0
    CI    R0,960
    JLT    INC4    
    BL    @SAMOFF
    B     @STOP

**********************
STOP    LIMI 2
    LIMI 0
    JMP  STOP

 

 

 

Ok—Here is code that does, I think, what you want to do. I changed your loops around because you were mapping (or trying to) all the pages before writing to any of them, It is in the spoiler below, if you would rather not see it just yet 😊:

Spoiler
VSBW   EQU  >210C

***** turn off SAMS Mapping
SAMOFF LI   R12,>1E00
       SBZ  1
       RT

***** turn on SAMS Mapping (and set for >3000->3FFF???}

SAMON  LI   R12,>1E00
       SBO  1
       RT


**** set to BANK 16

FIRSTB LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       LI   R1,>1000     bank 16
       MOVB R1,*R3
       SBZ  0
       RT

***** MAP A BANK
*++ Pass bank # in R1
       
MAPPG  LI   R12,>1E00
       SBO  0
       LI   R3,>4006
*???    MOV  *R3,R1
*+++    AI   R1,>0100
       MOV  R1,*R3
       SBZ  0
       RT

***************************
PROGRAM

TEST   BL   @SAMON
       BL   @FIRSTB     * Map first bank (bank 16)
       CLR  R5
       CLR  R4

       LI   R2,>4041    * initial value to copy into 10 banks (16-25)
       LI   R5,>1000    * set opening SAMS page
INC1   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       LI   R4,>3000    *   | starting RAM for copy to this bank
       BL   @MAPPG      *   | map next bank
*+++ Do this for each bank so we can actually see a change on screen
       AI   R2,>0101    *   | increment copy value to next pair of letters
*+++                        |
INC2   MOV  R2,*R4+     *<-+|  | copy >4142 to next word of RAM
*+++    INC  R4         *  || check actual RAM address (see later)
*+++    CI   R4,>2046   *  || this may NOT be accurate. but its testing
       CI   R4,>33C0    *  || are we out of screen range?
       JLT  INC2        *>-+|  |
*+++                    *   |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to fill banks >10->19 (16-25)
*+++    INC  R5             |
*+++    CI   R5,10          |
       JLT  INC1        *>--+ next bank if less than bank 26
       
*+++    BL   @SAMOFF    * not necessary unless want powerup conditions
*+++    BL   @SAMON
*+++    BL   @FIRSTB     * Map first bank (bank 16)
*+++    CLR  R4
*+++    CLR  R5

       LI   R5,>1000    * opening SAMS page
INC3   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       LI   R4,>3000    *   | starting RAM for reading from this bank
       BL   @MAPPG          |
*+++    INC  R5             |
*+++    CI   R5,12          |
       LI   R0,0        *   | set initial screen position
       LI   R4,>3000    *   | starting RAM for reading from this bank
*+++                        |
INC4   MOVB *R4+,R1     *<-+| MOVB now..we are working with bytes, not words
       BLWP @VSBW          ||
       INC  R0          *  || increment screen position
       CI   R0,960      *  || done?
       JLT  INC4        *>-+|
*+++                        |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to read banks >10->19 (16-25)
       JLT  INC3        *>--+ next bank if less than bank 26

       BL   @SAMOFF      * not necessary unless want powerup conditions
       B    @STOP

**********************
STOP   LIMI 2
       LIMI 0
       JMP  STOP

       END  PROGRAM

 

 

...lee

Share this post


Link to post
Share on other sites

Here is the same code, but easier to read, i.e., all commented-out lines are removed:

Spoiler
VSBW   EQU  >210C

***** turn off SAMS Mapping
SAMOFF LI   R12,>1E00
       SBZ  1
       RT

***** turn on SAMS Mapping (and set for >3000->3FFF???}

SAMON  LI   R12,>1E00
       SBO  1
       RT


**** set to BANK 16
*++ Trashes R1, R3.

FIRSTB LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       LI   R1,>1000     bank 16
       MOVB R1,*R3
       SBZ  0
       RT

***** MAP A BANK
*++ Bank# must be in R1 before calling this routine.
*++ Trashes R3.
       
MAPPG  LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  R1,*R3
       SBZ  0
       RT

***************************
PROGRAM

TEST   BL   @SAMON
       BL   @FIRSTB     * Map first bank (bank 16)
       CLR  R5
       CLR  R4

       LI   R2,>4041    * initial value to copy into 10 banks (16-25)
       LI   R5,>1000    * set opening SAMS page
INC1   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       BL   @MAPPG      *   | map next bank
       LI   R4,>3000    *   | starting RAM for copy to this bank
*+++ Do this for each bank so we can actually see a change on screen
       AI   R2,>0101    *   | increment copy value to next pair of letters
*+++                        |
*+++ The following code fills each successive bank with a new pair of letters
INC2   MOV  R2,*R4+     *<-+| "AB"(bank1),"BC"(bank2),... to next RAM address
       CI   R4,>33C0    *  || are we out of screen range?
       JLT  INC2        *>-+|
*+++                    *   |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to fill banks >10->19 (16-25)
       JLT  INC1        *>--+ next bank if less than bank 26
       
       LI   R5,>1000    * opening SAMS page
INC3   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       BL   @MAPPG          |
       LI   R0,0        *   | set initial screen position
       LI   R4,>3000    *   | starting RAM for reading from this bank
*+++                        |
INC4   MOVB *R4+,R1     *<-+| MOVB now..we are working with bytes, not words
       BLWP @VSBW          ||
       INC  R0          *  || increment screen position
       CI   R0,960      *  || done?
       JLT  INC4        *>-+|
*+++                        |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to read banks >10->19 (16-25)
       JLT  INC3        *>--+ next bank if less than bank 26

       BL   @SAMOFF      * not necessary unless want powerup conditions
       B    @STOP

**********************
STOP   LIMI 2
       LIMI 0
       JMP  STOP

       END  PROGRAM

 

 

...lee

Edited by Lee Stewart
removed duplicate code
  • Thanks 1

Share this post


Link to post
Share on other sites
Just now, Lee Stewart said:

Here is the same code, but easier to read, i.e., all commented-out lines are removed:

  Reveal hidden contents

VSBW   EQU  >210C

***** turn off SAMS Mapping
SAMOFF LI   R12,>1E00
       SBZ  1
       RT

***** turn on SAMS Mapping (and set for >3000->3FFF???}

SAMON  LI   R12,>1E00
       SBO  1
       RT


**** set to BANK 16
*++ Trashes R1, R3.

FIRSTB LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       LI   R1,>1000     bank 16
       MOVB R1,*R3
       SBZ  0
       RT

***** MAP A BANK
*++ Bank# must be in R1 before calling this routine.
*++ Trashes R3.
       
MAPPG  LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  R1,*R3
       SBZ  0
       RT

***************************
PROGRAM

TEST   BL   @SAMON
       BL   @FIRSTB     * Map first bank (bank 16)
       CLR  R5
       CLR  R4

       LI   R2,>4041    * initial value to copy into 10 banks (16-25)
       LI   R5,>1000    * set opening SAMS page
INC1   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       LI   R4,>3000    *   | starting RAM for copy to this bank
       BL   @MAPPG      *   | map next bank
*+++ Do this for each bank so we can actually see a change on screen
       AI   R2,>0101    *   | increment copy value to next pair of letters
*+++                        |
*+++ The following code fills each successive bank with a new pair of letters
INC2   MOV  R2,*R4+     *<-+| "AB"(bank1),"BC"(bank2),... to next RAM address
       CI   R4,>33C0    *  || are we out of screen range?
       JLT  INC2        *>-+|
*+++                    *   |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to fill banks >10->19 (16-25)
       JLT  INC1        *>--+ next bank if less than bank 26
       
       LI   R5,>1000    * opening SAMS page
INC3   MOV  R5,R1       *<--+ set SAMS page for MAPPG
       LI   R4,>3000    *   | starting RAM for reading from this bank
       BL   @MAPPG          |
       LI   R0,0        *   | set initial screen position
       LI   R4,>3000    *   | starting RAM for reading from this bank
*+++                        |
INC4   MOVB *R4+,R1     *<-+| MOVB now..we are working with bytes, not words
       BLWP @VSBW          ||
       INC  R0          *  || increment screen position
       CI   R0,960      *  || done?
       JLT  INC4        *>-+|
*+++                        |
       AI   R5,>0100    *   | increment to next bank
       CI   R5,>1A00    *   | only want to read banks >10->19 (16-25)
       JLT  INC3        *>--+ next bank if less than bank 26

       BL   @SAMOFF      * not necessary unless want powerup conditions
       B    @STOP

**********************
STOP   LIMI 2
       LIMI 0
       JMP  STOP

       END  PROGRAM

 

 

...lee

but lee, I thought that changing that first byte @4006 to something other than 3 would map a completely different address. As pointed out by automation.

Confused. Isn't that what I was doing previously with "ADPG".

4 hours ago, HOME AUTOMATION said:

So, I don't have a SAMS, I'm running this on Classic99.

 

The main issue for me now is that I don't knect this code to do!:ponder:

 

If it weren't for the TRANSPARENT MODE issue. You would be printing from PAGE >0D(13) which you never write to in the first place!

 

I had to add 4 lines to your code.:grin:

       DEF  TEST
       REF  VSBW
SAVRTN DATA 0

***** turn off SAMS Mapper

SAMOFF MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBZ  0
       SBZ  1             *this is a problem ...you're switching to TRANSPARENT MODE here!
       MOV  @SAVRTN,R11
       RT

***** turn on Mapper and set for >3000->3FFF

SAMON  MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R1,>0300
       LI   R3,>4006
       MOV  R1,*R3     * not sure if the "plus" is actually needed ...I removed the "plus". not sure it was causing an issue here ...but probably not what you wanted.
       SBZ  0
       MOV  @SAVRTN,R11
       RT

**** set to BANK 1

SBZ    MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       LI   R1,>0100
       MOVB R1,*R3
       SBZ  0               * not sure this is needed
       MOV  @SAVRTN,R11
       RT

***** ADD A BANK

ADPG   MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  *R3,R1
       AI   R1,>0100
       MOV  R1,*R3
       SBZ  0                  * not sure if this is needed
       RT

*******PROGRAM

TEST   BL   @SAMON
       BL   @SBZ   *sets >3000 to page >01
       CLR  R5
       CLR  R4
INC1   BL   @ADPG  *sets >3000 to page >02 ...now both >2000 and >3000 are on page >02
       INC  R5     *****************************
       CI   R5,10  * keep switching pages until >3000 is set to page >0B(11) ...this page is also the default page at >B000, specified in >4016
       JLT  INC1
       LI   R3,>3000
       LI   R1,>4142
INC2   MOV  R1,*R3+  *write >4142 to >3000 ...set to page >0B(11)
       INC  R4
       CI   R4,>240
       JLT  INC2
       BL   @SAMOFF  *This enters and leaves us in TRANSPARENT MODE. There is no code in this program to reenter MAPPING MODE!!! So, no changes to the mapping happen after this line!!!
       BL   @SAMON   *and >3000 to page >03
       BL   @SBZ     *sets>3000 to page >01
       CLR  R4
       CLR  R5

INC3   BL   @ADPG    *sets >3000 to page >02 ...now both >2000 and >3000 are on page >02(but not mapped)
       INC  R5       *****************************
       CI   R5,12    ** keep switching pages until >3000 is set to page >0D(13) ...this page is also the default page at >D000, specified in >401A(but not mapped)
       JLT  INC3
       LI   R0,0
       LI   R3,>3000
INC4   MOV  *R3+,R1  *read the word at >3000 and write it into R1
       BLWP @VSBW    *prints every other byte starting from >3000, while in TRANSPARENT MODE, these are the utils now...
       INC  R0
       CI   R0,960
       JLT  INC4
       BL   @SAMOFF
       B    @STOP

**********************

STOP   LIMI 2
       LIMI 0
       JMP  STOP
       END

 

 

Share this post


Link to post
Share on other sites
ADPG   MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  *R3,R1
       AI   R1,>0100
       MOV  R1,*R3
       SBO  1
       RT

Is this, above, valid for mapping >3000->3FFF?

And the code below.

LI      R3,>3000

Mov *R3 R1

LI       R2,>0C00

A        R2,R1

MOV  R1,*R3

And will this give me bank 13 of (>3000->3FFF)?

Edited by GDMike

Share this post


Link to post
Share on other sites
2 hours ago, GDMike said:
Is this valid?

ADPG   MOV  R11,@SAVRTN
       LI   R12,>1E00
       SBO  0
       LI   R3,>4006
       MOV  *R3,R1
       AI   R1,>0100
       MOV  R1,*R3
       SBO  1
       RT

 

No. In fact, this will work (see post by @HOME AUTOMATION later) up until the ( SBO  1 ), which will actually work but turns mapping off!

       MOV  *R3,R1

I do not think you can read a SAMS register, which is what this is trying to do. You must tell SAMS what to load. You can only run This will work (see above comment).

       MOV  R1,*R3

once you give it a bank. You should be calling this MAP_PAGE, not ADD_PAGE. So you should also lose the AI instruction in favor of managing the page # (bank #) in the program.

 

Your last instruction before RT should be

       SBZ  0

Mapping should already be turned on. You need to disable writing to the mapper registers as soon as you have made the page change.

 

...lee

Edited by Lee Stewart
correction
  • Like 1

Share this post


Link to post
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.

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