Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ex 80 Col & RamWorks bank switching

176 views
Skip to first unread message

Anthony Ortiz

unread,
Nov 9, 2017, 1:26:30 AM11/9/17
to
Does the bank select register ($C073) simply change the entire bank that we know as "aux" such that all the bank-switching soft-switches such as ramrd, ramwrt, hramrd, hramwrt, altzp, 80store, page2, hires, and bank1 all switch between motherboard and the particular bank selected? If so, is that all there is to it or are there some subtleties that we should be aware of?

Also, what does bank "write protect" mean? Does that simply mean you select a bank for reading and another one for writing, therefore protected the "read-only" bank at the expense of the other one?

In the Apple IIe technical reference manual, page 88, there are some aux-memory subroutines listed which say the following :

AUXMOVE JSR $C312 Moves data blocks between main and
auxiliary 48K memory.

XFER JMP $C314 Transfers program control between main and
auxiliary 48K memory.

I take it to mean that I should do a JSR $C312 to execute a data move operation? If so, what is actually going on here? Is there a branch at $C312 that transfers it to some other location? Where is the code that handles these subroutines located?

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 3:25:13 AM11/9/17
to
On Wednesday, November 8, 2017 at 10:26:30 PM UTC-8, Anthony Ortiz wrote:
> In the Apple IIe technical reference manual, page 88, there are some aux-memory subroutines listed which say the following :
>
> AUXMOVE JSR $C312 Moves data blocks between main and
> auxiliary 48K memory.

That is a typo. AUXMOVE is at $C311

It uses the same ZP regs as MOVE @ $FE2C. Namely

MOV_SRC = $003C ; A1L
MOV_END = $003E ; A2L
MOV_DST = $0042 ; A4L
AUXMOVE = $C311 ; C=0 Aux->Main, C=1 Main->Aux
MOVE = $FE2C ; Main<->Main, *MUST* set Y=0 prior!

> XFER JMP $C314 Transfers program control between main and
> auxiliary 48K memory.

> I take it to mean that I should do a JSR $C312 to execute a data move operation?

Yes at $C311, once you set up the

1. ZP src
2. ZP dst
3. ZP end
4. direction via the carry flag.

For an example, see my DHGR.BYTE source
https://github.com/Michaelangel007/apple2_hgrbyte/blob/master/src/dhgr.byte.s#L1339


> If so, what is actually going on here?

It is pretty straight-forward - the MAIN/AUX switches ares used to set which bank of memory is read from/to and written from/to. Here is a disassembly of AUXMOVE:


Prologue
C376: PHA
C377: TYA
C378: PHA
C379: LDA RDRAMRD ; save state which bank to read
C37C: PHA
C37D: LDA RDRAMWRT ; save state which bank to write
C380: PHA
C381: BCC MOVC2M ;
C383: STA RDMAINRAM ; read MAIN
C386: STA WRCARDRAM ; write AUX
C389: BCS MOVESTRT ; always
C38B: MOVEC2M STA WRMAINRAM ; write main
C38E: STA RDCARDRAM ; read AUX

CopyMem
C391: MOVESTRT LDY #0
C393: MOVELOOP LDA (MON.A1L),Y
C395: STA (MON.A4L),Y
C397: INC A4L
C399: BNE NEXTA1
C39B: INC A4H
C39D: NEXTA1 LDA MON.A1L
C39F: CMP MON.A2L
C3A1: LDA MON.A1H
C3A3: SBC MON.A2H
C3A5: INC MON.A1L
C3A7: BNE C01
C3A9: INC MON.A1H
C3AB: BCC MOVELOOP
C3AD: STA WRMAINRAM

Epilogue
C3B0 PLA
C3B1: BPL C03
C3B3: STA WRCARDRAM
C3B5: STA RDMAINRAM
C3B9: PLA
C3BA: BPL MOVERET
C3BC: STA RDCARDRAM
C3BF:MOVERET PLA
C3C0: TAY
C3C1: PLA
C3C2: RTS

You can trace through this with AppleWin via the debugger command:
BPX C311


> Is there a branch at $C312 that transfers it to some other location?
Yes, at $C311 it does a JMP to $C376


> Where is the code that handles these subroutines located?

In the 80-col card firmware.

