Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

discuss PC<>Acorn file transfer issues & the use of FDC, XFER, Omniflop/disk etc.
User avatar
Richard Russell
Posts: 936
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Richard Russell » Tue Oct 15, 2019 4:24 pm

dhg2 wrote:
Tue Oct 15, 2019 4:10 pm
I notice that if you try to draw text at the location of the graphics cursor (with VDU 5 and then PRINT), and if the current graphics colour is black, no text is drawn.
How very strange. Here's what BBC BASIC for SDL 2.0 produces:

blacktextwhitesurround.png

Soruk
Posts: 447
Joined: Mon Jul 09, 2018 10:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Soruk » Tue Oct 15, 2019 4:39 pm

dhg2 wrote:
Tue Oct 15, 2019 4:10 pm
Hello,
I notice that if you try to draw text at the location of the graphics cursor (with VDU 5 and then PRINT), and if the current graphics colour is black, no text is drawn.
Good spot. Yup, need to fix that.

Edit: The reason this is happening is, that it's building the character cell, blitting transparently, using 0 as transparent. If I try to use the top bit, the blit strips out the entire top byte, which breaks VDU19. I think I need to forego the character cell and pixel-twiddle directly on the screen memory.

Soruk
Posts: 447
Joined: Mon Jul 09, 2018 10:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Soruk » Wed Oct 16, 2019 9:33 am

dhg2 wrote:
Tue Oct 15, 2019 4:10 pm
Hello,
I notice that if you try to draw text at the location of the graphics cursor (with VDU 5 and then PRINT), and if the current graphics colour is black, no text is drawn.

Tested with this program:

Code: Select all

MODE 1
PROCtextdraw(100,100,"Matrix Brandy BBC BASIC")
END
DEF PROCtextdraw(x%,y%,s$)
LOCAL xx%,yy%
GCOL 0,3
VDU 5
FOR xx%=-1 TO 1
  MOVE x%+xx%*4,y%
  PRINT ;s$;
NEXT
FOR yy%=-1 TO 1
  MOVE x%,y%+yy%*4
  PRINT ;s$;
NEXT
GCOL 0,0
MOVE x%,y%
PRINT ;s$;
VDU 4
ENDPROC
This is now fixed - as I had surmised, I had to go to painting directly on the screen display, rather than using a transparent character cell and blitting it. This correctly preserves the top byte (ignored by SDL, but used as a disambiguator for VDU19 by holding the logical colour number).

User avatar
dhg2
Posts: 144
Joined: Tue Oct 25, 2016 7:37 pm
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by dhg2 » Wed Oct 16, 2019 12:17 pm

Thanks for looking into it.
Sorry to spam you, but, I notice now that there seems to be some trouble with stuff getting drawn outside of the graphics window.
Tested with this code:

Code: Select all

MODE 13
PROCgcol(0,0,0):RECTANGLE FILL 0,0,1280,1024
VDU 24, 100;100;400;400;
PROCgcol(0,0,128):RECTANGLE FILL 0,0,1280,1024
FOR I%=0 TO 64
  PROCgcol( RND(256)-1,RND(256)-1,RND(256)-1 )
  MOVE RND(1280),RND(1024):DRAW RND(1280),RND(1024)
  PROCtextdraw(RND(1280),RND(1024),"Wednesday")
NEXT
END
DEF PROCtextdraw(x%,y%,s$)
LOCAL xx%,yy%
VDU 5
FOR xx%=-1 TO 1
  MOVE x%+xx%*4,y%
  PRINT ;s$;
NEXT
FOR yy%=-1 TO 1
  MOVE x%,y%+yy%*4
  PRINT ;s$;
NEXT
PROCgcol( 0,0,0 )
MOVE x%,y%
PRINT ;s$;
VDU 4
ENDPROC

DEFPROCgcol(R%,G%,B%)
IF 0 THEN
  COLOUR 2, R%,G%,B%: GCOL 2
ELSE
  GCOL R%,G%,B%
ENDIF
ENDPROC
Results with BBCSDL, RPCemu, and Matrix Brandy:
2019-10-16-130719_960x768_scrot.png
2019-10-16-130813_640x512_scrot.png
2019-10-16-130924_640x512_scrot.png
Regards,
- Patrick

Soruk
Posts: 447
Joined: Mon Jul 09, 2018 10:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Soruk » Wed Oct 16, 2019 12:32 pm

