Difference between revisions of "Paging in video memory"
m (1 revision) |
|||
Line 2: | Line 2: | ||
[[Category:6502]] | [[Category:6502]] | ||
The BBC Master, the Aries-B20, the Aries B-32 and the Watford 32 RAM card | The BBC Master, the Aries-B20, the Aries B-32 and the Watford 32 RAM card | ||
− | have shadow screen memory. The following code (taken from | + | have shadow screen memory. The following code (taken from HADFS and |
− | HADFS | + | HostFS<ref>mdfs.net</ref>) will page in or out the video memory |
− | page in or out the video memory transparently using the appropriate OSBYTE | + | transparently using the appropriate OSBYTE call to do so. |
− | call to do so. | ||
\ Screen selection routines | \ Screen selection routines | ||
Line 13: | Line 12: | ||
\ | \ | ||
.vramSelect | .vramSelect | ||
− | TYA:PHA:AND #1:PHA:TAX | + | TYA:PHA:AND #1:PHA:TAX :\ A=0 main RAM, A=1 video RAM |
− | LDA #108:JSR OSBYTE | + | LDA #108:JSR OSBYTE :\ Attempt to select Master video RAM |
− | PLA:INX:BNE vramOk | + | PLA:INX:BNE vramOk :\ X<>255, successful |
− | EOR #1: | + | EOR #1:LDA #111:JSR OSBYTE :\ Attempt to select Aries/Watford RAM |
− | |||
.vramOk | .vramOk | ||
PLA:TAY:RTS | PLA:TAY:RTS | ||
Line 50: | Line 48: | ||
\ &E1 - load is to screen memory | \ &E1 - load is to screen memory | ||
\ &F0 - save is from current memory | \ &F0 - save is from current memory | ||
− | \ &F1 - save | + | \ &F1 - save if from screen memory |
\ ie b7=1 - IO memory, b0=main/video memory | \ ie b7=1 - IO memory, b0=main/video memory | ||
\ | \ | ||
Line 80: | Line 78: | ||
\ | \ | ||
JMP WaitExitDone :\ Jump to release Tube | JMP WaitExitDone :\ Jump to release Tube | ||
− | |||
− | |||
− | |||
[[User:Jgharston|Jgharston]] 22:25, 25 December 2011 (UTC) | [[User:Jgharston|Jgharston]] 22:25, 25 December 2011 (UTC) |
Revision as of 01:13, 8 March 2015
The BBC Master, the Aries-B20, the Aries B-32 and the Watford 32 RAM card have shadow screen memory. The following code (taken from HADFS and HostFS[1]) will page in or out the video memory transparently using the appropriate OSBYTE call to do so.
\ Screen selection routines \ ========================= \ On entry, Y=0 - select main memory \ Y=1 - select video memory \ .vramSelect TYA:PHA:AND #1:PHA:TAX :\ A=0 main RAM, A=1 video RAM LDA #108:JSR OSBYTE :\ Attempt to select Master video RAM PLA:INX:BNE vramOk :\ X<>255, successful EOR #1:LDA #111:JSR OSBYTE :\ Attempt to select Aries/Watford RAM .vramOk PLA:TAY:RTS
Using this code, filing system or other code can selectively access main or video memory according to the standard &FFFFxxxx, &FFFExxxx and &FFFDxxxx address ranges.
\ Decide what local memory to transfer data to/from \ ------------------------------------------------- \ On entry, DADR+0...DADR+3=data transfer address \ A=&Fx - read (load) data \ A=&Ex - write (save) data \ LDX &27A:BPL WaitTransIO :\ No Tube LDX DADR+3 :\ Check transfer address INX:BNE WaitTransTube :\ Tube present, ADDR<&FFxxxxxx .WaitTransIO AND #&F0:TAY :\ Y=transfer flag with b7=1 for IO transfer LDX DADR+2:INX:BEQ WaitIOGo :\ &FFFFxxxx - current IO memory LDA &D0 :\ Get VDU status, bit 4=shadow screen INX:BEQ WaitIOScreen :\ &FFFExxxx - use current display memory according to b4 INX:BNE WaitIOGo :\ Not &FFFDxxxx - use current IO memory LDA #16 :\ &FFFDxxxx - shadow screen memory, force b4=1 .WaitIOScreen AND #16:BEQ WaitIOGo :\ Non-shadow screen displayed, jump with Y=&E0/&F0 INY:JSR vramSelect :\ Set b0 for screen, page in video RAM .WaitIOGo TYA:PHA :\ Save IO and screen selection flags \ At this point, the byte on the stack holds \ &E0 - load is to current memory \ &E1 - load is to screen memory \ &F0 - save is from current memory \ &F1 - save if from screen memory \ ie b7=1 - IO memory, b0=main/video memory \ \ \ Do IO memory transfer here \ \ .WaitExitDone PLA:BPL WaitExitRelease :\ Pop transfer flag, b0=0 - Tube release ROR A:BCS WaitExitScreen :\ b0=1, Screen release RTS .WaitExitRelease JMP TubeRelChk :\ Release Tube, return .WaitExitScreen LDY #0:JMP vramSelect :\ Page in main memory, return \ .WaitTransTube CLC:ADC #&10:ROL A :\ Cy=1/0 for load/save LDA #0:ADC #0:PHA :\ A=1/0 for load/save JSR TubeAction :\ Claim Tube and start transfer \ At this point, the byte on the stack holds \ &1 - load is to Tube \ &0 - save is from Tube \ ie b7=0 - Tube memory \ \ \ Do Tube transfer here \ \ JMP WaitExitDone :\ Jump to release TubeJgharston 22:25, 25 December 2011 (UTC)
- ↑ mdfs.net