Below is the test program I use (with the VDU 5 stuff disabled); it runs successfully in

, so I think it can be considered reasonably accurate.

isn't a vertical printing mode, or even a right-to-left mode, it's just the normal 'pending scroll' mode which I assumed had long since been working in Matrix Brandy.

Code: Select all

```
10 REM Test of VDU 23,16 Cursor Movement Control
20
30 ON ERROR VDU 6,3,20,23,16,0|12 : REPORT : PRINT " at line ";ERL: END
40
50 maxtype% = 0
60
70 FOR mode% = 0 TO 3
80 MODE mode%
90 FOR viewport% = 0 TO 1
100 FOR type% = 0 TO maxtype% : REM VDU 4, VDU 5, VDU 2, VDU 2+4
110 FOR cmc% = 0 TO 127
120 VDU 23,16,cmc%|
130
140 xmin% = 0 : ymin% = 0
150 left% = 0 : top% = 0 : right% = 640
160 CASE mode% OF
170 WHEN 0: xmax% = 79 : ymax% = 31 : bottom% = 512 : cx% = 8 : cy% = 16 : height% = 512
180 WHEN 1: xmax% = 39 : ymax% = 31 : bottom% = 512 : cx% = 16 : cy% = 16 : height% = 512
190 WHEN 2: xmax% = 19 : ymax% = 31 : bottom% = 512 : cx% = 32 : cy% = 16 : height% = 512
200 WHEN 3: xmax% = 79 : ymax% = 24 : bottom% = 500 : cx% = 8 : cy% = 20 : height% = 500
210 ENDCASE
220 IF viewport% THEN
230 xmin% = xmax% * 1/3 : xmax% = xmax% * 2/3
240 ymin% = ymax% * 1/3 : ymax% = ymax% * 2/3
250 left% = xmin% * cx% : right% = xmax% * cx%
260 top% = ymin% * cy% : bottom% = ymax% * cy%
270 VDU 26,28,xmin%,ymax%,xmax%,ymin%
280 VDU 24,left%*2;(height%-bottom%-1)*2+2;right%*2-2;(height%-top%-1)*2;
290 ENDIF
300
310 right% = left%+((right%-left%)DIVcx%-1)*cx%
320 bottom% = top%+((bottom%-top%)DIVcy%-1)*cy%
330 CASE type% OF
340 WHEN 0: VDU 4
350 WHEN 1: VDU 5
360 WHEN 2: VDU 4,2
370 WHEN 3: VDU 2,21
380 ENDCASE
390 IF cmc% AND 2 SWAP left%,right% : cx% = -cx%
400 IF cmc% AND 4 SWAP top%,bottom% : cy% = -cy%
410 IF cmc% AND 8 THEN
420 SWAP xmin%,ymin%
430 SWAP xmax%,ymax%
440 SWAP left%,top%
450 SWAP right%,bottom%
460 ENDIF
470
480 REM Home
490 test% = 1
500 VDU 30
510 IF POS
520 CASE type% OF
530 WHEN 0:
540 PROCcheck(POS, VPOS, 0, 0)
550 PRINT TAB(POS,VPOS);
560 PROCcheck(POS, VPOS, 0, 0)
570 WHEN 1:
580 IF cmc% AND 8 THEN
590 PROCcheck(@vdu%!12, @vdu%!8, left%, top%)
600 ELSE
610 PROCcheck(@vdu%!8, @vdu%!12, left%, top%)
620 ENDIF
630 WHEN 2,3:
640 IF cmc% AND 8 THEN
650 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
660 ELSE
670 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
680 ENDIF
690 ENDCASE
700
710 REM Right
720 test% = 2
730 VDU 9
740 IF POS
750 CASE type% OF
760 WHEN 0:
770 PROCcheck(POS, VPOS, 1, 0)
780 PRINT TAB(POS,VPOS);
790 PROCcheck(POS, VPOS, 1, 0)
800 WHEN 1:
810 IF cmc% AND 8 THEN
820 PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%)
830 ELSE
840 PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%)
850 ENDIF
860 WHEN 2,3:
870 IF cmc% AND 8 THEN
880 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
890 ELSE
900 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
910 ENDIF
920 ENDCASE
930
940 REM Down
950 test% = 3
960 VDU 10
970 IF POS
980 CASE type% OF
990 WHEN 0:
1000 PROCcheck(POS, VPOS, 1, 1)
1010 PRINT TAB(POS,VPOS);
1020 PROCcheck(POS, VPOS, 1, 1)
1030 WHEN 1:
1040 IF cmc% AND 8 THEN
1050 PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%+cx%)
1060 ELSE
1070 PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%+cy%)
1080 ENDIF
1090 WHEN 2,3:
1100 IF cmc% AND 8 THEN
1110 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%+pcx%)
1120 ELSE
1130 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%+pcy%)
1140 ENDIF
1150 ENDCASE
1160
1170 REM Left
1180 test% = 4
1190 VDU 8
1200 IF POS
1210 CASE type% OF
1220 WHEN 0:
1230 PROCcheck(POS, VPOS, 0, 1)
1240 PRINT TAB(POS,VPOS);
1250 PROCcheck(POS, VPOS, 0, 1)
1260 WHEN 1:
1270 IF cmc% AND 8 THEN
1280 PROCcheck(@vdu%!12, @vdu%!8, left%, top%+cx%)
1290 ELSE
1300 PROCcheck(@vdu%!8, @vdu%!12, left%, top%+cy%)
1310 ENDIF
1320 WHEN 2,3:
1330 IF cmc% AND 8 THEN
1340 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
1350 ELSE
1360 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
1370 ENDIF
1380 ENDCASE
1390
1400 REM Left, wrapping (or not)
1410 test% = 5
1420 VDU 8
1430 IF POS
1440 CASE type% OF
1450 WHEN 0:
1460 PROCcheck(POS, VPOS, xmax%-xmin%, 0)
1470 PRINT TAB(POS,VPOS);
1480 PROCcheck(POS, VPOS, xmax%-xmin%, 0)
1490 WHEN 1:
1500 IF cmc% AND 64 THEN
1510 IF cmc% AND 8 THEN
1520 PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%+cx%)
1530 ELSE
1540 PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%+cy%)
1550 ENDIF
1560 ELSE
1570 IF cmc% AND 8 THEN
1580 PROCcheck(@vdu%!12, @vdu%!8, right%, top%)
1590 ELSE
1600 PROCcheck(@vdu%!8, @vdu%!12, right%, top%)
1610 ENDIF
1620 ENDIF
1630 WHEN 2,3:
1640 IF cmc% AND 64 THEN
1650 IF cmc% AND 8 THEN
1660 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%+pcx%)
1670 ELSE
1680 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%+pcy%)
1690 ENDIF
1700 ELSE
1710 IF cmc% AND 8 THEN
1720 PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
1730 ELSE
1740 PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
1750 ENDIF
1760 ENDIF
1770 ENDCASE
1780
1790 REM Right, wrapping (or not)
1800 test% = 6
1810 VDU 9
1820 IF POS
1830 CASE type% OF
1840 WHEN 0:
1850 PROCcheck(POS, VPOS, 0, 1)
1860 PRINT TAB(POS,VPOS);
1870 PROCcheck(POS, VPOS, 0, 1)
1880 WHEN 1:
1890 IF cmc% AND 8 THEN
1900 PROCcheck(@vdu%!12, @vdu%!8, left%, top%+cx%)
1910 ELSE
1920 PROCcheck(@vdu%!8, @vdu%!12, left%, top%+cy%)
1930 ENDIF
1940 WHEN 2,3:
1950 IF cmc% AND 8 THEN
1960 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
1970 ELSE
1980 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
1990 ENDIF
2000 ENDCASE
2010
2020 REM Character (wrapping, pending or not moving)
2030 test% = 7
2040 VDU 8,33
2050 IF POS
2060 CASE type% OF
2070 WHEN 0:
2080 CASE TRUE OF
2090 WHEN (cmc% AND 32) <> 0:
2100 IF FNget(POS,VPOS) <> 33 PROCerror
2110 PROCcheck(POS, VPOS, xmax%-xmin%, 0)
2120 PRINT TAB(POS,VPOS);
2130 PROCcheck(POS, VPOS, xmax%-xmin%, 0)
2140 WHEN (cmc% AND 1) <> 0:
2150 IF FNget(xmax%-xmin%,0) <> 33 PROCerror
2160 PROCcheck(POS, VPOS, xmax%-xmin%+1, 0)
2170 PRINT TAB(POS,VPOS);
2180 PROCcheck(POS, VPOS, xmax%-xmin%+1, 0)
2190 OTHERWISE:
2200 IF FNget(xmax%-xmin%,0) <> 33 PROCerror
2210 PROCcheck(POS, VPOS, 0, 1)
2220 PRINT TAB(POS,VPOS);
2230 PROCcheck(POS, VPOS, 0, 1)
2240 ENDCASE
2250 WHEN 1:
2260 IF cmc% AND 32 THEN
2270 IF cmc% AND 64 THEN
2280 IF cmc% AND 8 THEN
2290 PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%+cx%)
2300 ELSE
2310 PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%+cy%)
2320 ENDIF
2330 ELSE
2340 IF cmc% AND 8 THEN
2350 PROCcheck(@vdu%!12, @vdu%!8, right%, top%)
2360 ELSE
2370 PROCcheck(@vdu%!8, @vdu%!12, right%, top%)
2380 ENDIF
2390 ENDIF
2400 ELSE
2410 IF cmc% AND 8 THEN
2420 PROCcheck(@vdu%!12, @vdu%!8, left%, top%+cx%)
2430 ELSE
2440 PROCcheck(@vdu%!8, @vdu%!12, left%, top%+cy%)
2450 ENDIF
2460 ENDIF
2470 WHEN 2,3:
2480 IF cmc% AND 32 THEN
2490 IF cmc% AND 64 THEN
2500 IF cmc% AND 8 THEN
2510 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%+pcx%)
2520 ELSE
2530 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%+pcy%)
2540 ENDIF
2550 ELSE
2560 IF cmc% AND 8 THEN
2570 PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
2580 ELSE
2590 PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
2600 ENDIF
2610 ENDIF
2620 ELSE
2630 IF cmc% AND 8 THEN
2640 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
2650 ELSE
2660 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
2670 ENDIF
2680 ENDIF
2690 ENDCASE
2700
2710 REM Character (unpend, or not moving)
2720 REM test% = 8
2730 REM VDU 34
2740 REM IF POS
2750 REM CASE type% OF
2760 REM WHEN 0:
2770 REM IF cmc% AND 32 THEN
2780 REM IF FNget(POS,VPOS) <> 34 PROCerror
2790 REM PROCcheck(POS, VPOS, xmax%-xmin%, 0)
2800 REM PRINT TAB(POS,VPOS);
2810 REM PROCcheck(POS, VPOS, xmax%-xmin%, 0)
2820 REM ELSE
2830 REM IF FNget(0,1) <> 34 PROCerror
2840 REM PROCcheck(POS, VPOS, 1, 1)
2850 REM PRINT TAB(POS,VPOS);
2860 REM PROCcheck(POS, VPOS, 1, 1)
2870 REM ENDIF
2880 REM WHEN 1:
2890 REM IF cmc% AND 32 THEN
2900 REM IF cmc% AND 64 THEN
2910 REM IF cmc% AND 8 THEN
2920 REM PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%+cx%)
2930 REM ELSE
2940 REM PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%+cy%)
2950 REM ENDIF
2960 REM ELSE
2970 REM IF cmc% AND 8 THEN
2980 REM PROCcheck(@vdu%!12, @vdu%!8, right%, top%)
2990 REM ELSE
3000 REM PROCcheck(@vdu%!8, @vdu%!12, right%, top%)
3010 REM ENDIF
3020 REM ENDIF
3030 REM ELSE
3040 REM IF cmc% AND 8 THEN
3050 REM PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%+cx%)
3060 REM ELSE
3070 REM PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%+cy%)
3080 REM ENDIF
3090 REM ENDIF
3100 REM WHEN 2,3:
3110 REM IF cmc% AND 32 THEN
3120 REM IF cmc% AND 64 THEN
3130 REM IF cmc% AND 8 THEN
3140 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%+pcx%)
3150 REM ELSE
3160 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%+pcy%)
3170 REM ENDIF
3180 REM ELSE
3190 REM IF cmc% AND 8 THEN
3200 REM PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
3210 REM ELSE
3220 REM PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
3230 REM ENDIF
3240 REM ENDIF
3250 REM ELSE
3260 REM IF cmc% AND 8 THEN
3270 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%+pcx%)
3280 REM ELSE
3290 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%+pcy%)
3300 REM ENDIF
3310 REM ENDIF
3320 REM ENDCASE
3330
3340 REM CR
3350 test% = 9
3360 VDU 9,9,9,13
3370 IF POS
3380 CASE type% OF
3390 WHEN 0:
3400 PROCcheck(POS, VPOS, 0, 1)
3410 PRINT TAB(POS,VPOS);
3420 PROCcheck(POS, VPOS, 0, 1)
3430 WHEN 1:
3440 IF cmc% AND 8 THEN
3450 PROCcheck(@vdu%!12, @vdu%!8, left%, top%+cx%)
3460 ELSE
3470 PROCcheck(@vdu%!8, @vdu%!12, left%, top%+cy%)
3480 ENDIF
3490 WHEN 2,3:
3500 IF cmc% AND 8 THEN
3510 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
3520 ELSE
3530 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
3540 ENDIF
3550 ENDCASE
3560
3570 REM Up (back to home)
3580 test% = 10
3590 VDU 11
3600 IF POS
3610 CASE type% OF
3620 WHEN 0:
3630 PROCcheck(POS, VPOS, 0, 0)
3640 PRINT TAB(POS,VPOS);
3650 PROCcheck(POS, VPOS, 0, 0)
3660 WHEN 1:
3670 IF cmc% AND 8 THEN
3680 PROCcheck(@vdu%!12, @vdu%!8, left%, top%)
3690 ELSE
3700 PROCcheck(@vdu%!8, @vdu%!12, left%, top%)
3710 ENDIF
3720 WHEN 2,3:
3730 IF cmc% AND 8 THEN
3740 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
3750 ELSE
3760 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
3770 ENDIF
3780 ENDCASE
3790
3800 REM Up (scroll down or wrap; don't move on printer)
3810 test% = 11
3820 VDU 35,11
3830 IF POS
3840 CASE type% OF
3850 WHEN 0:
3860 IF cmc% AND 32 THEN
3870 IF cmc% AND 16 THEN
3880 IF FNget(0, 0) <> 35 PROCerror
3890 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
3900 PRINT TAB(POS,VPOS);
3910 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
3920 ELSE
3930 IF FNget(0, 1) <> 35 PROCerror
3940 PROCcheck(POS, VPOS, 0, 0)
3950 PRINT TAB(POS,VPOS);
3960 PROCcheck(POS, VPOS, 0, 0)
3970 ENDIF
3980 ELSE
3990 IF cmc% AND 16 THEN
4000 IF FNget(0, 0) <> 35 PROCerror
4010 PROCcheck(POS, VPOS, 1, ymax%-ymin%)
4020 PRINT TAB(POS,VPOS);
4030 PROCcheck(POS, VPOS, 1, ymax%-ymin%)
4040 ELSE
4050 IF FNget(0, 1) <> 35 PROCerror
4060 PROCcheck(POS, VPOS, 1, 0)
4070 PRINT TAB(POS,VPOS);
4080 PROCcheck(POS, VPOS, 1, 0)
4090 ENDIF
4100 ENDIF
4110 WHEN 1:
4120 IF cmc% AND 64 THEN
4130 IF cmc% AND 32 THEN
4140 IF cmc% AND 8 THEN
4150 PROCcheck(@vdu%!12, @vdu%!8, left%, top%-cx%)
4160 ELSE
4170 PROCcheck(@vdu%!8, @vdu%!12, left%, top%-cy%)
4180 ENDIF
4190 ELSE
4200 IF cmc% AND 8 THEN
4210 PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%-cx%)
4220 ELSE
4230 PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%-cy%)
4240 ENDIF
4250 ENDIF
4260 ELSE
4270 IF cmc% AND 32 THEN
4280 IF cmc% AND 8 THEN
4290 PROCcheck(@vdu%!12, @vdu%!8, left%, bottom%)
4300 ELSE
4310 PROCcheck(@vdu%!8, @vdu%!12, left%, bottom%)
4320 ENDIF
4330 ELSE
4340 IF cmc% AND 8 THEN
4350 PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, bottom%)
4360 ELSE
4370 PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, bottom%)
4380 ENDIF
4390 ENDIF
4400 ENDIF
4410 WHEN 2,3:
4420 IF cmc% AND 32 THEN
4430 CASE TRUE OF
4440 WHEN (cmc% AND 64) <> 0:
4450 IF cmc% AND 8 THEN
4460 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%-pcx%)
4470 ELSE
4480 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%-pcy%)
4490 ENDIF
4500 WHEN (cmc% AND 16) <> 0:
4510 IF cmc% AND 8 THEN
4520 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, pbottom%)
4530 ELSE
4540 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, pbottom%)
4550 ENDIF
4560 OTHERWISE:
4570 IF cmc% AND 8 THEN
4580 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
4590 ELSE
4600 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
4610 ENDIF
4620 ENDCASE
4630 ELSE
4640 CASE TRUE OF
4650 WHEN (cmc% AND 64) <> 0:
4660 IF cmc% AND 8 THEN
4670 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%-pcx%)
4680 ELSE
4690 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%-pcy%)
4700 ENDIF
4710 WHEN (cmc% AND 16) <> 0:
4720 IF cmc% AND 8 THEN
4730 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, pbottom%)
4740 ELSE
4750 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, pbottom%)
4760 ENDIF
4770 OTHERWISE:
4780 IF cmc% AND 8 THEN
4790 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
4800 ELSE
4810 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
4820 ENDIF
4830 ENDCASE
4840 ENDIF
4850 ENDCASE
4860
4870 REM Bottom-left
4880 test% = 12
4890 CASE type% OF
4900 WHEN 0: VDU 31,0,ymax%-ymin%
4910 WHEN 1,2,3: VDU 30,11
4920 ENDCASE
4930 IF POS
4940 CASE type% OF
4950 WHEN 0:
4960 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
4970 PRINT TAB(POS,VPOS);
4980 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
4990 WHEN 1:
5000 IF cmc% AND 64 THEN
5010 IF cmc% AND 8 THEN
5020 PROCcheck(@vdu%!12, @vdu%!8, left%, top%-cx%)
5030 ELSE
5040 PROCcheck(@vdu%!8, @vdu%!12, left%, top%-cy%)
5050 ENDIF
5060 ELSE
5070 IF cmc% AND 8 THEN
5080 PROCcheck(@vdu%!12, @vdu%!8, left%, bottom%)
5090 ELSE
5100 PROCcheck(@vdu%!8, @vdu%!12, left%, bottom%)
5110 ENDIF
5120 ENDIF
5130 WHEN 2,3:
5140 CASE TRUE OF
5150 WHEN (cmc% AND 64) <> 0:
5160 IF cmc% AND 8 THEN
5170 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%-pcx%)
5180 ELSE
5190 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%-pcy%)
5200 ENDIF
5210 WHEN (cmc% AND 16) <> 0:
5220 IF cmc% AND 8 THEN
5230 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, pbottom%)
5240 ELSE
5250 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, pbottom%)
5260 ENDIF
5270 OTHERWISE:
5280 IF cmc% AND 8 THEN
5290 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
5300 ELSE
5310 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
5320 ENDIF
5330 ENDCASE
5340 ENDCASE
5350
5360 REM down (scroll up or wrap)
5370 test% = 13
5380 VDU 36,10
5390 IF POS
5400 CASE type% OF
5410 WHEN 0:
5420 IF cmc% AND 32 THEN
5430 IF cmc% AND 16 THEN
5440 IF FNget(0, ymax%-ymin%) <> 36 PROCerror
5450 PROCcheck(POS, VPOS, 0, 0)
5460 PRINT TAB(POS,VPOS);
5470 PROCcheck(POS, VPOS, 0, 0)
5480 ELSE
5490 IF FNget(0, ymax%-ymin%-1) <> 36 PROCerror
5500 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
5510 PRINT TAB(POS,VPOS);
5520 PROCcheck(POS, VPOS, 0, ymax%-ymin%)
5530 ENDIF
5540 ELSE
5550 IF cmc% AND 16 THEN
5560 IF FNget(0, ymax%-ymin%) <> 36 PROCerror
5570 PROCcheck(POS, VPOS, 1, 0)
5580 PRINT TAB(POS,VPOS);
5590 PROCcheck(POS, VPOS, 1, 0)
5600 ELSE
5610 IF FNget(0, ymax%-ymin%-1) <> 36 PROCerror
5620 PROCcheck(POS, VPOS, 1, ymax%-ymin%)
5630 PRINT TAB(POS,VPOS);
5640 PROCcheck(POS, VPOS, 1, ymax%-ymin%)
5650 ENDIF
5660 ENDIF
5670 WHEN 1:
5680 IF cmc% AND 32 THEN
5690 IF cmc% AND 8 THEN
5700 PROCcheck(@vdu%!12, @vdu%!8, left%, top%)
5710 ELSE
5720 PROCcheck(@vdu%!8, @vdu%!12, left%, top%)
5730 ENDIF
5740 ELSE
5750 IF cmc% AND 8 THEN
5760 PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%)
5770 ELSE
5780 PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%)
5790 ENDIF
5800 ENDIF
5810 WHEN 2,3:
5820 IF cmc% AND 32 THEN
5830 CASE TRUE OF
5840 WHEN (cmc% AND 64) <> 0:
5850 IF cmc% AND 8 THEN
5860 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
5870 ELSE
5880 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
5890 ENDIF
5900 WHEN (cmc% AND 16) <> 0:
5910 IF cmc% AND 8 THEN
5920 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
5930 ELSE
5940 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
5950 ENDIF
5960 OTHERWISE:
5970 IF cmc% AND 8 THEN
5980 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
5990 ELSE
6000 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
6010 ENDIF
6020 ENDCASE
6030 ELSE
6040 CASE TRUE OF
6050 WHEN (cmc% AND 64) <> 0:
6060 IF cmc% AND 8 THEN
6070 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
6080 ELSE
6090 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
6100 ENDIF
6110 WHEN (cmc% AND 16) <> 0:
6120 IF cmc% AND 8 THEN
6130 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
6140 ELSE
6150 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
6160 ENDIF
6170 OTHERWISE:
6180 IF cmc% AND 8 THEN
6190 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%+pcx%)
6200 ELSE
6210 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%+pcy%)
6220 ENDIF
6230 ENDCASE
6240 ENDIF
6250 ENDCASE
6260
6270 REM Bottom-right
6280 test% = 14
6290 CASE type% OF
6300 WHEN 0: VDU 31,xmax%-xmin%,ymax%-ymin%
6310 WHEN 1: VDU 30,8
6320 WHEN 2,3: VDU 30,8
6330 ENDCASE
6340 IF POS
6350 CASE type% OF
6360 WHEN 0:
6370 PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
6380 PRINT TAB(POS,VPOS);
6390 PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
6400 WHEN 1:
6410 IF cmc% AND 64 THEN
6420 IF cmc% AND 8 THEN
6430 PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%)
6440 ELSE
6450 PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%)
6460 ENDIF
6470 ELSE
6480 IF cmc% AND 8 THEN
6490 PROCcheck(@vdu%!12, @vdu%!8, right%, bottom%)
6500 ELSE
6510 PROCcheck(@vdu%!8, @vdu%!12, right%, bottom%)
6520 ENDIF
6530 ENDIF
6540 WHEN 2,3:
6550 CASE TRUE OF
6560 WHEN (cmc% AND 64) <> 0:
6570 IF cmc% AND 8 THEN
6580 PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%)
6590 ELSE
6600 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%)
6610 ENDIF
6620 WHEN (cmc% AND 16) <> 0:
6630 IF cmc% AND 8 THEN
6640 PROCcheck(@vdu%!-8, @vdu%!-12, pright%, pbottom%)
6650 ELSE
6660 PROCcheck(@vdu%!-12, @vdu%!-8, pright%, pbottom%)
6670 ENDIF
6680 OTHERWISE:
6690 IF cmc% AND 8 THEN
6700 PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
6710 ELSE
6720 PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
6730 ENDIF
6740 ENDCASE
6750 ENDCASE
6760
6770 REM Character (pending, not moving or wrap)
6780 REM test% = 15
6790 REM VDU 37
6800 REM IF POS
6810 REM CASE type% OF
6820 REM WHEN 0:
6830 REM CASE TRUE OF
6840 REM WHEN (cmc% AND 32) <> 0:
6850 REM IF FNget(POS,VPOS) <> 37 PROCerror
6860 REM PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
6870 REM PRINT TAB(POS,VPOS);
6880 REM PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
6890 REM WHEN (cmc% AND 1) <> 0:
6900 REM IF FNget(xmax%-xmin%, ymax%-ymin%) <> 37 PROCerror
6910 REM PROCcheck(POS, VPOS, xmax%-xmin%+1, ymax%-ymin%)
6920 REM PRINT TAB(POS,VPOS);
6930 REM PROCcheck(POS, VPOS, xmax%-xmin%+1, ymax%-ymin%)
6940 REM WHEN (cmc% AND 16) <> 0:
6950 REM IF FNget(xmax%-xmin%, ymax%-ymin%) <> 37 PROCerror
6960 REM PROCcheck(POS, VPOS, 0, 0)
6970 REM PRINT TAB(POS,VPOS);
6980 REM PROCcheck(POS, VPOS, 0, 0)
6990 REM OTHERWISE:
7000 REM IF FNget(xmax%-xmin%, ymax%-ymin%) <> 37 PROCerror
7010 REM PROCcheck(POS, VPOS, 0, ymax%-ymin%+1)
7020 REM PRINT TAB(POS,VPOS);
7030 REM PROCcheck(POS, VPOS, 0, ymax%-ymin%+1)
7040 REM ENDCASE
7050 REM WHEN 1:
7060 REM IF cmc% AND 32 THEN
7070 REM IF cmc% AND 64 THEN
7080 REM IF cmc% AND 8 THEN
7090 REM PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%)
7100 REM ELSE
7110 REM PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%)
7120 REM ENDIF
7130 REM ELSE
7140 REM IF cmc% AND 8 THEN
7150 REM PROCcheck(@vdu%!12, @vdu%!8, right%, bottom%)
7160 REM ELSE
7170 REM PROCcheck(@vdu%!8, @vdu%!12, right%, bottom%)
7180 REM ENDIF
7190 REM ENDIF
7200 REM ELSE
7210 REM IF cmc% AND 8 THEN
7220 REM PROCcheck(@vdu%!12, @vdu%!8, left%, top%)
7230 REM ELSE
7240 REM PROCcheck(@vdu%!8, @vdu%!12, left%, top%)
7250 REM ENDIF
7260 REM ENDIF
7270 REM WHEN 2,3:
7280 REM IF cmc% AND 32 THEN
7290 REM CASE TRUE OF
7300 REM WHEN (cmc% AND 64) <> 0:
7310 REM IF cmc% AND 8 THEN
7320 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%)
7330 REM ELSE
7340 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%)
7350 REM ENDIF
7360 REM WHEN (cmc% AND 16) <> 0:
7370 REM IF cmc% AND 8 THEN
7380 REM PROCcheck(@vdu%!-8, @vdu%!-12, pright%, pbottom%)
7390 REM ELSE
7400 REM PROCcheck(@vdu%!-12, @vdu%!-8, pright%, pbottom%)
7410 REM ENDIF
7420 REM OTHERWISE:
7430 REM IF cmc% AND 8 THEN
7440 REM PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
7450 REM ELSE
7460 REM PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
7470 REM ENDIF
7480 REM ENDCASE
7490 REM ELSE
7500 REM CASE TRUE OF
7510 REM WHEN (cmc% AND 64) <> 0:
7520 REM IF cmc% AND 8 THEN
7530 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
7540 REM ELSE
7550 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
7560 REM ENDIF
7570 REM WHEN (cmc% AND 16) <> 0:
7580 REM IF cmc% AND 8 THEN
7590 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%)
7600 REM ELSE
7610 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
7620 REM ENDIF
7630 REM OTHERWISE:
7640 REM IF cmc% AND 8 THEN
7650 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%, ptop%+pcx%)
7660 REM ELSE
7670 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%+pcy%)
7680 REM ENDIF
7690 REM ENDCASE
7700 REM ENDIF
7710 REM ENDCASE
7720
7730 REM Character (unpend/scroll, or not moving)
7740 REM test% = 16
7750 REM VDU 38
7760 REM IF POS
7770 REM CASE type% OF
7780 REM WHEN 0:
7790 REM CASE TRUE OF
7800 REM WHEN (cmc% AND 32) <> 0:
7810 REM IF FNget(POS,VPOS) <> 38 PROCerror
7820 REM PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
7830 REM PRINT TAB(POS,VPOS);
7840 REM PROCcheck(POS, VPOS, xmax%-xmin%, ymax%-ymin%)
7850 REM WHEN (cmc% AND 16) <> 0:
7860 REM IF FNget(0, 0) <> 38 PROCerror
7870 REM PROCcheck(POS, VPOS, 1, 0)
7880 REM PRINT TAB(POS,VPOS);
7890 REM PROCcheck(POS, VPOS, 1, 0)
7900 REM OTHERWISE:
7910 REM IF FNget(xmax%-xmin%,ymax%-ymin%-1) <> 37 PROCerror
7920 REM IF FNget(0,ymax%-ymin%) <> 38 PROCerror
7930 REM PROCcheck(POS, VPOS, 1, ymax%-ymin%)
7940 REM PRINT TAB(POS,VPOS);
7950 REM PROCcheck(POS, VPOS, 1, ymax%-ymin%)
7960 REM ENDCASE
7970 REM WHEN 1:
7980 REM IF cmc% AND 32 THEN
7990 REM IF cmc% AND 64 THEN
8000 REM IF cmc% AND 8 THEN
8010 REM PROCcheck(@vdu%!12, @vdu%!8, left%-cy%, top%)
8020 REM ELSE
8030 REM PROCcheck(@vdu%!8, @vdu%!12, left%-cx%, top%)
8040 REM ENDIF
8050 REM ELSE
8060 REM IF cmc% AND 8 THEN
8070 REM PROCcheck(@vdu%!12, @vdu%!8, right%, bottom%)
8080 REM ELSE
8090 REM PROCcheck(@vdu%!8, @vdu%!12, right%, bottom%)
8100 REM ENDIF
8110 REM ENDIF
8120 REM ELSE
8130 REM IF cmc% AND 8 THEN
8140 REM PROCcheck(@vdu%!12, @vdu%!8, left%+cy%, top%)
8150 REM ELSE
8160 REM PROCcheck(@vdu%!8, @vdu%!12, left%+cx%, top%)
8170 REM ENDIF
8180 REM ENDIF
8190 REM WHEN 2,3:
8200 REM IF cmc% AND 32 THEN
8210 REM CASE TRUE OF
8220 REM WHEN (cmc% AND 64) <> 0:
8230 REM IF cmc% AND 8 THEN
8240 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%-pcy%, ptop%)
8250 REM ELSE
8260 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%-pcx%, ptop%)
8270 REM ENDIF
8280 REM WHEN (cmc% AND 16) <> 0:
8290 REM IF cmc% AND 8 THEN
8300 REM PROCcheck(@vdu%!-8, @vdu%!-12, pright%, pbottom%)
8310 REM ELSE
8320 REM PROCcheck(@vdu%!-12, @vdu%!-8, pright%, pbottom%)
8330 REM ENDIF
8340 REM OTHERWISE:
8350 REM IF cmc% AND 8 THEN
8360 REM PROCcheck(@vdu%!-8, @vdu%!-12, pright%, ptop%)
8370 REM ELSE
8380 REM PROCcheck(@vdu%!-12, @vdu%!-8, pright%, ptop%)
8390 REM ENDIF
8400 REM ENDCASE
8410 REM ELSE
8420 REM CASE TRUE OF
8430 REM WHEN (cmc% AND 64) <> 0:
8440 REM IF cmc% AND 8 THEN
8450 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
8460 REM ELSE
8470 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
8480 REM ENDIF
8490 REM WHEN (cmc% AND 16) <> 0:
8500 REM IF cmc% AND 8 THEN
8510 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%)
8520 REM ELSE
8530 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%)
8540 REM ENDIF
8550 REM OTHERWISE:
8560 REM IF cmc% AND 8 THEN
8570 REM PROCcheck(@vdu%!-8, @vdu%!-12, pleft%+pcy%, ptop%+pcx%)
8580 REM ELSE
8590 REM PROCcheck(@vdu%!-12, @vdu%!-8, pleft%+pcx%, ptop%+pcy%)
8600 REM ENDIF
8610 REM ENDCASE
8620 REM ENDIF
8630 REM ENDCASE
8640
8650 VDU 6,3,4,26,23,16,0|
8660
8670 NEXT cmc%
8680 NEXT type%
8690 NEXT viewport%
8700 NEXT mode%
8710
8720 test% = 17
8730 IF maxtype% = 3 THEN
8740 REM Eject sheet from printer:
8750 pcx% = @vdu%!224 : pcy% = @vdu%!228
8760 pleft% = @vdu%!232 : ptop% = @vdu%!240
8770 pright% = @vdu%!236 : pbottom% = @vdu%!244
8780 pright% = pleft%+((pright%-pleft%)DIVpcx%-1)*pcx%
8790 pbottom% = ptop%+((pbottom%-ptop%)DIVpcy%-1)*pcy%
8800
8810 VDU 2,1,30,23,16,16|1,11,23,16,0|3
8820 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, pbottom%)
8830 IF @vdu%!-4 = 0 THEN PROCerror
8840 VDU 2,1,10,3 : REM eject
8850 PROCcheck(@vdu%!-12, @vdu%!-8, pleft%, ptop%)
8860 VDU 2,1,12,3 : REM eject
8870 IF @vdu%!-4 THEN PROCerror
8880 ENDIF
8890
8910 VDU 30 : COLOUR 1,0,255,0 : COLOUR 1
8920 PRINT "All tests completed successfully."
8930 END
8940
8950 DEF FNget(X%,Y%)
8960 LOCAL A%,C%,U%,V%
8970 A% = 135 : U% = POS : V% = VPOS
8980 PRINT TAB(X%,Y%);
8990 C% = USR(&FFF4) DIV 256 AND &FF
9000 PRINT TAB(U%,V%);
9010 = C%
9020
9030 DEF PROCcheck(A%, B%, C%, D%)
9040 IF A%=C% IF B%=D% ENDPROC
9050 DEF PROCerror : LOCAL A%,B%,C%,D%
9060 VDU 6,3,20,23,16,0|
9070 MODE 3 : COLOUR 11
9080 PRINT "Failed at test%=";test%", mode%=";mode% ", viewport%=";viewport% ", type%=";type% ", cmc%=&";~cmc%
9090 IF A%<>C% PRINT "Parameter X is ";A% " but should be ";C%
9100 IF B%<>D% PRINT "Parameter Y is ";B% " but should be ";D%
```