Matrix Brandy BASIC VI for console and SDL1.2: V1.23.1 released

for discussion of bbc basic for windows/sdl, brandy and more
Deleted User 9295

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Deleted User 9295 »

Soruk wrote: Sun Oct 24, 2021 12:10 am Here you go - viewtopic.php?p=329156#p329156
OK, I've done that now.
Deleted User 9295

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Deleted User 9295 »

This version of the test program (still with some tests commented out) has the VDU 5 tests enabled and runs to a successful conclusion on my BASICs and ARM BASIC 5 v1.84.

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

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Soruk »

Richard Russell wrote: Sun Oct 24, 2021 11:33 pm This version of the test program (still with some tests commented out) has the VDU 5 tests enabled and runs to a successful conclusion on my BASICs and ARM BASIC 5 v1.84.
Thanks for this - unsurprisingly it is turning up bugs in my VDU5 implementation, which I'm working through.

Again, I've limited cmc% to 0-7, and added a function that can spit out tracing statements to the Linux calling command line so I can see exactly which statement it is failing at when a test fails.

Edit: A RedSquirrel aside: To get the high-resolution modes 18-21 (640x512) and 25-28 (VGA 640x480) in 2, 4, 16 and 256 colours, do

Code: Select all

*Configure MonitorType 1
and reboot.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Soruk »

Richard Russell wrote: Sun Oct 24, 2021 11:33 pm This version of the test program (still with some tests commented out) has the VDU 5 tests enabled and runs to a successful conclusion on my BASICs and ARM BASIC 5 v1.84.
I've now got Matrix Brandy passing all the tests for cmc% up to 7. Before I allow it to go further, I need to implement vertical text in VDU4 mode...
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Soruk »

Based on this thread viewtopic.php?f=29&t=23808 concerning cascaded IFs mixing single-line IF and a block IF construction, I have changed the default behaviour to behave like that of Richard's BBCSDL (and friends) - this makes the default behaviour different to that of ARM BBC BASIC (and I am open to debate on whether this is a good thing or not, bearing in mind most of the time I have aimed Matrix Brandy to function as closely to ARM BBC BASIC as possible, excluding new features of course).

If the Acorn behaviour is intended, you can put this at the top of a program:

Code: Select all

IF INKEY(-256)=77 THEN SYS "Brandy_CascadedIFtweak",0
This doesn't work on the RISC OS build as the normal RISC OS value of INKEY(-256) is supplied, but will work on all other builds. (It's also a one-character change in the source to switch the default to ARM BBC BASIC behaviour).

Windows nightlies have been rebuilt, as have the RISC OS builds.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Soruk »

The previous post brings up another issue concerning RISC OS - should I override the value of INKEY(-256) on RISC OS so a program can more easily detect it's running under Matrix Brandy instead of ARM BBC BASIC? (I have this on a branch so I know it's technically feasible.)

In common with the other builds, the "traditional" INKEY(-256) value is available via

Code: Select all