dhg2 wrote:
Wed Oct 16, 2019 12:17 pm
Thanks for looking into it.
Sorry to spam you, but, I notice now that there seems to be some trouble with stuff getting drawn outside of the graphics window.
Tested with this code:

Code: Select all

MODE 13
PROCgcol(0,0,0):RECTANGLE FILL 0,0,1280,1024
VDU 24, 100;100;400;400;
PROCgcol(0,0,128):RECTANGLE FILL 0,0,1280,1024
FOR I%=0 TO 64
  PROCgcol( RND(256)-1,RND(256)-1,RND(256)-1 )
  MOVE RND(1280),RND(1024):DRAW RND(1280),RND(1024)
  PROCtextdraw(RND(1280),RND(1024),"Wednesday")
NEXT
END
DEF PROCtextdraw(x%,y%,s$)
LOCAL xx%,yy%
VDU 5
FOR xx%=-1 TO 1
  MOVE x%+xx%*4,y%
  PRINT ;s$;
NEXT
FOR yy%=-1 TO 1
  MOVE x%,y%+yy%*4
  PRINT ;s$;
NEXT
PROCgcol( 0,0,0 )
MOVE x%,y%
PRINT ;s$;
VDU 4
ENDPROC

DEFPROCgcol(R%,G%,B%)
IF 0 THEN
  COLOUR 2, R%,G%,B%: GCOL 2
ELSE
  GCOL R%,G%,B%
ENDIF
ENDPROC
Results with BBCSDL, RPCemu, and Matrix Brandy:
2019-10-16-130719_960x768_scrot.png
2019-10-16-130813_640x512_scrot.png
2019-10-16-130924_640x512_scrot.png
Argh.

The blitting honoured the graphics window. But now that I'm writing directly to the screen memory, that is no longer happening.

Edit: That should be sorted. Rather than poking the video memory, it's now using the plot_pixel graphics primitive to do this, which honours graphics clipping - and another omission from the previous code, it also honours GCOL action codes.

Edit 2: Filled rectangle now honours graphics window.
Last edited by Soruk on Wed Oct 16, 2019 1:23 pm, edited 1 time in total.

User avatar
Richard Russell
Posts: 936
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Richard Russell » Wed Oct 16, 2019 12:52 pm

dhg2 wrote:
Wed Oct 16, 2019 12:17 pm
Tested with this code:
If you want to make the choice of GCOL style automatic, Jonathan Harston's recommended test for 'my' BASICs is this:

Code: Select all

DEFPROCgcol(R%,G%,B%)
IF (INKEY-256 AND &D0)=&50 THEN
  COLOUR 2, R%,G%,B%: GCOL 2
ELSE
  GCOL R%,G%,B%
ENDIF
ENDPROC

Soruk
Posts: 447
Joined: Mon Jul 09, 2018 10:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Soruk » Wed Oct 16, 2019 6:40 pm

dhg2 wrote:
Wed Oct 16, 2019 12:17 pm
Sorry to spam you
Nope, not spamming me. Real bug reports like these, especially with a test harness, are most welcome.

Soruk
Posts: 447
Joined: Mon Jul 09, 2018 10:31 am
Location: Basingstoke, Hampshire
Contact:

Re: Matrix Brandy BASIC VI for Linux with SDL: V1.22.1 released

Post by Soruk » Tue Nov 12, 2019 11:47 am

Over on the BBC BASIC forum (here), I inadvertently uncovered a bug in GOTO parameter handling in Brandy (this code is untouched from the upstream source).

Initially, from quick testing (GOTO x% and getting Syntax error) I came to the erroneous conclusion that Brandy didn't support variables as a parameter to GOTO (and GOSUB) unlike the BBC Micro or RISC OS. Looking at the source, it had been programmed to insist any non-literal had to be enclosed in parentheses to function correctly, else it would bomb out with Syntax error.

I've adjusted the code to remove that catch-all, and instead if a literal wasn't identified, to handle it as an expression. Quite nicely, it still errors when you do something like GOTO 30-10 - exactly the same on Acorn BBC BASICs, yet it handles GOTO x% correctly now. Parentheses round an expression are still accepted (so this change won't break old code), but are still required for an expression involving more than a simple variable (looking into this one as the Acorn BASICs don't require parentheses unless the expression starts with a number) - FIXED.

Post Reply