00010 *"D:RAMXE.ASM 00020 .LI OFF 00030 *-------------------------------- 00040 * Copyright 1985 by Daniel L. Moore 00050 * This program may not be sold, 00060 * but it may be freely copied and 00070 * distributed. 00080 *-------------------------------- 00090 * Last modified 04/16/85 00100 *-------------------------------- 00110 * Allow usage of extra RAM in 00120 * 130XE computers from BASIC. 00130 * There are 2 USR routines: 00140 * The first routine checks if 00150 * the machine is a 130XE; 00160 * The second moves blocks of 00170 * memory to and from the additional 00180 * 64K of banked RAM in the 130XE. 00190 *-------------------------------- 00200 * Hardware Equates 00210 * 00220 PORTB .EQ $D301 00230 * 00240 * Page 0 RAM for pointers 00250 * 00260 SOURCE .EQ $D4 FP register 0 00270 SOURCE.BNK .EQ $D6 00280 DEST .EQ $D8 00290 DEST.BNK .EQ $DA 00300 LENGTH .EQ $DC 00310 *-------------------------------- 00320 * Place the code on Page 6, where 00330 * BASIC won't overwrite it. 00340 * 00350 .OR $600 00360 * 00370 .TF "D:RAMXE.OBJ 00380 *-------------------------------- 00390 * In both routines, the value 00400 * returned indicates success or 00410 * failure of the requested function. 00420 * If the USR routine was successfull, 00430 * a 0 will be returned. Otherwise 00440 * the result will be non-zero. 00450 *-------------------------------- 00460 * This routine is callable from 00470 * BASIC. Use the statement: 00480 * A=USR(1536) 00490 * to check if the machine is a 00500 * 130XE. A 0 result means a 130XE 00510 * any other value is not a 130XE. 00520 * 00530 CHECK.XE 00540 PLA parameter count from BASIC 00550 BNE BAD.PARAMETERS 00560 * Check if banked RAM is present 00570 LDX $4000 00580 LDA XE.BANKS+1 00590 STA PORTB bank #1 00600 DEX 00610 STX $4000 00620 LDA XE.BANKS 00630 STA PORTB normal RAM 00640 CPX $4000 00650 BNE GOOD.EXIT 00660 BEQ EXIT.1 00670 *-------------------------------- 00680 * Incorrect number of parameters 00690 * passed to the routine, clean up 00700 * the stack and then exit. 00710 BAD.PARAMETERS 00720 TAY 00730 BEQ .2 00740 .1 PLA drop 2 bytes 00750 PLA 00760 DEY 00770 BNE .1 done? 00780 .2 LDA #$FF 00790 BNE EXIT.1 00800 *-------------------------------- 00810 * The following routine moves 00820 * blocks of memory to and from the 00830 * the banked RAM in the 130XE. 00840 * 00850 * To call this routine from BASIC: 00860 * A=USR(1577,,, 00870 * ,,