Classic Computer Magazine Archive A.N.A.L.O.G. ISSUE 59 / APRIL 1988 / PAGE 21

RAM-INIT

RAMdisk initialization
without MEM.SAV.


by Mack McLeod

Do you ever wish you had more RAMdisk space? If so, read on. The DOS 2.5 RAMdisk for the 130XE is initialized by RAMDISK.COM, placing DUP.SYS and MEM.SAV on D8:, and taking up 87 of the precious 499 sectors available. Some applications, though, do not need DUP and MEM. Autorun programs, or those loaded from the DOS menu, may not require memory to be saved. Also, there are several DOS modifications around that place these files under the OS ROM, making the D8: copies useless. The alternative is to manually delete the files after each boot.
    For applications that need more RAMdisk space, RAM-INIT is the answer. This program will properly initialize an empty RAMdisk. A basic program is used to create RAMINIT.COM. Delete or rename RAMDISK.COM, then rename RAMINIT.COM to install the function. If you write in assembly, the RAMINIT message may be eliminated by deleting Lines 240 to 410, 1140 to 1250 and 1280. Change the JSR in Line 1130 to a JMP.
    The DOS 2.5 address of the RAMdisk initialization filename is $14F1. This contains D:RAMDISK.COM, followed by a $9B. The autorun filename address is $170C. It contains D1:AUTORUN.SYS, followed by a $9B. You may POKE any device prefixed name desired in these locations, as long as the lengths are not exceeded. You will need to use the SAVE DOS FILES option to make the change permanent.

Mack McLeod is an Analyst/Programmer for a major Canadian bank. Even though he works with the largest of mainframes, he's amazed at the power and flexibility of Atari 8-bit machines. He believes they truly provide "Power without the Price." He programs his 130XE primarily in assembly, occasionally in BASIC, and now in C.

The two-letter checksum code preceding the line numbers here is not a part of the BASIC program. For further information, see the "BASIC Editor II," in issue 47.

    Listing 1.
BASIC listing.

OY 160 OPEN #1,8,0,"D:RAMINIT.COM"
ZQ 200 FOR I=1 TO 220
OR 300 READ A: PUT #1,A:NEXT I
BH 400 CLOSE #1:? "RAMINIT.COM CREATED"
SV 900 DATA 255,255,0,6,207,6,169,0,133,1
   9,133,20,169,14,133,85,169,8,133,84,14
   1,72,3,169,0
MS 901 DATA 141,73,3,170,169,200,141,68,3
   ,169,6,141,69,3,169,11,141,66,3,32,86,
   228,173,1,211
TH 902 DATA 133,206,169,235,141,1,211,169
   0,133,203,169,116,133,204,160,0,185,1
   95,6,145,203,200,192,5
CJ 903 DATA 208,246,169,0,145,203,200,192
   ,10,208,249,169,15,145,203,200,169,255
   ,145,203,200,192,55,208,249
XI 904 DATA 169,0,145,203,200,169,127,145
   ,203,200,169,255,145,203,200,192,74,20
   0,249,169,0,145,203,200,192
XX 905 DATA 128,208,249,152,24,101,203,13
   3,203,165,204,105,0,133,204,162,4,169,
   0,168,145,203,200,208,251
LL 906 DATA 230,204,202,208,245,165,206,1
   41,1,211,173,10,7,9,128,141,10,7,32,22
   4,7,165,20,201,64
XX 907 DATA 144,250,162,0,142,68,3,142,69
   ,3,142,72,3,142,73,3,169,11,141,66,3,1
   69,125,76,86
TA 908 DATA 228,2,243,1,243,1,160,210,193
   ,205,201,206,201,212,226,2,227,2,0,6



    Listing 2.
Assembly listing.