SYS "Brandy_Platform" TO ,,,,,r5%
thus on Linux it returns &F9, in RPCEmu it returns &A7. The reason I am inclined to do this is INKEY(-256) is typically used to identify what system the program is running on, thus be able to tune itself to its capabilities (or nicely report it won't run on this system). As such a program running under Matrix Brandy on RISC OS can use capabilities not present on ARM BBC BASIC e.g. GET(x,y) or using OPENUP to open a network connection. The obvious argument against this is that INKEY(-256) is really about the machine/OS than what BASIC does. However, apart from RISC OS platforms the MOS features are provided by Matrix Brandy, and my intercept is for calls from BASIC only using INKEY(-256), calling OS_Byte 129,0,255 on RISC OS returns the true value as it does on ARM BBC BASIC. (On non-RISC OS platforms, this call is emulated and thus returns 77 in R1.)

For the avoidance of confusion, the "Brandy_<whatever>" SYS calls are handled internally to Matrix Brandy on RISC OS and are thus not passed to the OS. Similarly, OS_SWINumberFromString is intercepted to handle the Brandy_<whatever> calls internally, and pass others to the OS.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Deleted User 9295

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Deleted User 9295 »

Soruk wrote: Wed Dec 01, 2021 9:04 am The obvious argument against this is that INKEY(-256) is really about the machine/OS than what BASIC does.
We had a long discussion about this (I haven't attempted to find it) in which it was argued that the 'original' meaning of INKEY(-256) simply isn't fit-for-purpose now. You may remember that I illustrated the futility of using it to indicate the "machine/OS" with the graphic below, showing that there isn't any such well-defined concept these days anyway.

What you need in practice is a 'universal' test, which works in every dialect and version of BBC BASIC, that can initially tell you enough about the capabilities of that BASIC to allow you to drill further down to get more detailed information. INKEY(-256) is the only such 'universal' test available so it has to be re-purposed as identifying the BASIC interpreter rather than the machine/OS.

So for example if INKEY(-256) tells you it's Matrix Brandy you know that you can then use a Brandy-specific SYS call to find out more about the underlying OS, or if it tells you it's BBC BASIC for SDL 2.0 you can use the @platform% variable to tell you about the OS, or if it's BBC BASIC for Windows you can interrogate the version of Windows, etc.

I appreciate that redefining INKEY(-256) like this may upset purists, but it is the only way I know that makes it possible to write programs which will run on a wide-range of different platforms and versions of BBC BASIC.

host_squares.png
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.11 released

Post by Soruk »

Richard Russell wrote: Wed Dec 01, 2021 9:38 am I appreciate that redefining INKEY(-256) like this may upset purists, but it is the only way I know that makes it possible to write programs which will run on a wide-range of different platforms and versions of BBC BASIC.
You make a very compelling argument to commit the change. So (INKEY(-256) AND &F0)=&A0 is ARM BBC BASIC under RISC OS and &4D is then Matrix Brandy on ALL platforms including RISC OS.

Edit: I recall the earlier discussion, when I first introduced INKEY(-256) returning ASC("M") but at the time I felt applying that to RISC OS was perhaps a step too far as we had a real MOS underneath, as we were identifying a "MOS emulation" on other platofrms. But as I do have a means to get the "real" value either via Brandy_Platform or OSBYTE 129 I am now happy that the benefit outweighs the cost.

Edit 2: RISC OS build has been updated. (No update to Windows nightly build as the change is irrelevant to Windows)

Edit 3: Windows and RISC OS rebuilt - bug fix in cascaded IF.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

Hi,

I've released version 1.22.12 of Matrix Brandy BASIC VI, with binary builds for Win32, Win64, RISC OS 26-bit and RISC OS 32-bit.

Changes in this release include:
- System: Fix some floating-point data size mismatches
- System: Fix calculations of matrix dot products (thank you mikefairbank@Github!)
- System: New RISC OS build process using GCCSDK under Linux (thank you Cameron Cawley!)
- Keyboard: Fixed keyboard from eating too much from event queue (thanks David Hawes!)
- Graphics: Implemented GCOL action codes 5-7
- Graphics: Hopefully fixed a triangle drawing bug.
- Graphics: Implement VDU23,16 (as far as already implemented) in VDU5 mode, and fixed many bugs in VDU4 mode. (Still no vertical printing though, at least not in VDU4 mode)
- Teletext: Implemented VDU23,18,4,pri,alt| to select character sets.
This is much cleaner than using SAA505Xlib in the examples, but that will remain as an example for OSWORDs &8B and &8C.
- BASIC: Fix COLOUR(r,g,b) function to return correct values in 256-colour modes.
- BASIC: Fix behaviour of RND followed by a space before parentheses to match ARM and 6502 BBC BASIC.
- BASIC: Change the behaviour of cascaded IF calls to match the behaviour of BBCSDL and friends. This is switchable and can be switched back to Acorn's (strange) behaviour via a SYS call.
- INKEY(-256) now returns ASC("M") (&4D) on ALL platforms, including RISC OS. (R5 from Brandy_Platform and, when called from RISC OS OS_Byte 129,0,255, return the traditional platform value)

Source and binary downloads are available on the website, with source also at GitHub.
Last edited by Soruk on Mon Jan 03, 2022 5:07 pm, edited 2 times in total.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
mike12f
Posts: 77
Joined: Wed Nov 03, 2021 9:40 am
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by mike12f »

Hi Soruk - thanks for all your work on this great tool! It's becoming a really accurate implementation. It's enabled me to resurrect my old Archimedes-BASIC programs very easily - no need to fire up a full emulator, my old programs run from the file-manager now with a simple double-click. Great work, much appreciated!
Mike.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

Just for a bit of fun, here is a quick look at how Matrix Brandy holds up against ARM BBC BASIC - at least under RPCEmu.
ClockSP3 on ARM BBC BASIC and Matrix Brandy
ClockSP3 on ARM BBC BASIC and Matrix Brandy
Of course compiled C code is slower than ARM assembly, but I was surprised how much slower BASIC VI was compared to BASIC V, also that the SharedCLibrary build of Matrix Brandy is about 1/3 the speed of the UnixLib build. Another surprise is the Sphere program (also supplied with PiTubeDirect) actually runs slightly faster under the UnixLib build of Matrix Brandy than under ARM BBC BASIC VI (a big surprise for compiled C code versus and-written ARM assembly)!
Sphere - ARM BBC BASIC V
Sphere - ARM BBC BASIC V
Sphere - ARM BBC BASIC VI
Sphere - ARM BBC BASIC VI
Sphere - Matrix Brandy SharedCLibrary build
Sphere - Matrix Brandy SharedCLibrary build
Sphere - Matrix Brandy UnixLib build
Sphere - Matrix Brandy UnixLib build
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by BigEd »

Edit^4: sorry, this observation is normal!

Hmm, those last two Sphere captures are suspicious - each round of drawing ought to rewrite all the same pixels, so the colour fringes at left and right are rather unexpected. Could they be bugs in drawing very short line segments?? (Even if they were, why wouldn't the four passes overwrite the same pixels???)

Edit: and why might the sphere be yellow and white at top and bottom?? Edit edit: that's OK, it's being redrawn.

Edit^3: I see now that we get red pixels where white and yellow cross... is that perhaps normal?
Last edited by BigEd on Wed Jan 19, 2022 4:09 pm, edited 1 time in total.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

BigEd wrote: Wed Jan 19, 2022 3:42 pm Hmm, those last two Sphere captures are suspicious - each round of drawing ought to rewrite all the same pixels, so the colour fringes at left and right are rather unexpected. Could they be bugs in drawing very short line segments?? (Even if they were, why wouldn't the four passes overwrite the same pixels???)

Edit: and why might the sphere be yellow and white at top and bottom?? Edit edit: that's OK, it's being redrawn.

Edit^3: I see now that we get red pixels where white and yellow cross... is that perhaps normal?
Initially I was thinking a bug would be the most likely explanation, then I realised it shouldn't be, as this is under RISC OS so Matrix Brandy is just sending out PLOT codes. I will take a look at the Sphere code, if it's using FP numbers then it could be differences in rounding between ARM BBC BASIC and Matrix Brandy.
Last edited by Soruk on Wed Jan 19, 2022 4:09 pm, edited 1 time in total.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by BigEd »

Sorry, I was just wrong! JSBeeb is doing the same thing - it's the red pixels at intersections which causes what looks like noise at the left and right edges.
Phlamethrower
Posts: 137
Joined: Fri Nov 24, 2017 1:35 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Phlamethrower »

Soruk wrote: Wed Jan 19, 2022 3:28 pmOf course compiled C code is slower than ARM assembly, but I was surprised how much slower BASIC VI was compared to BASIC V, also that the SharedCLibrary build of Matrix Brandy is about 1/3 the speed of the UnixLib build.
Both of those slowdowns are almost certainly due to use of the FPA instruction set for floating point. There's no FPA hardware in the RIscPC, so instead the instructions get emulated by FPEmulator, making it a heck of a lot slower than properly optimised software FP, like BASIC V & UnixLib use. Software FP was added to the RISC OS port of GCC, and made the default for UnixLib, precisely to avoid the poor performance of FPEmulator.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

Phlamethrower wrote: Thu Jan 20, 2022 12:15 am
Soruk wrote: Wed Jan 19, 2022 3:28 pmOf course compiled C code is slower than ARM assembly, but I was surprised how much slower BASIC VI was compared to BASIC V, also that the SharedCLibrary build of Matrix Brandy is about 1/3 the speed of the UnixLib build.
Both of those slowdowns are almost certainly due to use of the FPA instruction set for floating point. There's no FPA hardware in the RIscPC, so instead the instructions get emulated by FPEmulator, making it a heck of a lot slower than properly optimised software FP, like BASIC V & UnixLib use. Software FP was added to the RISC OS port of GCC, and made the default for UnixLib, precisely to avoid the poor performance of FPEmulator.
I hadn't realised that about GCC, but yes, makes perfect sense about ARM BASIC V and VI. Perhaps a fairer comparison would be to do the same tests on a Raspberry Pi, which has VFP floating point. (I suspect my UnixLib build would still use software FP on that machine?)
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Phlamethrower
Posts: 137
Joined: Fri Nov 24, 2017 1:35 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Phlamethrower »

Soruk wrote: Thu Jan 20, 2022 12:53 am(I suspect my UnixLib build would still use software FP on that machine?)
Correct - a softfloat build will always use softfloat, regardless of the capabilities of the hardware it's running on.

However you can quite easily produce a VFP build, just by compiling & linking with -mfpu=vfp. That'll set the default target to ARMv6+VFPv2 (i.e. Pi 1 and above), and link against a VFP build of UnixLib.
Last edited by Phlamethrower on Thu Jan 20, 2022 11:08 am, edited 1 time in total.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

Phlamethrower wrote: Thu Jan 20, 2022 10:03 am
Soruk wrote: Thu Jan 20, 2022 12:53 am(I suspect my UnixLib build would still use software FP on that machine?)
Correct - a softfloat build will always use softfloat, regardless of the capabilities of the hardware it's running on.

However you can quite easily produce a VFP build, just by compiling & linking with -mvfpu=vfp. That'll set the default target to ARMv6+VFPv2 (i.e. Pi 1 and above), and link against a VFP build of UnixLib.
I'm probably running the wrong version of GCCSDK...

Code: Select all

arm-unknown-riscos-gcc: error: unrecognized command line option '-mvfpu=vfp'
However, my benchmarks run on the RPi look a bit better, at least for ARM BASIC VI:
RPI.png
As before, this is run in a single-tasking environment (from hitting F12).
I am surprised though that the SharedCLibrary build is still slower than the softfloat UnixLib build, I was quietly expecting the SharedCLibrary of RISC OS on the Pi to be making use of the VFP, as BASIC VI does. (Though that doesn't really explain the differences in the integer speeds)
Also, I am guessing the softfloat build is part of the reason why the UnixLib build is still far slower than running a Linux build - both are on RasPi 3B+ machines:

Code: Select all

Matrix Brandy BASIC VI version 1.22.12 (Linux/ARM-32bit) 05 Dec 2021

Starting with 67108864 bytes free

>CHAIN "ClockSp3"
BBC BASIC CPU Timing Program
Really real REPEAT loop  10875.33MHz
Integer REPEAT loop       5419.50MHz
Really real FOR loop     15753.84MHz
Integer FOR loop          7035.57MHz
Trig/Log test           137600.00MHz
String manipulation      12393.52MHz
Procedure call            7962.41MHz
GOSUB call               10843.37MHz
Combined Average         26785.43MHz

Compared with a 2.00MHz BBC B
>_
but again, the integer stuff is really much faster under Linux.

The notable oddities are the Trig/Log test of BASIC V is very much faster than BASIC VI even with the FPU acceleration, and the Linux build of Matrix Brandy is almost twice as fast again for this test, on the same hardware compared to BASIC V.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Phlamethrower
Posts: 137
Joined: Fri Nov 24, 2017 1:35 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Phlamethrower »

Soruk wrote: Thu Jan 20, 2022 10:49 amI'm probably running the wrong version of GCCSDK...

Code: Select all

arm-unknown-riscos-gcc: error: unrecognized command line option '-mvfpu=vfp'
Sorry, typo in my post - it should be -mfpu=vfp
I am surprised though that the SharedCLibrary build is still slower than the softfloat UnixLib build, I was quietly expecting the SharedCLibrary of RISC OS on the Pi to be making use of the VFP, as BASIC VI does.
Sadly the SCL is still using FPA everywhere (the Acorn/Norcroft compiler doesn't support VFP yet)
Phlamethrower
Posts: 137
Joined: Fri Nov 24, 2017 1:35 pm
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Phlamethrower »

Soruk wrote: Thu Jan 20, 2022 10:49 amThe notable oddities are the Trig/Log test of BASIC V is very much faster than BASIC VI even with the FPU acceleration, and the Linux build of Matrix Brandy is almost twice as fast again for this test, on the same hardware compared to BASIC V.
Which version of BASICVFP do you have? In the latest version (1.84) the implementation of the transcendental functions was improved. The old versions relied on the FPA transcendental instructions (since that was the easiest way of getting it working), the new version uses a well-optimised library which should give about the same performance as any modern VFP math lib offered by other platforms/languages.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

Phlamethrower wrote: Thu Jan 20, 2022 11:32 am
Soruk wrote: Thu Jan 20, 2022 10:49 amThe notable oddities are the Trig/Log test of BASIC V is very much faster than BASIC VI even with the FPU acceleration, and the Linux build of Matrix Brandy is almost twice as fast again for this test, on the same hardware compared to BASIC V.
Which version of BASICVFP do you have? In the latest version (1.84) the implementation of the transcendental functions was improved. The old versions relied on the FPA transcendental instructions (since that was the easiest way of getting it working), the new version uses a well-optimised library which should give about the same performance as any modern VFP math lib offered by other platforms/languages.
I've got 1.81 on my RPi. I have 1.84 on RPCEmu, but that's for FPA, not VFP. I'll see if I can find a copy of 1.84 for VFP...

Edit: ROOL's !System update says it's not for RISC OS 5, and that's the only download I can find containing a BASIC64 v1.84 (and that'll be a 26-bit FPA build)

Edit 2: Need to replace my RISC OS ROM image with the newer 5.29 version...

Here's what I got for a VFP build of Matrix Brandy on the RasPi3B+:
RPiVFP.png
Last edited by Soruk on Fri Jan 21, 2022 10:00 pm, edited 3 times in total.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
SKS1
Posts: 327
Joined: Sat Sep 19, 2020 12:04 am
Location: Highland Perthshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by SKS1 »

If you have an old BASICVFP, you will likely have a correspondingly old VFPSupport module in your Pi. You need new VFPSupport (0.15 on) to make use of VFP trig etc. functions in BASIC VI 1.84. Why not blow a new OS onto the Pi?

Regarding the SharedCLibrary build, I wonder if there's a 'market' for something in GCCSDK corresponding to what I did for the Norcroft world - a library that will use VFP hardware (and the new optimised VFPSupport module) if available, falling back to the default implementation if not. RPCEmu still seems a popular platform but is not likely to ever have VFP emulation. You could produce an executable that ran at comparable speeds as today on RPCEmu but get a good speed improvement on hardware with VFP.
Miserable old curmudgeon who still likes a bit of an ARM wrestle now and then. Pi 4, 3, ARMX6, SA Risc PC, A540, A440
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

SKS1 wrote: Thu Jan 20, 2022 12:00 pm If you have an old BASICVFP, you will likely have a correspondingly old VFPSupport module in your Pi. You need new VFPSupport (0.15 on) to make use of VFP trig etc. functions in BASIC VI 1.84. Why not blow a new OS onto the Pi?

Regarding the SharedCLibrary build, I wonder if there's a 'market' for something in GCCSDK corresponding to what I did for the Norcroft world - a library that will use VFP hardware (and the new optimised VFPSupport module) if available, falling back to the default implementation if not. RPCEmu still seems a popular platform but is not likely to ever have VFP emulation. You could produce an executable that ran at comparable speeds as today on RPCEmu but get a good speed improvement on hardware with VFP.
I'm not sure - certainly my preferred build for RPCEmu (and real RPCs) is the UnixLib build as the networking works in it, and it can sidestep the 28MB wimpslot limit on RISC OS 3 (tested on 3.6 - real hardware, and 3.71 RPCEmu) (Edit: Limit exists in 5.29 also). If this VFP+fallback were available in the UnixLib build that would be brilliant. I also tested a -mfpu=fpa build on RPCEmu, and it was actually slower than the soft-float build (implying the FPEmulator isn't exactly fast).

Aside from that, I put the 5.29 nightly ROM on my RISC OS SD card, and now have these results (and yes, ARM BASIC VI is noticeably faster in places):
RO529.png
Though I am still a bit surprised my VFP build is still twice as fast as ARM BASIC VI for trig stuff.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
SKS1
Posts: 327
Joined: Sat Sep 19, 2020 12:04 am
Location: Highland Perthshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by SKS1 »

Every FPA instruction processed by the FPEmulator has gone through a hardware trap and software instruction decode in addition to then pretty much doing the same arithmetic as the soft float. It's about the slowest you could make it.

The 28MB WimpSlot limit only exists on RISC OS 5 systems if you have Aemulor loaded (and that can be tweaked up to 52MB).
Miserable old curmudgeon who still likes a bit of an ARM wrestle now and then. Pi 4, 3, ARMX6, SA Risc PC, A540, A440
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

SKS1 wrote: Thu Jan 20, 2022 2:16 pm Every FPA instruction processed by the FPEmulator has gone through a hardware trap and software instruction decode in addition to then pretty much doing the same arithmetic as the soft float. It's about the slowest you could make it.

The 28MB WimpSlot limit only exists on RISC OS 5 systems if you have Aemulor loaded (and that can be tweaked up to 52MB).
That makes sense. I stopped Aemulor starting up on boot on my machine, there is still a limit but it's now 524256K. While a little extreme, my UnixLib build of Matrix Brandy can still sidestep this... (RPi 3B+, 1GB RAM):
920MB.png
I'm reminded of a thread a couple of years back on the RPi forum with an anagram challenge. It was so memory hungry (needed about 40MB) it wouldn't be able to run on a RiscPC with RISC OS 3.x on ARM BASIC. While I've not tried it it is theoretically possible it can run on Matrix Brandy on the same box (given enough physical RAM).
While it might seem ludicrously strange working on a BASIC implementation that is largely compatible with ARM BBC BASIC but much slower in almost all cases, there are a couple of advantages that I can see. This large memory model that seems only limited by what is actually available (I'd love to test on a 4 or 8GB RasPi4 but my bank account would look at me sideways), 64-bit integers, a network client that's only an OPENUP away, and being able to DIM numeric arrays and memory blocks outside of the BASIC workspace, giving a rather nice feature of being able to deallocate and free an array, and redimension it later.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
SKS1
Posts: 327
Joined: Sat Sep 19, 2020 12:04 am
Location: Highland Perthshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by SKS1 »

Nothing wrong with being a bit slower if you can usefully access more resources! Reminded me of Sophie's comment when we proposed doing BAS128 back in the day for the B+: "Suicide". But it worked.

I've seen RISC OS kernels built (and used, see https://www.riscosopen.org/forum/forums ... sts-123694) that raise the WimpSlot limit to 1.5GB.

I don't know off-hand what part of the address space has been reserved for Dynamic Areas these days - might vary between platforms? Suspect it's less than 2GB. There is at least one application that uses both the WimpSlot and multiple Dynamic Areas (you might not be able to allocate a huge one when stuff is already running) for data.

I'll have a look at the GCCSDK soft-float support and see how shoehorning some optional VFP-switch-at-runtime support would fit with that.
Miserable old curmudgeon who still likes a bit of an ARM wrestle now and then. Pi 4, 3, ARMX6, SA Risc PC, A540, A440
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.12 released

Post by Soruk »

SKS1 wrote: Thu Jan 20, 2022 3:42 pm I'll have a look at the GCCSDK soft-float support and see how shoehorning some optional VFP-switch-at-runtime support would fit with that.
Thank you - I am pretty sure I am not the only one who would welcome such an improvement.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

I have released version 1.22.13 of Matrix Brandy, with binary builds available for Windows (32 and 64 bit) and RISC OS (26-bit, 32 bit and ARMv6+VFP)

Changes include:
- System: Stricter handling of oversize variable and PROC/FN names.
- System: Improved handling of ESCAPE under RISC OS (notably, it no longer crashes the interpreter).
- System: Improve behaviour on Linux console framebuffer, particulary Raspberry Pi. Experience may vary across other hardware.
- System: Remove the old keyboard code, JGH's NEWKBD code is now the only version present.
- System: On non-RISC OS platforms, when using LOAD, CHAIN, OPENIN and OPENUP, if file isn't found, retry with a .bbc suffix before complaining. SAVE and OPENOUT will not use a .bbc suffix unless explicitly provided in the filename.
- System: Permit system memory to be up to 4194303K (4GB less 1K)
- System: Programs saved under RISC OS now get file type &FD1 (allocated by Acorn as BASIC stored as text). The file type is associated with Matrix Brandy for loading and running by double-clicking on the desktop.
- System: RISC OS: MODE in form xres,yres,depth was broken. Fixed.
- Graphics: Reworked line drawing, the earlier adaption of upstream was not right. This new version is based on PiTubeDirect's implementation.
- Graphics: Dot patterns, VDU23,6 and OSBYTE 163,242 now implemented
- Graphics: Fixed a crash bug due to SDL not being particularly thread-safe.
- BASIC: PRINT and STR$ now support displaying a decimal comma instead of a point.
- BASIC: PRINT and STR$ now show exponents in the style used by the BBC and RISC OS, rather than the C standard.
- BASIC: @% with precision 0 now uses &11 (except in fixed-precision mode), same as ARM BBC BASIC VI.
- BASIC: @% with width set to 0 now left-justifies, as per Acorn BASICs, RTR's assembly-language builds and (as of V0.40) BB4C.
- BASIC: @% precisions greater than &11xx are now capped at &11xx.
- BASIC: LVAR now includes @% in its output, displaying both in hex and its string form.
- BASIC: Extended TRACE with TRACE VDU [OFF], this redirects TRACE output to Brandy's controlling terminal, specifying OFF puts it back to normal.

Source and binary downloads (Windows, RISC OS) are available on the website, with source also available at GitHub.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by Soruk »

I've recently acquired a Raspberry Pi Pico with a view to getting Matrix Brandy running on it.

But, unless a newer version comes out with more RAM, this is not going to happen. Unfortunately the Matrix Brandy code is just too big to fit - and that's even when disabling inline help and using the most basic video driver (simpletext as used by the sbrandy linux build), and I don't want to start removing functionality.

A shame, it would have been a nice idea.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Matrix Brandy BASIC VI for console and SDL1.2: V1.22.13 released

Post by BigEd »

Ah, that's a shame - I didn't even think of space being a limitation! Glad you had a look into it though - hope you don't feel it was a waste of money...
Post Reply

Return to “modern implementations of classic programming languages”