Drawing Lines on a CRTC Reduced Screen Width

bbc micro/electron/atom/risc os coding queries and routines
Post Reply
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

Hi all,
Not sure this has been addressed before (it was mentioned briefly in a Dev Session last year).

On a BBC, if I've reduced a Mode1 screen width with:
VDU23,0,1,64,0,0,0,0,0,0
VDU23,0,2,90,0,0,0,0,0,0

And then do:
MOVE 0,0: DRAW 1276,1020

You get this:
CRTC Draw.gif
I know there's the excellent Elite style line drawing code in other topics on here, just wondered if there are any other settings that can be applied to make OS line drawing compatible with a CRTC change ?

I'm guessing not, and that's it a hardware/OS 'incompatibility'.....

Many thanks
:D
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by tricky »

The same truck that makes text work on a B might work, but I don't know.
Kieranhj compared the line drawing methods on a reduced width screen, but I can't remember where.
KayBur
Posts: 13
Joined: Mon Apr 05, 2021 2:12 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by KayBur »

If you remember where there was a more detailed description, will you throw off the link? Very interesting to read.
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by tricky »

I can't find the link, but these should get you started:
https://github.com/simondotm/bbc-micro-3d
https://bitshifters.github.io/posts/arc ... eeb3d.html
Run 3D sample in jsbeeb
Options 1 and 2 are pre-assembled, the others take a little while to start.
RobC
Posts: 3155
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by RobC »

If you find the GLM8 disk on 8BS, there's an overscan demo that shows how to setup the OS parameters for screens with modified widths. This allows text to be printed correctly.

However, line drawing is going to be more complicated. It may be possible on a model B by additionally changing from the OS 640x multiplication table to a 512x table. The table used by the OS is pointed to by the location in &E0, &E1 on a B so you could get it to point to your own 512x table and see if that sorts out the line plotting.

I don't think this stuff works on a Master though - for one thing, I believe the 640x multiplication is code-based rather than table-based.
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

Thanks Tricky, those demos seemed to have passed me by, impressive stuff :D

And thanks RobC, I happened across E0 and E1 this morning while looking at a memory map, but didn't realise it's significance.
I'll have a little tinker.....

Cheers :D
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
RobC
Posts: 3155
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by RobC »

I did a little playing using the overscan demo and the E0,E1 table idea and the following does allow line drawing to work (at least on a model B):

Code: Select all

   10 MODE 1
   20 DIM table 64
   30 FOR I=0 TO 31
   40 V=I*512:table?(2*I)=V DIV 256:table?((2*I)+1)=V MOD 256
   50 NEXT I
   60 ?&E0=table MOD 256
   70 ?&E1=table DIV 256
   80 VDU23,0,1,64,0,0,0,0,0,0
   90 VDU23,0,2,90,0,0,0,0,0,0
  100 ?&352=0
  110 ?&353=2
  120 ?&309=16384 DIV 511
  130 ?&30A=512 DIV 15
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

Marvellous Rob, many thanks for this :D =D>

I'm only concentrating on Model B stuff, so it's fine.

I posted a little series on Twitter (@Snuggsy187) about previous software projects and why I put them on hold / abandoned them. This seriously helps with solving Number 5 - Atic Atac ! :D Although Kelvin will be telling me off - 'Finish Pooyan First !'

Generally not being one to multitask, I'll go with Pooyan first...... honest...... :D

Thanks again.
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
RobC
Posts: 3155
Joined: Sat Sep 01, 2007 10:41 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by RobC »

Some really great stuff there - I'll like the look of the Snuggsy's all at sea game.

I'm terrible at finishing things. I found an early version of my Ant Attack conversion the other day but don't know what I've done with the later code :oops:
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

Thanks for that :D

Yes, I like Snuggsy's all at Sea - totally bonkers, as was the development ! Got about 3 different versions - 2 birds dropping eggs, leaving mess you have to avoid. One version had the helicopter land on a hill, then it turns to a night level with a big blue Phoenix bird dropping stuff. Totally re-coded the boat data/compression 3 times as I developed things. That one's been going for years on and off (mainly off !) Had big problems with sprite print ordering - I know a bit more about that now, so in theory I can finish it one day......

As you can see, I'm terrible at finishing things too - struggle to keep stuff synchronised between 2 laptops and google drive ! There's 4 different versions of Atic Atac for example ! :shock: Really must start using GitHub !
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

Works a treat ! :D
Aa1.gif
Looks the same, but I've just gained 4K of memory (or something like that) :D =D>

I'm happy now, this can go on the shelf for a little while. It's Pooyan time !
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
User avatar
0xC0DE
Posts: 943
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by 0xC0DE »

Snuggsy187 wrote:
Wed Apr 07, 2021 10:13 pm
struggle to keep stuff synchronised between 2 laptops and google drive ! There's 4 different versions of Atic Atac for example ! :shock: Really must start using GitHub !
Keeping all my retro dev stuff on a USB stick (dev anywhere!) and using github saved me many times.
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
User avatar
0xC0DE
Posts: 943
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by 0xC0DE »

Snuggsy187 wrote:
Wed Apr 07, 2021 10:53 pm
I'm happy now, this can go on the shelf for a little while. It's Pooyan time !
Focus, man, focus :mrgreen:
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
User avatar
Snuggsy187
Posts: 199
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by Snuggsy187 »

:lol:
Keeping all my retro dev stuff on a USB stick (dev anywhere!) and using github saved me many times.
I tried a USB stick. If I left it for a few days I'd have no idea which laptop the latest data on it came from !! :?
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
User avatar
BeebMaster
Posts: 4076
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by BeebMaster »

One thing that occurs to me, although it probably wouldn't be very much practical use, is that in order to get certain screen drawing effects easily, you could just reprogramme the CRTC and then do a single move/draw, like shown in the first post. How much code would it take to replicate that pattern in a proper screen mode?
Image
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Drawing Lines on a CRTC Reduced Screen Width

Post by tricky »

This is sort of what I did for text in the sprite sample/library for BASIC that I wrote.
I provided a print tab that positioned the cursor in the expected place on the new layout.
It would be more work with lines, clipping for both screen sizes and breaking up per character row.
Post Reply

Return to “programming”