Using the Extended VDU vectors - 92 bytes (0.5%)
- §1. Swaps the vectorVDUV with workspace copy
- §2. Read and store the address of our workspace in .privateWorkspaceHigh/Low
§1. Swaps the vectorVDUV with workspace copy.
This includes swapping the extended VDUV and ROM number. On Exit: Preserves Y
.swapWorkspaceWithVDUVectors = $88f9 TYA PHA remember Y JSR .getPrivateWorkspaceAddress Swaps the current vectorVDUV with workspace[.workspaceOffsetOldVDUVectorV] LDY #.workspaceOffsetOldVDUVectorVLow } LDA .vectorVDUVLow } PHA } LDA (.privateWorkspaceLow),Y } STA .vectorVDUVLow } PLA } STA (.privateWorkspaceLow),Y } INY } swap vectorVDUVLow/High with } workspace LDA .vectorVDUVHigh } PHA } LDA (.privateWorkspaceLow),Y } STA .vectorVDUVHigh } PLA } STA (.privateWorkspaceLow),Y } INY Swaps the extended vectorVDUV with workspace[.workspaceOffsetOldExtendedVDUV] LDA .extendedVDUVLow } PHA } LDA (.privateWorkspaceLow),Y } STA .extendedVDUVLow } PLA } STA (.privateWorkspaceLow),Y } INY } swap .extendedVDUVLow/High with } workspace LDA .extendedVDUVHigh } PHA } LDA (.privateWorkspaceLow),Y } STA .extendedVDUVHigh } PLA } STA (.privateWorkspaceLow),Y } Swaps the extended VDUV ROM number with workspace[.workspaceOffsetOldExtendedVDUVROM] INY } LDA .extendedVDUVROM } PHA } LDA (.privateWorkspaceLow),Y } swap .extendedVDUVROM with } workspace STA .extendedVDUVROM } PLA } STA (.privateWorkspaceLow),Y } PLA TAY recall Y RTS
§2. Read and store the address of our workspace in .privateWorkspaceHigh/Low.
Preserves A,X,Y,Carry
.getPrivateWorkspaceAddress = $8943 PHA } TXA } store A and X PHA } Get the ROM byte for this ROM, which stores the private workspace page LDX .currentlySelectedROM get the ROM slot number LDA .romWorkspaceBytes,X get the high byte of private workspace Set up the private workspace address STA .privateWorkspaceHigh which is non-zero if GXR is active LDA #0 STA .privateWorkspaceLow PLA } TAX } recall A and X PLA } RTS