10 .OPT NO LIST 20 ;SAVE#D:XEBANKS.M65 30 ;ASM,,#D:XEBANKS.OBJ 40 ; 50 ;-------------------------------- 60 ; Save up to 8 Gr.7+,8,9,10 or 11 70 ; screens into the XE's extra 80 ; RAM. Won't interfere with 90 ; BASIC! 0100 ; 0110 ; Call with: 0120 ; A=USR(1536,oper,scrn,bank) 0130 ; Where: 0140 ; 1536 is addr of routine 0150 ; oper = 0 for save to XRAM 0160 ; 1 for load from XRAM 0170 ; scrn = address of screen RAM 0180 ; bank = a number from 1-8 0190 ; signifying which "bank" 0200 ; to load/save to/from. 0210 ;------------------------------- 0220 ; 0230 FROM = $E0 0240 TO = $E2 0250 PORTB = $D301 0260 ; 0270 *= $0600 0280 START 0290 PLA # of args 0300 PLA ignore high byte 0310 PLA this is the one 0320 BNE LOAD make SCRN the TO 0330 ;else make SCRN the FROM 0340 SAVE 0350 PLA 0360 STA FROM+1 0370 PLA 0380 STA FROM 0390 PLA high of BANK 0400 PLA low of BANK 0410 JSR WHERE 0420 STX TO 0430 STY TO+1 0440 JMP ACTION 0450 LOAD 0460 PLA 0470 STA TO+1 0480 PLA 0490 STA TO 0500 PLA high of BANK 0510 PLA low of BANK 0520 JSR WHERE 0530 STX FROM 0540 STY FROM+1 0550 ACTION 0560 ;here we actually move the data 0570 LDX #$1E # of pages 0580 LOOP1 0590 LDY #0 0600 LOOP2 0610 LDA (FROM),Y 0620 STA (TO),Y 0630 INY 0640 BNE LOOP2 0650 DEX 0660 BEQ DONE 0670 INC FROM+1 next page of RAM 0680 INC TO+1 0690 JMP LOOP1 0695 DONE 0700 LDA #$FD restore it to 0710 STA PORTB normal status. 0720 RTS back to BASIC 0730 WHERE 0740 ; decide if the address is $4000 0750 ; or $5E00. Enable accordingly. 0760 TAX save it for later 0770 CLC 0780 ROR A odd or even? 0790 BCC EVEN 0800 ODD 0810 ; was an odd number, so the bank 0820 ; is 1, 3, 5 or 7. That means 0830 ; it's located at $4000. 0840 JSR ENABLE 0850 LDX #$00 0860 LDY #$40 0870 RTS 0880 EVEN 0890 ; set up for pointing to $5E00. 0900 JSR ENABLE 0910 LDX #$00 0920 LDY #$5E 0930 RTS 0940 ENABLE 0950 DEX 1-8 now 0-7 0960 LDA INSTR,X 0970 STA PORTB 0980 RTS 0990 INSTR 1000 .BYTE $E1,$E1,$E5,$E5 1010 .BYTE $E9,$E9,$ED,$ED