Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1477 > unrolled thread
| Started by | D Finnigan <dog_cow@macgui.com> |
|---|---|
| First post | 2015-01-15 19:09 +0000 |
| Last post | 2015-01-20 17:06 -0600 |
| Articles | 15 — 5 participants |
Back to article view | Back to comp.sys.apple2.programmer
Method to address both Legend and Saturn RAM cards D Finnigan <dog_cow@macgui.com> - 2015-01-15 19:09 +0000
Re: Method to address both Legend and Saturn RAM cards "Anton Treuenfels" <teamtempest@yahoo.com> - 2015-01-15 22:21 -0600
Re: Method to address both Legend and Saturn RAM cards gids.rs@sasktel.net - 2015-01-16 09:41 -0800
Re: Method to address both Legend and Saturn RAM cards D Finnigan <dog_cow@macgui.com> - 2015-01-16 19:08 +0000
Re: Method to address both Legend and Saturn RAM cards qkumba <peter.ferrie@gmail.com> - 2015-01-17 21:32 -0800
Re: Method to address both Legend and Saturn RAM cards gids.rs@sasktel.net - 2015-01-17 22:33 -0800
Re: Method to address both Legend and Saturn RAM cards gids.rs@sasktel.net - 2015-01-17 22:54 -0800
Re: Method to address both Legend and Saturn RAM cards Leandro Polimeno <leandro.polimeno@gmail.com> - 2015-02-10 04:53 -0800
Re: Method to address both Legend and Saturn RAM cards gids.rs@sasktel.net - 2015-02-10 21:19 -0800
Re: Method to address both Legend and Saturn RAM cards Leandro Polimeno <leandro.polimeno@gmail.com> - 2015-02-11 05:22 -0800
Re: Method to address both Legend and Saturn RAM cards D Finnigan <dog_cow@macgui.com> - 2015-01-18 10:09 +0000
Re: Method to address both Legend and Saturn RAM cards "Anton Treuenfels" <teamtempest@yahoo.com> - 2015-01-19 08:33 -0600
Re: Method to address both Legend and Saturn RAM cards D Finnigan <dog_cow@macgui.com> - 2015-01-19 18:29 +0000
Re: Method to address both Legend and Saturn RAM cards qkumba <peter.ferrie@gmail.com> - 2015-01-20 09:33 -0800
Re: Method to address both Legend and Saturn RAM cards "Anton Treuenfels" <teamtempest@yahoo.com> - 2015-01-20 17:06 -0600
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-01-15 19:09 +0000 |
| Subject | Method to address both Legend and Saturn RAM cards |
| Message-ID | <dog_cow-1421349003@macgui.com> |
After looking at the technical documentation for the Legend 64KC and the Saturn 32/64/128K RAM cards, it seems that one could write a common routine using 6502 indexed addressing to work on both models of RAM card. The Legend 64KC provides a bank select address at location $C084. This is a write only address used to select bank 0 through 3. The Saturn RAM cards use a series of addresses to select a bank, starting with $C084 for bank 0, $C085 for bank 1, $C086 for bank 2, and so on. So it seems to me that we could use indexed addressing with the X register and $C084 as the base address. First we should have an earlier subroutine detect which card is installed, or just ask the user, and store the setting in ZP location. The subroutine to select a bank should accept the bank number in the X-reg. Here's my first naive attempt at writing the routine. There's definitely room for improvement, but this is the general idea: BANKBASE EQU $C084 ; BASE ADDRESS FOR BANK SELECT ADDR RAMTYPE EQU $06 ; TYPE OF RAM CARD INSTALLED * * * SELECT A 16K RAM BANK. DESIRED BANK NUMBER * SHOULD BE PASSED IN THE A-REG. * BANKSEL LDA RAMTYPE ; WHAT TYPE OF RAM CARD? BEQ :LEGEND ; 0 = LEGEND, 1 = SATURN TAX STA BANKBASE,X ; SELECT BANK RTS :LEGEND LDX #0 STA BANKBASE,X ; SELECT BANK RTS Documentation: <http://lostclassics.apple2.info/wp-content/files/Legend/64KC.pdf> <http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/Memory/Saturn%20Systems%20RAM%20Board/Manuals/Saturn%20Systems%2064K%20and%20128K%20RAM%20Board%20-%20Operations%20Manual.pdf> -- ]DF$ Apple II Book: http://macgui.com/newa2guide/ Usenet: http://macgui.com/usenet/ <-- get posts by email! Apple II Web & Blog hosting: http://a2hq.com/
[toc] | [next] | [standalone]
| From | "Anton Treuenfels" <teamtempest@yahoo.com> |
|---|---|
| Date | 2015-01-15 22:21 -0600 |
| Message-ID | <crCdnUWW-uNNDCXJnZ2dnUU7-dednZ2d@earthlink.com> |
| In reply to | #1477 |
"D Finnigan" <dog_cow@macgui.com> wrote in message news:dog_cow-1421349003@macgui.com... > BANKBASE EQU $C084 ; BASE ADDRESS FOR BANK SELECT ADDR > RAMTYPE EQU $06 ; TYPE OF RAM CARD INSTALLED > * > * > * SELECT A 16K RAM BANK. DESIRED BANK NUMBER > * SHOULD BE PASSED IN THE A-REG. > * > BANKSEL > LDA RAMTYPE ; WHAT TYPE OF RAM CARD? > BEQ :LEGEND ; 0 = LEGEND, 1 = SATURN > TAX > STA BANKBASE,X ; SELECT BANK > RTS > :LEGEND LDX #0 > STA BANKBASE,X ; SELECT BANK > RTS I don't know squat about either card, but: - if the bank number is passed in the A-register, doesn't the instruction LDA RAMTYPE wipe it out first thing? - if the value of the X-register is zero, there is no practical difference between STA BANKBASE,X and STA BANKBASE unless there's some weird hardware quirk that "notices" the address mode and does something special about it. - so how about this: BANKSEL LDX RAMTYPE BEQ LEGEND TAX LEGEND STA BANKBASE,X RTS - Anton Treuenfels
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-01-16 09:41 -0800 |
| Message-ID | <5f4fce0f-eef3-4e51-aaef-f3929de36fbd@googlegroups.com> |
| In reply to | #1478 |
On Thursday, January 15, 2015 at 10:21:37 PM UTC-6, Anton Treuenfels wrote:
> "D Finnigan" wrote in message
>
> > BANKBASE EQU $C084 ; BASE ADDRESS FOR BANK SELECT ADDR
> > RAMTYPE EQU $06 ; TYPE OF RAM CARD INSTALLED
> > *
> > *
> > * SELECT A 16K RAM BANK. DESIRED BANK NUMBER
> > * SHOULD BE PASSED IN THE A-REG.
> > *
> > BANKSEL
> > LDA RAMTYPE ; WHAT TYPE OF RAM CARD?
> > BEQ :LEGEND ; 0 = LEGEND, 1 = SATURN
> > TAX
> > STA BANKBASE,X ; SELECT BANK
> > RTS
> > :LEGEND LDX #0
> > STA BANKBASE,X ; SELECT BANK
> > RTS
>
> I don't know squat about either card, but:
>
> - if the bank number is passed in the A-register, doesn't the instruction
>
> LDA RAMTYPE
>
> wipe it out first thing?
>
> - if the value of the X-register is zero, there is no practical difference
> between
>
> STA BANKBASE,X
>
> and
>
> STA BANKBASE
>
> unless there's some weird hardware quirk that "notices" the address mode and
> does something special about it.
>
> - so how about this:
>
> BANKSEL
> LDX RAMTYPE
> BEQ LEGEND
> TAX
> LEGEND
> STA BANKBASE,X
> RTS
>
> - Anton Treuenfels
No. That doesn't quite work either.
You need to be able to store a 0-$F in the Saturns register.
So Maybe something like this
LDY #0-3 ; for Legend
LDY #0-$F; for Saturn
BANKSEL LDX RAMTYPE ; WHAT TYPE OF RAM CARD?
BEQ :LEGEND ; 0 = LEGEND, 1 = SATURN
TYA
STA BANKBASE,X ; SELECT BANK
RTS
:LEGEND CPY #4
BCS RETURN
TYA
TAX
STA BANKBASE,X ; SELECT BANK
RETURN RTS
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-01-16 19:08 +0000 |
| Message-ID | <dog_cow-1421435342@macgui.com> |
| In reply to | #1479 |
I grimly admit that the 6502 code in my initial article wasn't a very good expression of my idea, but I hope that people can still understand my intent. Thanks for the fixes. When I've got some more time to do this properly, I'll come up with something better. -- ]DF$ Apple II Book: http://macgui.com/newa2guide/ Usenet: http://macgui.com/usenet/ <-- get posts by email! Apple II Web & Blog hosting: http://a2hq.com/
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2015-01-17 21:32 -0800 |
| Message-ID | <2e88c3d7-749a-43c2-8ab6-48af7884af5f@googlegroups.com> |
| In reply to | #1479 |
That's not quite right, either.
LDA #0-3 ; for Legend
LDA #0-$F; for Saturn
BANKSEL LDX RAMTYPE ; WHAT TYPE OF RAM CARD?
BNE :SATURN ; 0 = LEGEND, 1 = SATURN
CMP #4 ; LEGEND
BCS RETURN
db #$24 ; BIT masks TAX
:SATURN
TAX
STA BANKBASE,X ; SELECT BANK
RETURN RTS
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-01-17 22:33 -0800 |
| Message-ID | <276de793-dd18-47b7-87b7-f9c5f5316798@googlegroups.com> |
| In reply to | #1481 |
On Saturday, 17 January 2015 23:32:16 UTC-6, qkumba wrote: > That's not quite right, either. > > LDA #0-3 ; for Legend > LDA #0-$F; for Saturn > > BANKSEL LDX RAMTYPE ; WHAT TYPE OF RAM CARD? > BNE :SATURN ; 0 = LEGEND, 1 = SATURN > CMP #4 ; LEGEND > BCS RETURN > > db #$24 ; BIT masks TAX > :SATURN > TAX > STA BANKBASE,X ; SELECT BANK > RETURN RTS I think you had better re-read David's first post. This next line is not possible. > The Saturn RAM cards use a series of addresses to select a bank, starting with $C084 for bank 0, $C085 for bank 1, $C086 for bank 2, and so on. A Saturn card can have up to 128 kb which is 16 banks of 16 kb. Your code would be accessing $C084 - $C093. You have a bug in your code. Ergo, how the cards are stated to be accessed, are more than likely turned around. See what you started David? You listed buggy code.
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-01-17 22:54 -0800 |
| Message-ID | <ebb13e2c-0c6d-4bc8-9353-7476a4f1e1d1@googlegroups.com> |
| In reply to | #1482 |
Here is some Ram drive code I have for the Saturn. There looks to be 8 subbanks within 1 or 2 main banks depending if its 64 or 128 kb. The subbanks are accessed from $C084.C087 and $C00C.C00F. ; ProDOS disk driver for ; 64k/128k Saturn ramcard ; ; Matthew Lee Stier ; Sun Microsystems ORG $2000 LDY #7 NXTBLK16 LDX LC.INDEX,Y ; TEST FOR RAMCARD LDA $C080,X ; SIZE BIT $C083 ; ENABLE BANK 2 BIT $C083 TYA STA $D000 DEY BPL NXTBLK16 BIT $C08F LDY $D000 ; GET RAMCARD SIZE BIT $C084 ; RESTORE BLOCK 0 BIT $C089 ; BANK 1 BIT $C089 CPY #8 ; ILLEGAL BANK SIZE? BCS TESTRTN ; YES... TYA ASL TAY LDX BLKSIZE+1,Y ; GET RAMCARD SIZE LDA BLKSIZE,Y ; IN PRODOS BLOCKS BNE INSTALL ; IF NOT 0 THEN INSTALL SEC ; ELSE FLAG AN ERROR TESTRTN RTS ; AND QUIT LC.INDEX DB $4,$5,$6,$7,$C,$D,$E,$F BLKSIZE DW 0,0,0,96,0,0,0,224
[toc] | [prev] | [next] | [standalone]
| From | Leandro Polimeno <leandro.polimeno@gmail.com> |
|---|---|
| Date | 2015-02-10 04:53 -0800 |
| Message-ID | <94496630-650b-4c0b-8d64-bea0c23bcfde@googlegroups.com> |
| In reply to | #1483 |
Humm, But that code, RAMDrive for 64k/128k Saturn by Matthew Lee Stier, works on ProDOS 1.9 ?! I have it and can´t play with. Can you provide an image for test ?! Regards, Polimeno Em domingo, 18 de janeiro de 2015 04:54:46 UTC-2, gid...@sasktel.net escreveu: > Here is some Ram drive code I have for the Saturn. > > There looks to be 8 subbanks within 1 or 2 main banks depending if its 64 or 128 kb. > > The subbanks are accessed from $C084.C087 and $C00C.C00F. > > ; ProDOS disk driver for > ; 64k/128k Saturn ramcard > ; > ; Matthew Lee Stier > ; Sun Microsystems > > > ORG $2000 > LDY #7 > NXTBLK16 LDX LC.INDEX,Y ; TEST FOR RAMCARD > LDA $C080,X ; SIZE > BIT $C083 ; ENABLE BANK 2 > BIT $C083 > TYA > STA $D000 > DEY > BPL NXTBLK16 > BIT $C08F > LDY $D000 ; GET RAMCARD SIZE > BIT $C084 ; RESTORE BLOCK 0 > BIT $C089 ; BANK 1 > BIT $C089 > CPY #8 ; ILLEGAL BANK SIZE? > BCS TESTRTN ; YES... > TYA > ASL > TAY > LDX BLKSIZE+1,Y ; GET RAMCARD SIZE > LDA BLKSIZE,Y ; IN PRODOS BLOCKS > BNE INSTALL ; IF NOT 0 THEN INSTALL > SEC ; ELSE FLAG AN ERROR > TESTRTN RTS ; AND QUIT > > LC.INDEX DB $4,$5,$6,$7,$C,$D,$E,$F > BLKSIZE DW 0,0,0,96,0,0,0,224
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2015-02-10 21:19 -0800 |
| Message-ID | <926aa9f1-7a48-4737-a735-b4844b459cb7@googlegroups.com> |
| In reply to | #1504 |
On Tuesday, February 10, 2015 at 6:53:38 AM UTC-6, Leandro Polimeno wrote: > Humm, > > But that code, RAMDrive for 64k/128k Saturn by Matthew Lee Stier, works on ProDOS 1.9 ?! I have it and can´t play with. > > Can you provide an image for test ?! > > Regards, > > Polimeno > > Em domingo, 18 de janeiro de 2015 04:54:46 UTC-2, gid...@sasktel.net escreveu: > > Here is some Ram drive code I have for the Saturn. > > > > There looks to be 8 subbanks within 1 or 2 main banks depending if its 64 or 128 kb. > > > > The subbanks are accessed from $C084.C087 and $C00C.C00F. > > > > ; ProDOS disk driver for > > ; 64k/128k Saturn ramcard > > ; > > ; Matthew Lee Stier > > ; Sun Microsystems > > > > > > ORG $2000 > > LDY #7 > > NXTBLK16 LDX LC.INDEX,Y ; TEST FOR RAMCARD > > LDA $C080,X ; SIZE > > BIT $C083 ; ENABLE BANK 2 > > BIT $C083 > > TYA > > STA $D000 > > DEY > > BPL NXTBLK16 > > BIT $C08F > > LDY $D000 ; GET RAMCARD SIZE > > BIT $C084 ; RESTORE BLOCK 0 > > BIT $C089 ; BANK 1 > > BIT $C089 > > CPY #8 ; ILLEGAL BANK SIZE? > > BCS TESTRTN ; YES... > > TYA > > ASL > > TAY > > LDX BLKSIZE+1,Y ; GET RAMCARD SIZE > > LDA BLKSIZE,Y ; IN PRODOS BLOCKS > > BNE INSTALL ; IF NOT 0 THEN INSTALL > > SEC ; ELSE FLAG AN ERROR > > TESTRTN RTS ; AND QUIT > > > > LC.INDEX DB $4,$5,$6,$7,$C,$D,$E,$F > > BLKSIZE DW 0,0,0,96,0,0,0,224 I don't have the assembled code for this driver. Just the source code that was down loaded from the internet. If you have it, then you have what I have. I don't have a Saturn card so didn't see a need to assemble the code. Were you able to assemble the source and check it for any discrepancies?
[toc] | [prev] | [next] | [standalone]
| From | Leandro Polimeno <leandro.polimeno@gmail.com> |
|---|---|
| Date | 2015-02-11 05:22 -0800 |
| Message-ID | <f560888f-bed1-4d01-8a26-9ae7505ddbda@googlegroups.com> |
| In reply to | #1505 |
I have it assembled but for my Saturn clone didn´t work on any version of ProDOS all. Let me got at home and send an image. Regards, Polimeno Em quarta-feira, 11 de fevereiro de 2015 03:19:20 UTC-2, gid...@sasktel.net escreveu: > On Tuesday, February 10, 2015 at 6:53:38 AM UTC-6, Leandro Polimeno wrote: > > Humm, > > > > But that code, RAMDrive for 64k/128k Saturn by Matthew Lee Stier, works on ProDOS 1.9 ?! I have it and can´t play with. > > > > Can you provide an image for test ?! > > > > Regards, > > > > Polimeno > > > > Em domingo, 18 de janeiro de 2015 04:54:46 UTC-2, gid...@sasktel.net escreveu: > > > Here is some Ram drive code I have for the Saturn. > > > > > > There looks to be 8 subbanks within 1 or 2 main banks depending if its 64 or 128 kb. > > > > > > The subbanks are accessed from $C084.C087 and $C00C.C00F. > > > > > > ; ProDOS disk driver for > > > ; 64k/128k Saturn ramcard > > > ; > > > ; Matthew Lee Stier > > > ; Sun Microsystems > > > > > > > > > ORG $2000 > > > LDY #7 > > > NXTBLK16 LDX LC.INDEX,Y ; TEST FOR RAMCARD > > > LDA $C080,X ; SIZE > > > BIT $C083 ; ENABLE BANK 2 > > > BIT $C083 > > > TYA > > > STA $D000 > > > DEY > > > BPL NXTBLK16 > > > BIT $C08F > > > LDY $D000 ; GET RAMCARD SIZE > > > BIT $C084 ; RESTORE BLOCK 0 > > > BIT $C089 ; BANK 1 > > > BIT $C089 > > > CPY #8 ; ILLEGAL BANK SIZE? > > > BCS TESTRTN ; YES... > > > TYA > > > ASL > > > TAY > > > LDX BLKSIZE+1,Y ; GET RAMCARD SIZE > > > LDA BLKSIZE,Y ; IN PRODOS BLOCKS > > > BNE INSTALL ; IF NOT 0 THEN INSTALL > > > SEC ; ELSE FLAG AN ERROR > > > TESTRTN RTS ; AND QUIT > > > > > > LC.INDEX DB $4,$5,$6,$7,$C,$D,$E,$F > > > BLKSIZE DW 0,0,0,96,0,0,0,224 > > > > I don't have the assembled code for this driver. Just the source code that was down loaded from the internet. If you have it, then you have what I have. I don't have a Saturn card so didn't see a need to assemble the code. > > Were you able to assemble the source and check it for any discrepancies?
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-01-18 10:09 +0000 |
| Message-ID | <dog_cow-1421575793@macgui.com> |
| In reply to | #1482 |
gids.rs wrote: > > I think you had better re-read David's first post. > > This next line is not possible. > >> The Saturn RAM cards use a series of addresses to select a bank, starting > with $C084 for bank 0, $C085 for bank 1, $C086 for bank 2, and so on. > > > A Saturn card can have up to 128 kb which is 16 banks of 16 kb. Your code > would be accessing $C084 - $C093. You have a bug in your code. > > Ergo, how the cards are stated to be accessed, are more than likely turned > around. Links to documentation in my first post. The Legend card definitely uses only 1 address, and that's $C084, as a bank select. It's write-only. Refer to PDF page 15. The problem is that Saturn uses multiple addressses, but they're not contiguous. Once you get above a certain bank number, there's a jump. Refer to PDF page 73. > > See what you started David? You listed buggy code. OK, here's the code that came to my head this morning. This is closer to what I had in mind. As with my first listing, this is completely untested. So you start out with RAMTYPE EQU $06 ; ZERO-PAGE LOCATION BANKSEL EQU $C084 same as last time, but now your subroutine looks like this: AND RAMTYPE TAX STA BANKSEL,X RTS The premise here being that an earlier subroutine has either stored a 0 in RAMTYPE for the Legend, or it has stored the maxinum number of banks for the Saturn card. The desired bank number is still sent in A. So there's a mask to set up the X-register to use either the bank index for Saturn, or just $C084,0 for the Legend. Short and sweet. Except that apparently it will still fail on the high bank numbers for Saturn because it jumps from $C087 to $C08C. -- ]DF$ Apple II Book: http://macgui.com/newa2guide/ Usenet: http://macgui.com/usenet/ <-- get posts by email! Apple II Web & Blog hosting: http://a2hq.com/
[toc] | [prev] | [next] | [standalone]
| From | "Anton Treuenfels" <teamtempest@yahoo.com> |
|---|---|
| Date | 2015-01-19 08:33 -0600 |
| Message-ID | <LuOdne0v5K89iCDJnZ2dnUU7-I-dnZ2d@earthlink.com> |
| In reply to | #1484 |
"D Finnigan" <dog_cow@macgui.com> wrote in message news:dog_cow-1421575793@macgui.com... > So you start out with > > RAMTYPE EQU $06 ; ZERO-PAGE LOCATION > BANKSEL EQU $C084 > > same as last time, but now your subroutine looks like this: > > AND RAMTYPE > TAX > STA BANKSEL,X > RTS > > The premise here being that an earlier subroutine has either stored a 0 in > RAMTYPE for the Legend, or it has stored the maxinum number of banks for > the > Saturn card. The desired bank number is still sent in A. So there's a mask > to set up the X-register to use either the bank index for Saturn, or just > $C084,0 for the Legend. Uh, not quite. If you store $00 in RAMTYPE, then the AND will set the A-register to zero as well. So this code will never select anything but bank zero for the Legend. One way out is to create an offset table for the Saturn: LDX RAMTYPE BEQ setLegend TAY LDX offsetSaturn setLegend STA BANKSELECT,X RTS offsetSaturn DFB 0,1,2,3,4,5,6,7,12,13,14,.... Without a table: LDX RAMTYPE BEQ setLegend CMP #8 BCC lowSaturn ADC #4-1 ; 8->12, 9->13, etc lowSaturn TAX setLegend STA BANKSELECT,X RTS That's assuming that the actual value stored from the A-register matters for the Legend but only the address written to matters for the Saturn. - Anton Treuenfels
[toc] | [prev] | [next] | [standalone]
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Date | 2015-01-19 18:29 +0000 |
| Message-ID | <dog_cow-1421692212@macgui.com> |
| In reply to | #1485 |
Anton Treuenfels wrote: > > Uh, not quite. If you store $00 in RAMTYPE, then the AND will set the > A-register to zero as well. So this code will never select anything but I would have gotten it right on the third try. :-) > > That's assuming that the actual value stored from the A-register matters > for the Legend but only the address written to matters for the Saturn. Yes.
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2015-01-20 09:33 -0800 |
| Message-ID | <81a9de46-b503-44aa-825c-6251d4221b8f@googlegroups.com> |
| In reply to | #1485 |
> LDX offsetSaturn
LDX offsetSaturn, Y
However, that's still too many accesses. According to the documentation, it should be 4 and 4 for bank select, not 8 and 8. The other set of 4 and 4 are ROM/RAM access and write protection control, within the currently selected bank.
> Without a table:
>
> LDX RAMTYPE
> BEQ setLegend
> CMP #8
> BCC lowSaturn
> ADC #4-1 ; 8->12, 9->13, etc
> lowSaturn
> TAX
> setLegend
> STA BANKSELECT,X
> RTS
So, limiting the access and removing one branch:
AND RAMTYPE
CMP #4
BCC lowSaturn
ADC #4-1 ; 4->8, 5->9, 6->10, 7->11
lowSaturn
TAX
STA BANKSELECT,X
RTS
where RAMTYPE is 0 for Legend, and the maximum bank-1 for Saturn (3 or 7).
[toc] | [prev] | [next] | [standalone]
| From | "Anton Treuenfels" <teamtempest@yahoo.com> |
|---|---|
| Date | 2015-01-20 17:06 -0600 |
| Message-ID | <2Mydndkf3ejzQiPJnZ2dnUU7-dOdnZ2d@earthlink.com> |
| In reply to | #1490 |
"qkumba" <peter.ferrie@gmail.com> wrote in message news:81a9de46-b503-44aa-825c-6251d4221b8f@googlegroups.com... >> LDX offsetSaturn > > LDX offsetSaturn, Y yes...that's what it should have been, and what I meant to write. But as you point out, a table isn't the best solution anyway! - Anton Treuenfels
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web