WIDTH not working?

This doesn't seem plausible, so maybe I'm doing something silly, but superficially WIDTH is not working for me in Matrix Brandy (Windows):
10 WIDTH 64
20 PRINT STRING$(255, "x")
I expected this, but it isn't what I got:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>

Comments

  • It currently has no effect. I realised it when testing out stuff with your BBCZ80 release. It is on my to-do list.
  • Soruk
    edited June 23
    Update: it was trivially easy to implement in all implementations where POS works - that's all apart from the 'sbrandy' build. I've manually triggered the nighties build so they are now available as I type this.
  • Soruk wrote: »
    I've manually triggered the nighties build
    Nighties? Don't get me excited!

    Surely WIDTH must have worked in upstream Brandy? At least when running in RISC OS, otherwise loads of programs would have misbehaved. After all it's been in BBC BASIC from the very start.
  • No, it has never worked upstream in any build. Bizarrely, the RISC OS build needed the biggest change, as it used to send the entire string as a single SYS call. Now, it does individual OSWRCH calls where I can check POS after each character and insert a CR/LF. The other builds called emulate_vdu in a loop, so again after each character it checks POS and inserts a CR/LF as necessary. (And yes, that was a typo. Nightlies.)
  • Soruk wrote: »
    No, it has never worked upstream in any build.
    That's crazy, given how compatible with ARM BASIC (let alone 6502 BASIC) Brandy claimed to be.
  • There's a lot that doesn't work upstream, that I spent the past 6 years working on. It's now much more compatible than it ever used to be.
  • Soruk wrote: »
    There's a lot that doesn't work upstream, that I spent the past 6 years working on. It's now much more compatible than it ever used to be.
    Oh I know, but WIDTH is fundamental and has been in BBC BASIC from the very beginning.

    Indeed I would expect WIDTH to be one of the very first things to be implemented when writing a BBC BASIC interpreter (since it's associated with console output, without which a BASIC isn't much use!).

    When was COUNT added to Brandy, was that in upstream or is it one of your additions? Adding COUNT without WIDTH (or WIDTH without COUNT) doesn't make much sense to me.
  • COUNT works, and testing on a build of upstream it works there too.

    Regarding WIDTH, the docs used to say that it was ignored, indeed code was present to set and retrieve the value, but nothing actually used it. It does now :smile:
  • Hated_moron
    edited June 24
    Soruk wrote: »
    COUNT works, and testing on a build of upstream it works there too.
    That's what I thought. Oh well, I suppose why COUNT was implemented upstream and WIDTH wasn't, given how closely related they are, will forever remain a mystery.

    Incidentally (although I expect you will consider this a low priority) Brandy seems to get confused when PRINTing a 'multi-line' string, i.e. one containing one or more embedded CRs, affecting the behaviour of TAB.

    This example should print the exclamation point in the same line as "over the lazy dog", as shown in the screenshot from BeebEm, but Brandy prints it one line below (I've not tried it with the latest 'nightie', so if you've recently fixed it ignore this report):
       10 MODE 7
       20 q$ = "The quick brown fox jumps"
       30 q$ = q$ + CHR$(10) + CHR$(13)
       40 q$ = q$ + "over the lazy dog..."
       50 PRINT q$ TAB(24) "!"
    

    qzjf4y6foufs.png

  • Another one for the to-do list - the upstream docs certainly says PRINT does leave a bit to be desired. It is better than it used to be....
  • This is now resolved - the nightly build has been rebuilt.