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