0106 ; RAMDISK.COM WITHOUT
0110 ; MEM.SAV, DUP.SYS
0120 ;
0130 ROWCRS   = $54
0140 COLCRS   = $55
0150 ICCOM    = $342
0160 ICPTB    = $0B
0176 ICBAL    = $344
0180 ICBAH    = $345
0190 ICBLH    = $349
0200 ICBLL    = $348
0210 CIOV     = $E456
0220         *=$0600
0230 RAMINI   = *
0240        LDA #0         ;INIT,
0250        STA $13        ;CLOCK,
0260        STA $14        ;BYTES.
0270        LDA #14        ;COLUMN ,
0280        STA COLCRS     ;FOR MSG.
0290        LDA #8         ;ROW FOR,
0300        STA ROWCRS     ;MSG ALSO,
0310        STA ICBLL      ;LENGTH.
0320        LDA #0         ;LEN-HI,
0330        STA ICBLH      ;ALSO,
0340        TAX            ;IOCB NUM.
0350        LDA #MSG&255   ;SET MSG,
0360        STA ICBAL      ;ADDRESS,
0370        LDA #MSG/256   ;IN EDITR,
0380        STA ICBAH      ;IOCB0.
0390        LDA #ICPTB     ;PUT ,
0400        STA ICCOM      ;MESSAGE,
0410        JSR CIOV       ;WITH CIO.
0420        LDA SD301      ;STORAGE,
0430        STA $CE        ;CNTL.
0440        LDA #$ES       ;BANK 2
0450        STA $D301      ;MEM CNTL
0460        LDA #29696&255 ;VTOC LO
0470        STA $CB        ;POINTER
0480        LDA #29696/256 ;VTOC HI
0490        STA $CC        ;POINTER
0500        LDY #0
0510 VLOP1  =   *          ;FIRST,
0520        LDA MASK,Y
0530        STA ($CB),Y    ;SECTION,
0540        INY
0550        CPY #5         ;OF
0560        BNE VLOP1
0570        LDA #0         ;VTOC,
0580 VLOP2  =
0590        STA ($CB),Y    ;IN,
0600        INY
0610        CPY #10        ;DATA,
0620        BNE VLOP2      ;MASK.
0630        LDA #$0F
0640        STA ($CB),Y
0650        INY
0660        LDA #$FF
0670 VLOP3  =   *          ;FREE,
0680        STA ($CB),Y    ;SECTORS.
0690        INY
0700        CPY #55
0710        BNE VLOP3
0720        LDA #0         ;DIR.,
0730        STA ($CB),Y    ;AND,
0740        INY            ;VTOC,
0750        LDA #$7F       ;IN,
0760        STA ($CB),Y    ;USE.
0770        INY
0780        LDA #$FF       ;MORE,
0790 VLOP4  =   *          ;MORE,
0800        STA ($CB),Y    ;EMPTIES.
0810        INY
0820        CPY #74
0830        BNE VLOP4
0840        LDA #0
0850 VLOP5  =   *          ;FINAL,
0860        STA ($CB),Y    ;SEGMENT,
0870        INY            ;IN USE.
0880        CPY #128       ;NON-EXIST
0890        BHE VLOP5
0900        TYA            ;128 IN A
0910        CLC
0920        ADC $CB        ;POINTER,
0930        STA $CB        ;AT,
0940        LDA $CC        ;DIRECT.
0950        ADC #00
0960        STA $CC
0970        LDX #4         ;X256=1024
0980        LDA #0
0990 DLOP1  =   *
1000        TAY            ;LOOP 256
1010 DLOP2  =   *
1020        STA ($CB),Y    ;ZERO,
1030        INY            ;WHOLE,
1040        BNE DLOP2      ;DIRECT.
1050        INC $CC        ;NEXT,
1060        DEX            ;PAGE,
1070        BNE DLOP1      ;LOOP.
1080        LDA $CE        ;NORMAL,
1090        STA $D301      ;BANK.
1100        LDA $706       ;DRVBYT
1110        ORA #$80       ;DRIVE 8
1120        STA $70A
1130        JSR $7E0       ;INIT D8:
1140 TIMER  LDA $14        ;SHORT,
1150        CMP #$40       ;DELAY FOR
1160        BCC TIMER      ;MESSAGE.
1170        LDX #0         ;IOCBO,
1180        STX ICBAL      ;SET UP,
1190        STX ICBAL+1    ;FOR PUT,
1200        STX ICBLL
1210        STX ICBLL+1    ;ROUTINE.
1220        LDA #ICPTB     ;PUT BUFF,
1230        STA ICCOM      ;COMMAND.
1240        LDA #$7D       ;CLEAR,
1250        JMP CIOV       ;SCREEN.
1260 ;
1270 MASK  .BYTE 02,$F3,01,$F3,01
1280 MSG   .BYTE ""
1290       .END