8-Bit Software Online Conversion
Sideways Ram Loader - Listing
10REM Simple loader program
20REM (C)1996 SPROW
30MODE4:PRINT"Searching"
40DIMwriteable% 128
50IFINKEY(-256)=253 THENPROCmaster:EN
D
60IFINKEY(-256)=255 THENPROCbbcorelk:
END
70IFINKEY(-256)=1 THENPROCbbcorelk:EN
D
80:
90DEFPROCmaster
100FORS%=7TO4 STEP-1
110IFFNoccupied(S%)=FALSE THENOSCLI"SR
LOAD SNAPIT 8000 "+STR$(S%):OSCLI"INSERT
"+STR$(S%):PRINT:PRINT"Press CTRL-BREAK
to initialise":ENDPROC
120NEXT
130PRINT:PRINT"No free sideways ram ba
nks":ENDPROC
140:
150DEFPROCbbcorelk
160FORS%=15TO0 STEP-1
170IFFNanyswram(S%)=1 ANDFNoccupied(S%
)=FALSE THENOSCLI"LOAD R.SNAPIT 8000":PR
INT:PRINT"Press BREAK to intialise":ENDP
ROC
180NEXT
190PRINT:PRINT"No free sideways ram ba
nks":ENDPROC
200:
210DEFFNanyswram(socket)
220FORX=0TO2STEP2
230P%=writeable%
240IFINKEY(-256)=1 THENGOTO420
250IFINKEY(-256)=255 THENGOTO270
260:
270[OPTX:SEI:LDA&F4:PHA:LDA#socket:STA
&F4:STA&FE30:CLI:½Set ROM reg to socket#
280LDA&8000:PHA:CLC:ADC#1:STAcopy
290.writeto
300STA&8000:LDA&8000:CMPcopy
310BEQtrue
320.false
330PLA:PLA:STA&F4:STA&FE30:LDA#0:RTS
340.true
350PLA:STA&8000:PLA:STA&F4:STA&FE30:LD
A#1:RTS
360.copy
370EQUB0
380]
390NEXT
400=USRwriteable% AND&FF
410:
420[OPTX:SEI:LDA&F4:PHA:LDA#12:STA&FE0
5:LDA#socket:STA&F4:STA&FE05:CLI:½Dummy
move takes out BASIC then set ROM reg to
socket#
430LDA&8000:PHA:CLC:ADC#1:STAcopy
440.writeto
450STA&8000:LDA&8000:CMPcopy
460BEQtrue
470.false
480PLA:PLA:STA&F4:STA&FE05:LDA#0:RTS
490.true
500PLA:STA&8000:PLA:STA&F4:STA&FE05:LD
A#1:RTS
510.copy
520EQUB0
530]
540NEXT
550=USRwriteable% AND&FF
560:
570DEFFNoccupied(socket)
580A%=170:X%=0:Y%=255:R%=USR&FFF4:REM
Read pointer to start of ROM info table
590X%=(R% AND &FF00)DIV&100
600Y%=(R% AND &FF0000)DIV&10000
610=?((256*Y%)+X%+socket)