100 REM TEST PROGRAM FOR X16-ROM ISSUE #167
110 REM FOR FIX BY JEREMY DILATUSH
120 REM 29 SEP 2021
130 REM THEORY OF OPERATION:
140 REM VARIOUS VALUES WRITTEN TO VRAM AND TO ARRAYS
150 REM THEN COMPARED
190 :
200 DIM VM%(1,3,255)
210 WH=$4000:WH$="4":REM ADDRESS RANGE HOPEFULLY UNUSED
230 REM VM%(X,Y,Z) MATCHES VPEEK(X,WH+Y*256+Z)
240 XX=-1
290 :
300 PRINT"HERE IS A MEANINGLESS NUMBER:";RND(-TI)
310 PRINT"RANDOMIZING $X"WH$"YZZ"
320 FORX=0TO1
325 FORY=0TO3
330 FORZ=0TO255
340 VM%(X,Y,Z)=INT(RND(1)*256)
350 VPOKEX,WH+256*Y+Z,VM%(X,Y,Z)
360 NEXT
365 NEXT
370 NEXT
390 :
400 PRINT"DERIVING $X"WH$"1ZZ - PEEK IN THE BANK PART OF POKE"
410 FORX=0TO1
420 FORZ=0TO255
430 VM%(VM%(X,0,Z)AND1,1,Z)=Z
440 VPOKEVPEEK(X,WH+Z)AND1,WH+$100+Z,Z
450 NEXT:NEXT
490 :
500 PRINT"DERIVING $X"WH$"2ZZ - PEEK IN THE ADDRESS PART OF POKE"
510 FORX=0TO1
520 FORZ=0TO255
530 VM%(X,2,VM%(0,0,Z))=Z
540 VPOKEX,WH+$200+VPEEK(0,WH+Z),Z
550 NEXT:NEXT
590 :
600 PRINT"DERIVING $X"WH$"3ZZ - PEEK IN THE VALUE PART OF POKE"
610 FORX=0TO1
620 FORZ=0TO255
630 VM%(X,3,Z)=VM%(ZAND1,0,Z)
640 VPOKEX,WH+$300+Z,VPEEK(ZAND1,WH+Z)
650 NEXT:NEXT
690 :
700 PRINT"CHECKING ARRAYS VS VRAM"
710 FORX=0TO1
720 FORY=0TO3
730 FORZ=0TO255
740 E=VM%(X,Y,Z)
750 G=VPEEK(X,WH+Y*256+Z)
760 IFE<>GTHENGOSUB9000
770 NEXT:NEXT:NEXT
780 Y=-1
990 :
1000 PRINT"TRYING PEEK IN THE BANK PART OF PEEK"
1010 FORX=0TO1
1020 FORZ=0TO255
1030 E=VM%(VM%(X,0,Z)AND1,0,Z)
1040 G=VPEEK(VPEEK(X,WH+Z)AND1,WH+Z)
1050 IFE<>GTHENGOSUB9000
1060 NEXT:NEXT
1090 :
1100 PRINT"TRYING PEEK IN THE ADDRESS PART OF PEEK"
1110 FORX=0TO1
1120 FORXX=0TO1
1130 FORZ=0TO255
1140 E=VM%(X,0,VM%(XX,0,Z))
1150 G=VPEEK(X,WH+VPEEK(XX,WH+Z))
1160 IFE<>GTHENGOSUB9000
1170 NEXT:NEXT
1190 :
1200 PRINT"THAT'S ALL I'VE GOT, AND IT SEEMS FINE!"
1210 END
8970 :
8980 :
8990 REM ERROR REPORT
9000 PRINT"ERROR OCCURRED"
9010 PRINT"X=";X
9020 IFXX>=0THENPRINT"XX=";XX
9030 IFY>=0THENPRINT"Y=";Y
9040 PRINT"Z=";Z
9050 PRINT"EXP:";E
9060 PRINT"GOT:";G
9070 STOP
9080 RETURN
