-
Notifications
You must be signed in to change notification settings - Fork 18
/
BANKTEST.BAS
82 lines (81 loc) · 2.39 KB
/
BANKTEST.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
100 REM TEST BOTH BANKED MEMORY SPACES
102 REM LOWER MEMORY BANK HAS 4KB FROM $C000-$CFFF (49152-53247 DEC)
104 REM UPPER MEMORY BANK HAS 4KB FROM $E000-$EFFF (57344-61439 DEC)
106 PRINT "TEST RAM BANKS"
110 S1=49152:REM START OF SRAM BANK 1
120 E1=53247:REM END OF SRAM BANK 1
130 S2=57344:REM START OF SRAM BANK 2
140 E2=61439:REM END OF SRAM BANK 2
150 B1=61442:REM BANK SELECT REGISTER 1 $F002
160 B2=61443:REM BANK SELECT REGISTER 2 $F003
170 C1=128:REM NUMBER OF 4K BANKS
180 C2=64:REM NUMBER OF 4K BANKS
200 REM CHECK FIRST BANK SELECT REGISTER WRITES TO DIFF LOCNS
210 REM WRITE BANK NUMBER TO FIRST LOCATION IN EACH BANK
220 FOR BK=0 TO C1-1
230 POKE B1,BK:POKE S1,BK
240 NEXT BK
250 REM READ BACK VALUES AND CHECK
260 FOR BK=0 TO C1-1
270 POKE B1,BK
280 IF PEEK(S1)=BK GOTO 320
290 PRINT "FIRST BANK REGISTER TEST 1 FAILED - ";
300 PRINT "BANK";BK;
310 PRINT "VALUE";PEEK(S1):GOTO 400
320 NEXT BK
330 PRINT "FIRST BANK REGISTER TEST 1 PASSED"
400 REM CHECK SECOND BANK SELECT REGISTER WRITES TO DIFF LOCNS
410 REM WRITE BANK NUMBER TO FIRST LOCATION IN EACH BANK
420 FOR BK=0 TO C2-1
430 POKE B2,BK:POKE S2,BK
440 NEXT BK
450 REM READ BACK VALUES AND CHECK
460 FOR BK=0 TO C2-1
470 POKE B2,BK
480 IF PEEK(S2)=BK GOTO 520
490 PRINT "SECOND BANK REGISTER TEST FAILED - ";
500 PRINT "BANK";BK;
510 PRINT "VALUE";PEEK(S2):END
520 NEXT BK
530 PRINT "SECOND BANK REGISTER TEST 1 PASSED"
590 PRINT "TESTING 4K MEMORY, FILLING"
600 REM TEST 4KB ADDRESSING
610 TV=0:POKE B1,0
620 FOR AD=S1 TO E1
630 POKE AD,TV
640 TV=TV+1
650 TV=TV AND 255
655 IF TV=0 THEN PRINT "W";
660 NEXT AD
670 PRINT:PRINT "FILL COMPLETE, READING"
700 TV=0
710 FOR AD=S1 TO E1
720 IF PEEK(AD)=TV GOTO 760
730 PRINT "4K VALUE BANK 1 TEST FAILED - ADDRESS ";AD;
740 PRINT "VALUE ";PEEK(AD)
750 GOTO 800
760 TV=TV+1
770 TV=TV AND 255
772 IF TV=0 THEN PRINT "R";
780 NEXT AD
790 PRINT:PRINT "4K VALUE BANK 1 TEST PASSED"
800 REM TEST 4KB ADDRESSING 2ND BANK
810 TV=0:POKE B2,0
820 FOR AD=S2 TO E2
830 POKE AD,TV
840 TV=TV+1
850 TV=TV AND 255
855 IF TV=0 THEN PRINT "W";
860 NEXT AD
870 PRINT:PRINT "FILL COMPLETE, READING"
900 TV=0
910 FOR AD=S2 TO E2
920 IF PEEK(AD)=TV GOTO 960
930 PRINT "4K VALUE BANK 2 TEST FAILED - ADDRESS ";AD;
940 PRINT "VALUE ";PEEK(AD)
950 GOTO 990
960 TV=TV+1
970 TV=TV AND 255
972 IF TV=0 THEN PRINT "R";
980 NEXT AD
990 PRINT:PRINT "4K VALUE BANK 2 TEST PASSED"