Skip to content

Commit f845868

Browse files
committed
Check memory against cache size
1 parent b021579 commit f845868

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

knloader.bas

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,12 @@
194194
4900 ON ERROR GO SUB 6000:ON ERROR
195195
4910 LOAD"/tmp/knloader/cache13"BANK 13
196196
4920 LET maxpag=%BANK 13 DPEEK 16252:LET maxpos=%BANK 13 PEEK 16254
197-
4930 LET y$=BANK 13 PEEK$(16255,~0)
198-
4940 IF y$(LEN y$ TO LEN y$)="/" AND LEN y$>1 THEN LET y$=y$(1 TO LEN y$-1)
199-
4950 LET bnk=13+INT((maxpag*22+maxpos)/74):IF bnk>13 THEN FOR p=14 TO bnk:LOAD"/tmp/knloader/cache"+STR$ p BANK p:NEXT p
200-
4960 DIM z$(22,22):DIM o(22):DIM w$(22,maxpath):DIM x$(22,maxpath):DIM b$(22,maxpath)
201-
4970 RETURN
197+
4930 LET p=PEEK 23401:IF maxpag>p THEN GO TO 6700
198+
4940 LET y$=BANK 13 PEEK$(16255,~0)
199+
4950 IF y$(LEN y$ TO LEN y$)="/" AND LEN y$>1 THEN LET y$=y$(1 TO LEN y$-1)
200+
4960 LET bnk=13+INT((maxpag*22+maxpos)/74):IF bnk>13 THEN FOR p=14 TO bnk:LOAD"/tmp/knloader/cache"+STR$ p BANK p:NEXT p
201+
4970 DIM z$(22,22):DIM o(22):DIM w$(22,maxpath):DIM x$(22,maxpath):DIM b$(22,maxpath)
202+
4980 RETURN
202203

203204
4995 ; Load Options
204205
5000 ON ERROR GO SUB 5200:ON ERROR
@@ -302,6 +303,17 @@
302303
6680 PRINT AT 16,0;"information."
303304
6690 PAUSE 0:STOP
304305

306+
6695 ; Not enough RAM
307+
6700 CLS:PRINT AT 2,3;INK 6;PAPER 2;" ERROR: Not enough memory "
308+
6710 PRINT AT 5,1;"Too much cache data for current"
309+
6720 PRINT AT 6,0;"configuration. ";INK 6;maxpag;INK papel;" memory banks"
310+
6730 PRINT AT 7,0;"are needed, but the maximum"
311+
6740 PRINT AT 8,0;"is ";p;"."
312+
6750 PRINT AT 11,1;"Please use a smaller cache or,"
313+
6760 PRINT AT 12,0;"if possible, expand the physical"
314+
6770 PRINT AT 13,0;"RAM."
315+
6790 PAUSE 0:STOP
316+
305317
6995 ; Default Config
306318
7000 ON ERROR RUN AT %s:ERASE
307319
7010 LET tinta=0:LET papel=7:LET %p=8:LET pos=1:LET pag=0:LET maxpag=0:LET maxpos=1:LET maxpath=64

0 commit comments

Comments
 (0)