Cheers,
Michael

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 3:35:05 AM11/9/17
to
On Thursday, November 9, 2017 at 12:25:13 AM UTC-8, Michael 'AppleWin Debugger Dev' wrote:
> C3AB: BCC MOVELOOP
> C3AD: STA WRMAINRAM
>
> Epilogue
> C3B0 PLA
> C3B1: BPL C03
> C3B3: STA WRCARDRAM
> C3B5: STA RDMAINRAM
> C3B9: PLA
> C3BA: BPL MOVERET
> C3BC: STA RDCARDRAM

Minor correction (Forgot the C01 label and the wrong address for C03).
That should be:

C3AB:C01 BCC MOVELOOP

Epilogue
C3AD: STA WRMAINRAM
C3B0 PLA
C3B1: BPL C03
C3B3: STA WRCARDRAM
C3B6:C03 STA RDMAINRAM

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 3:55:58 AM11/9/17
to
On Wednesday, November 8, 2017 at 10:26:30 PM UTC-8, Anthony Ortiz wrote:
> XFER JMP $C314 Transfers program control between main and
> auxiliary 48K memory.

Usage:
; C=0 To Main
; C=1 To Aux
; V=0 Main ZP
; V=1 Aux ZP

Disassembly:

C314 JMP XFER

XFER
C3C3: PHA
C3C4: LDA $03ED
C3C7: PHA
C3C8: LDA $03EE
C3CB: PHA
C3CC: BCC XFERC2M ; Carry = Direction
C3CE: STA RDCARDRAM ; C=1 Main -> Aux
C3D1: STA WRCARDRAM
C3D4: BCS XFERZP
C3D6:XFERC2M STA RDMAINRAM ; C=0 Aux -> Main
C3D9: STA WRMAINRAM
C3DC: PLA
C3DD: STA $03EE
C3E0: PLA
C3E1: STA $03ED
C3E4: PLA
C3E5: BVS XFERAZP
C3E7: STA SETSTDZP
C3EA: BVC JMPDEST
C3EC:XFERAZP STA SETALTZP
C3EF:JMPDST JMP ($03ED)

Anthony Ortiz

unread,
Nov 9, 2017, 12:42:40 PM11/9/17
to
Thanks Michael! Regarding the bank switching, am I correct in stating that the additional banks that ramworks contains work the same way as the original 'aux' bank?

Antoine Vignau

unread,
Nov 9, 2017, 1:40:56 PM11/9/17
to
Anthony: that is exactly the behaviour. The selected bank becomes the aux bank.
av

Michael 'AppleWin Debugger Dev'

unread,
Nov 9, 2017, 1:44:07 PM11/9/17
to
On Thursday, November 9, 2017 at 9:42:40 AM UTC-8, Anthony Ortiz wrote:
> Thanks Michael! Regarding the bank switching, am I correct in stating that the additional banks that ramworks contains work the same way as the original 'aux' bank?

Yes, that's my (limited) understanding of how it works as well. I asked Tom C this exact question a month or two back and he basically said RamWorks Bank functions as a 64K aux-type memory.

AppleWin supports up to 128x 64 KB pages of RamWorks memory so you could always play around with the emulator to explore.

Disclaimer: I have very little knowledge of how the RamWorks is implemented so it wouldn't hurt to get a 2nd opinion / confirmation.

Anthony Ortiz

unread,
Nov 9, 2017, 1:50:59 PM11/9/17
to
Thanks again guys, always a source of knowledge!

Antoine Vignau

unread,
Nov 9, 2017, 5:14:30 PM11/9/17
to
I had to learn for i'm fEDD up, the source code is included and you can also learn by reading. See http://www.brutaldeluxe.fr/products/apple2/imfEDDup/

Antoine

James Davis

unread,
Nov 10, 2017, 2:44:05 AM11/10/17
to
On Thursday, November 9, 2017 at 2:14:30 PM UTC-8, Antoine Vignau wrote:
> I had to learn for i'm fEDD up, the source code is included and you can also learn by reading. See http://www.brutaldeluxe.fr/products/apple2/imfEDDup/
>
> Antoine

Antoine,

What does this mean?

"“i'm fEDD up” (now at version 2.3) is Brutal Deluxe's second answer to nowadays preservation of 3.5" and 5.25" diskettes on the Apple II."

What does this program do? Does it run on an Apple II or on a Windows/Linux PC. Is it an alternative to ADT/ADTpro?
0 new messages