Daydreaming: a real VGA display card for the Atom

discussion of games, software, hardware & emulators relating to the Acorn Atom
User avatar
roland
Posts: 2778
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Daydreaming: a real VGA display card for the Atom

Postby roland » Sat May 28, 2016 9:27 pm

So here we are with our brand new, shiny Atoms. We have mass storage, fast CPU's, great audio, serial I/O, lots of memory and even a bunch of co-pro's on a single board. We have great operating systems and programming languages in our tool box. But oh dear, those graphics.....

So I was day dreaming with Misty about connecting a VGA card to my Atom.
IMG_0924.JPG

A decent card from BITD can display 1024 x 768 pixels in 256 colours. Wouldn't it be great to run BBC Basic programs with that real resolution? But how on earth can I address 1MB of video ram in an Atom?

A PC also uses bank switching techniques for accessing such an amount of video ram. But that are banks of 64kB which is still the complete memory size of our 6502. So we have to split these 64kB banks in smaller chunks, 1 kB, 512 bytes, 256 bytes, 1 byte? That can be an option: write a video memory address into two latches and then write your data. Make an auto-increment of the address latches and then the Atom can write (or read) a block of bytes into the VGA video memory. There can be some tricks implemented to not increment the address after a write or read. It's possible but a lot of work because all the VGA driver software has to be written. I don't think this is the easiest way to achieve my goal.

While talking to Misty - she seemed not understand what I was talking about, nor did I - I came up with the idea to connect the VGA card not directly to the Atom but place a 80286 processor between them. Make the Atom talk to the 80286 and tell it to print a character, plot a line or a circle. 80286 are quite easy to get and there are a few other advantages:

  • We have a 16 bit I/O interface to the VGA card (8 bit cards are hard to find)
  • We can use the VGA BIOS for many operations
  • There is already a bunch of software for the Atom to give graphics commands to the 80286 (my Atom-in-PC project)
  • The 6502 doesn't have to spend any time at drawing pixels, parallel processing in optima forma

The only thing to be written is a simple BIOS program that initializes the VGA card and starts communicating with the Atom.

I don't know if things are as easy as they seem in my day dreams. Lots of investments have to be done. But I have real good documentation.
Schermafbeelding 2016-05-28 om 23.12.18.png

What do you think, is it worth to give it a try or do you say "Keep on dreaming, Roland...." ?


Edit: note to myself: this could be a starting point: http://www.intel-assembler.it/portale/5 ... source.asp
256K + 6502 Inside
MAN WOMAN :shock:

janrinze
Posts: 51
Joined: Sat Mar 19, 2016 6:38 am

Re: Daydreaming: a real VGA display card for the Atom

Postby janrinze » Sun May 29, 2016 6:28 pm

There are versions of the GODIL with more memory. They should be able to do 1024x768 in one or 2 bit colour.
That would mean to have many banks for #8000-#9FFF.

1024x768 = 768KB for 8 bit colour.
96KB for 1 bit B/W and 192KB for 2 bit colour.

96KB would match the ATOM strategy, max res in B/W and double sized pixels for 2bpp.
Also 512x384 in 4bpp would give it some decent quality graphics. It's still a 6502 machine.
Technically running a 6502 emulator on a PC would allow development of the software while no hardware exists yet.
The use of a GODIL with more memory would allow for a drop-in replacement without much hassle.

Graphics cards these days are PCI-e which is a huge step from directly connected, memory mapped video.

I'm very pleased with your 2015 ATOM motherboard and still hope to see it run on 14MHz in the near future.

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Sun May 29, 2016 8:08 pm

The largest GODIL I'm aware of is based on the XC3S500E which has only 40KB of block RAM. :(

Dave

janrinze
Posts: 51
Joined: Sat Mar 19, 2016 6:38 am

Re: Daydreaming: a real VGA display card for the Atom

Postby janrinze » Mon May 30, 2016 6:33 am

misread the pdf.. Kb instead of KB..

640x480 in B/W is doable then.

ThomasHarte
Posts: 327
Joined: Sat Dec 23, 2000 5:56 pm

Re: Daydreaming: a real VGA display card for the Atom

Postby ThomasHarte » Wed Jun 01, 2016 5:53 pm

If you were still aiming at 1024x768, wouldn't the next step up of 1280x1024 be most appropriate for BBC BASIC, being the virtual screen resolution? It's more pixels than a NeXT but I'm fairly sure the ISA-bus SVGA card that came on my very first PC (an Oak OTI something; my memory fails me) could handle it at 16 colours. The pixel aspect ratio would probably end up a little off but that's not new for Acorn: it's actually about 11:10 on an Electron.

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Wed Jun 01, 2016 6:30 pm

I've had an idea :D

One of the issues with a XGA or SXGA resolution display is just how long it will take the Atom to write to a 1MB+ frame buffer.

So the answer is we need some kind of a GPU (of some kind).

Now, I can thing of a few possible hardware platforms for this.

Plan A (my favorite) would be to use Raspberry Pi Zero, for several reasons:
- it's cheap (£4) if you can get hold of one (they are becoming more available)
- it's small, so can be made to fit in an Atom case
- it has an HDMI port, so will drive a modern monitor
- it has loads of memory and a variety of display modes
- it has a GPU built in
- it's possible to program it "bare metal" (in C) which is a huge amount of fun (and it will boot in < 1s)

So, how would it interface to the Atom? I can think of two possible ways:
- as an SPI slave (using a 6522 in the Atom as an SPI master)
- as a memory mapped peripheral - an FIQ interrupt handler in the Pi Zero can run with low enough latency to interface to a 2MHz 6502

I was thinking the interface to this could be as simple as the BBC VDU protocol.

Plan B would be to use an FPGA with fast external SRAM as a frame buffer, and try to find an open source GPU (I think there are a couple). As food for thought, take a look at this thread over on 6502.org:
http://forum.6502.org/viewtopic.php?f=4&t=3329
Brad has built an amazing GPU/Frame buffer out of TTL. Something like this could (easily?) be implemented in an FPGA.

Dave

User avatar
roland
Posts: 2778
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby roland » Wed Jun 01, 2016 6:49 pm

Basically you're doing the same with the Raspberry Pi Zero what I intended with the 80286. The Atom simply gives commands and the Pi executes them. If it's possible to use the VIA for interfacing then we have a nice solution that almost everybody can afford =P~
Nice idea =D>
256K + 6502 Inside
MAN WOMAN :shock:

ThomasHarte
Posts: 327
Joined: Sat Dec 23, 2000 5:56 pm

Re: Daydreaming: a real VGA display card for the Atom

Postby ThomasHarte » Wed Jun 01, 2016 7:45 pm

I feel like the conversation is edging towards the Pi being the Pi, doing all user-facing things, and the Atom being the equivalent of a tube processor?

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Sat Jun 11, 2016 3:49 pm

roland wrote:Basically you're doing the same with the Raspberry Pi Zero what I intended with the 80286. The Atom simply gives commands and the Pi executes them. If it's possible to use the VIA for interfacing then we have a nice solution that almost everybody can afford =P~
Nice idea =D>

At Halifax the daydream is starting to become reality.

I've got a Raspberry Pi Zero connected to the Atom Tube via a pair of 74LVC245A level shifters.

On the Pi, I'm using the PiTubeDirect bare-metal firmware.

(The emulated second 6502 processor work well with Atom Tube)

This has been extended with:
- a bit of extra code that initializes a 640x480 frame buffer with 64K colours.
- an additional "tube" register at BEE4 (normally unused on the tube) that will be used as a VDU FIFO between the Atom and the Pi
- a small C code VDU driver that can write characters into the frame buffer (using the 6847 character font)

For testing on the Atom, the OS is has a small patch to the printer driver:

Code: Select all

FF10: STA #BEE4
FF13: RTS


So far the additional Pi code is very simple:
https://github.com/hoglet67/PiTubeDirec ... 859d2aa53d

The results so far are quite promising:
IMG_0457.JPG

IMG_0459.JPG

IMG_0460.JPG


The next thing I will do is to extend the VDU driver to implement some graphics plot commands, and probably text/graphics colours.

Dave

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby oss003 » Sat Jun 11, 2016 5:32 pm

Nice job Dave, does the RPi emulate a coprocessor and a VGA card at the same time?

Greetings
Kees

User avatar
roland
Posts: 2778
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby roland » Sat Jun 11, 2016 5:40 pm

Hi Dave,

This is good news =D> I was already searching for information about this project and I came across this page http://raspberrycompote.blogspot.nl/201 ... _9509.html for implementing graphics. Maybe you can use it also for the graphics part.

I assume this will also work on a normal Raspberry Pi, won't it? The Zero is hard to get at this moment :(
256K + 6502 Inside
MAN WOMAN :shock:

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Sat Jun 11, 2016 5:44 pm

oss003 wrote:Nice job Dave, does the RPi emulate a coprocessor and a VGA card at the same time?

Yes, it does.

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Sat Jun 11, 2016 5:46 pm

roland wrote:This is good news =D> I was already searching for information about this project and I came across this page http://raspberrycompote.blogspot.nl/201 ... _9509.html for implementing graphics. Maybe you can use it also for the graphics part.

What we need next is some C code for drawing lines, circles and triangles to a frame buffer.

Any ideas?
roland wrote:I assume this will also work on a normal Raspberry Pi, won't it? The Zero is hard to get at this moment :(

Yes, should work on a Pi One, or a Pi 3 would be best for the bigger Co Pros.

Dave

User avatar
roland
Posts: 2778
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby roland » Sat Jun 11, 2016 6:00 pm

hoglet wrote:What we need next is some C code for drawing lines, circles and triangles to a frame buffer.
Any ideas?


Drawing frame buffer shapes: http://raspberrycompote.blogspot.nl/201 ... ry-pi.html

One more question ... did you connect the Pi to the Tube interface? Pictures please [-o<
256K + 6502 Inside
MAN WOMAN :shock:

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Sat Jun 11, 2016 6:01 pm

roland wrote:One more question ... did you connect the Pi to the Tube interface?

Yes.

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Mon Jun 13, 2016 3:38 pm

Hi Guys,

I'm after a bit of advice....

I'm trying to think of the best way to patch the Raspberry Pi based HDMI display adapter into the Atom's OS.

Currently there is a one directional interface between the Atom and the Pi, which on the Atom side appears as a single memory location (#BEE4) that you can write characters and control codes to.

At Halifax, all I was doing was patching the "Send Character to 6522" part of OSWRCH with:

Code: Select all

FEFB STA #BEE4
FEFE RTS

To better imagine this patch in context, there is a Atom OS disassembly here:
http://www.acornatom.nl/atom_handleidin ... m/f000.txt

Now this works after a fashion, but it's very simplistic, and there are a few big problems.

1. On the Atom the cursor keys are implemented by OSRDCH, and this does not call OSWRCH to move the cursor. So moving the cursor doesn't work.

2. Because the interface is currently one directional, I can't see how copy will work properly, unless it's implemented entirely on the atom side

3. There is no flow control on the interface, so characters can be dropped.

I was wondering whether to try to extend the driver the VGA80 code that is now in FPGAUtils. I thought that maybe I could rework the OSRDCH bit to call OSWRCH to move the cursor about, and then extend OSWRCH to also write to BEE4.

Also, it happens that the character resolution of the Pi at 640x480 is 80x40, which coincidentally matches what the VGA80 code was written for. So it's possible that COPY would just work, if the memory on the Atom side is kept "in sync" with the Pi display, which it kind-of is:
IMG_0461.JPG

IMG_0462.JPG

But this seems a bit of a poor design, and that really it would be better to have two-way communication with the display adapter, and implement a "Read_Character_At_Text_Cursor" protocol.

You can see the latest Pi VDU driver code here:
https://github.com/hoglet67/PiTubeDirec ... fer.c#L360

Anyone got any thoughts, ideas or advice here?

Dave

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Mon Jun 13, 2016 3:55 pm

I've also found a few examples of using the Pi's VideoCore IV GPU directly from Bare Metal code.

For example, this render's a triangle:
https://github.com/phire/hackdriver/blo ... st.cpp#L87

I'm very tempted to try to get this working, as it would be blindingly fast compared to what I'm doing at the moment.

Dave

User avatar
jgharston
Posts: 2658
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: Daydreaming: a real VGA display card for the Atom

Postby jgharston » Mon Jun 13, 2016 5:30 pm

You need to implement something approaching a very cut-down Tube I/O protocol, sending over an 8-bit data port with 2 handshaking lines, like with an ACIA, or a printer port, or the Tube ports:

.send
BIT base+0:BVC send:STA base+1 :\ Send a byte of data
....
.wait
BIT base+0:BPL wait:LDA base+1 :\ Fetch a byte of data

You could cut it down to a single 8-bit port and use one nybble for data and the other nubble for handshaking, and chop the data bytes into nybbles, something like:

.send1
BIT port:BVC send1
PHA
AND #15:STA port :\ Send bottom nybble
PLA:PHA
LSR A:LSR A:LSR A:LSR A
.send2
BIT port:BVC send2
ORA #&10:STA port :\ Send top nybble
PLA:RTS

Once the data layer is decided, you could implement an equivalanet to the Serial Tube protocol which interleaves character data with escaped commands over a single port, or a equivalent to a non-file-transfer Parallel Tube protocol which dedicates one port to VDU data and one port to commands and responses.

.vdu_busy
BIT base+0:BVC vdu_busy:STA base+1 :\ Send character to other end
...
.cmd_send
BIT base+2:BVC cmd_send:STA base+3 :\ Send command to other end
...
.cmd_reply
BIT base+2:BPL cmd_reply:LDA base+3 :\ Fetch a command response

Then 'VDU' would be:
JSR vdu

and (for example) 'ReadCharAtCursor' would be
LDA #rdchar:JSR cmd_send:JSR cmd_reply

You could implement a full OSWORD/OSBYTE command response on the graphics system so you can request 'Graphics cursor position', 'Pallette Entries', etc. by sending and receiving an OSWORD 9/10/11/12/13 and all the VDU OSBYTE calls, ScreenSize, Cursor Position, CharAtCursor, ReadVDUVar.

Or you could do something more cut down if you want to cut down the transaction speed. All the VDU OSWORDS are <&80 and all the VDU OSBYTEs are >&7F so you could have the commands be a two-byte sequence cmd,num with cmd<&80 being the OSWORD command number, and cmd>&7F being the OSBYTE number, and the OSWORD calls all send and return 8 bytes of data, and the OSBYTE calls all returning two bytes of data. Eg

LDA #&85:JSR cmd:LDA #0:JSR cmd:\ Request char at cursor
JSR reply:TAX:JSR reply:TAY :\ X=character, Y=screen mode

LDA #&A0:JSR cmd:LDA #10:JSR cmd:\ Request VDU variable 10 - window RHS/BOT
JSR reply:TAX:JSR reply:TAY :\ X=window width, Y=window height

LDA #&09:JSR cmd:\ Request POINT()
... send POINT() parameter block
... JSR reply read POINT() reply

LDA #&0A:JSR cmd:\ Request CHARDEF()
... send CHARDEF() parameter block
... JSR reply read CHARDEF() reply


A single 8-bit port using nybble transfer is the minimal hardware, but the largest transfer overhead.
A single 8-bit port with 2 handshaking lines is the next nearest mininal hardware. The VDU throughput is almost the fastest only with an occasional delay for escaping escape characters.
Two 8-bit ports plus 2 sets of 2 handshaking lines is the fastest throughput as the VDU stream doesn't have to escape any escape characters.

Easiest hardware is inverse of fastest and easiest-to-program throughput.

The advantage of 1xport+hand and 2xport+hand is that code to support it already exists in the Serial Tube and the Parallel Tube (ie, the 'normal' Tube).

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
oss003
Posts: 2516
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby oss003 » Mon Jun 13, 2016 6:14 pm

I noticed that the tube interface uses 15 signals so there is one left ..... :)
Can you use this one for communication?

Greetings
Kees

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Mon Jun 13, 2016 7:47 pm

jgharston wrote:Two 8-bit ports plus 2 sets of 2 handshaking lines is the fastest throughput as the VDU stream doesn't have to escape any escape characters.

Thanks Jonathan, I'm very much leaning towards this option.

The whole of the Tube ULA is emulated in software on the Pi, so adding two more 8 bit ports, plus status bytes, is just a few extra lines of C code. The only hardware impact is the need to wire up A3 to the Pi, because there isn't enough space in the current 8-byte block of tube register for these additions.

There are a couple ways to get an additional GPIO pin for A3:
- Only support Pi's with the 40 pin GPIO headers, then we get an extra 9 GPIOs
- Sacrifice the UART Rx function and use this for A3

I'm not now so confident that the display adapter and second processor are going to co-exist well on the single core Pi Zero. The problem is that certain VDU commands (e.g. scrolling) take a long time, and this can cause "overruns" of the software tube emulation. An overrun is where the the host makes a second access to a tube FIFO before the tube emulation code has been able to process the first access. At the moment, the tube emulation code is run in between every emulated instruction, i.e. sufficiently frequently to avoid these overruns.

On a Pi 2 or Pi 3 there are four cores, so the ISR, tube emulation, second processor emulation and display adapter could be spread across the different cores, which should solve the overrun problem.

Dave

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Mon Jun 13, 2016 7:48 pm

oss003 wrote:I noticed that the tube interface uses 15 signals so there is one left ..... :)
Can you use this one for communication?

I think finding one extra GPIO signal and using it for A3 is the best way forward (then adding extra ports as Jonathan has outlined above)

Unfortunately, that means adding a wire to the Atom Tube Interface board, as A3..A7 are not currently connected.

I am thinking of eventually designing a second version of the Tube Interface board to connect to a Pi, that would include the level shifter chips.

Dave

User avatar
roland
Posts: 2778
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby roland » Mon Jun 13, 2016 9:07 pm

If you leave out the tube stuff on the pi and just do the video ... Aren't the two ports of the via enough? That would make it a real simple interface for every Atom. Just a thought....
256K + 6502 Inside
MAN WOMAN :shock:

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Mon Jun 13, 2016 9:21 pm

roland wrote:If you leave out the tube stuff on the pi and just do the video ... Aren't the two ports of the via enough? That would make it a real simple interface for every Atom. Just a thought....

That's a good idea.

It seems two configurations make sense:
- a Pi Zero running just a display adapter
- a Pi 3 running a display adapter and emulating a 6502/Z80/80x86/ARM2/32016 Co Pro with one added wire to the tube interface (A3)

In both cases, level shifters are needed between the Atom Tube interface and the Pi. I have those on a breadboard at the moment.

Dave

User avatar
jgharston
Posts: 2658
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: Daydreaming: a real VGA display card for the Atom

Postby jgharston » Mon Jun 13, 2016 9:35 pm

hoglet wrote:It seems two configurations make sense:
- a Pi Zero running just a display adapter
- a Pi 3 running a display adapter and emulating a 6502/Z80/80x86/ARM2/32016 Co Pro with one added wire to the tube interface (A3)

Looks like a sensible choice. (wot, not PDP11?)

I've tidied up the Wiki page on physical colour numbers for platforms without a palatte, so you can ensure consistancy with other platforms. When I've woken up a bit more I'll update the pages on paletted colour selection.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby BigEd » Tue Jun 14, 2016 1:09 am

hoglet wrote:I'm not now so confident that the display adapter and second processor are going to co-exist well on the single core Pi Zero. The problem is that certain VDU commands (e.g. scrolling) take a long time, and this can cause "overruns" of the software tube emulation. An overrun is where the the host makes a second access to a tube FIFO before the tube emulation code has been able to process the first access. At the moment, the tube emulation code is run in between every emulated instruction, i.e. sufficiently frequently to avoid these overruns.

As a possible future refinement, to bring the Pi Zero back into play, would it be possible (not too horrendous) to break up the scroll task and perform it piecewise (as if it were a series of interruptable instructions)?

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Tue Jun 14, 2016 6:46 am

Hi Jonathan,
jgharston wrote:
hoglet wrote:It seems two configurations make sense:
- a Pi Zero running just a display adapter
- a Pi 3 running a display adapter and emulating a 6502/Z80/80x86/ARM2/32016 Co Pro with one added wire to the tube interface (A3)

Looks like a sensible choice. (wot, not PDP11?)

Those are just the Co Processors currently implemented.

If there exists a vanilla C code emulator for the PDP-11 it should be possible to add it.

There is a tutorial for adding additional Co Processors's here:
https://github.com/hoglet67/PiTubeDirec ... -Processor

jgharston wrote:I've tidied up the Wiki page on physical colour numbers for platforms without a palatte, so you can ensure consistancy with other platforms. When I've woken up a bit more I'll update the pages on paletted colour selection.

Thanks, I'll take a look.

Dave

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Tue Jun 14, 2016 6:58 am

BigEd wrote:
hoglet wrote:I'm not now so confident that the display adapter and second processor are going to co-exist well on the single core Pi Zero. The problem is that certain VDU commands (e.g. scrolling) take a long time, and this can cause "overruns" of the software tube emulation. An overrun is where the the host makes a second access to a tube FIFO before the tube emulation code has been able to process the first access. At the moment, the tube emulation code is run in between every emulated instruction, i.e. sufficiently frequently to avoid these overruns.

As a possible future refinement, to bring the Pi Zero back into play, would it be possible (not too horrendous) to break up the scroll task and perform it piecewise (as if it were a series of interruptable instructions)?

Yes, that that would help, but it might not be sufficient.

The problem is, tube accesses can happen pretty quickly in succession (I think we observed 3us between successive status reads on the Beeb), and roughly 10us during data transfers.

We need to get some rough figures for the time to draw a character, draw a line, scroll (part) of the screen, etc.

I think it will be hard to ensure every drawing operation is broken into pieces that execute in < 10us.

Unless we are using the GPU :D

Dave

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby BigEd » Tue Jun 14, 2016 8:20 am

OK, that could escalate quickly. I can imagine we might get away with a bit less anxiety about overrun - implement a buffer of some sort - but it would be harder to know that the result acts just like a Tube.

Using the GPU, on the other hand... well, we know it's there and we even know there's a processor which can run general-purpose code...

(I can't resist: if we implemented the VDU calls as a program compiled to some suitably small primitives, the mainline code could emulate those VDU microops (if there were any pending), interleaved with or ahead of the 6502 instructions it usually works on... indeed if the VDU drivers were written in 6502 code then it's mere matter of emulating two 6502 cores... it's a host and parasite cohabiting inside the copro!)

User avatar
hoglet
Posts: 6359
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Daydreaming: a real VGA display card for the Atom

Postby hoglet » Tue Jun 14, 2016 8:31 am

BigEd wrote:(I can't resist: if we implemented the VDU calls as a program compiled to some suitably small primitives, the mainline code could emulate those VDU microops (if there were any pending), interleaved with or ahead of the 6502 instructions it usually works on... indeed if the VDU drivers were written in 6502 code then it's mere matter of emulating two 6502 cores... it's a host and parasite cohabiting inside the copro!)

That's actually a very interesting observation.

The Pi's 6502 Co Pro emulation is currently running at an equivalent speed of 140MHz.

So it should be possible to emulate two independent 6502s running at 70MHz each, which is still quite a decent speed.

Maybe we would even borrow the Beeb's VDU implementation?

Dave

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Daydreaming: a real VGA display card for the Atom

Postby BigEd » Tue Jun 14, 2016 10:10 am

Mmm, making use of code from the OS is tempting - but when it comes to setting and clearing pixels, there'll be a lot of work to do with the ordering of the addresses and the packing of colour values into bytes, so that lowest level would need a revisit. (I can't imagine the Pi can present a bit plane with bytes in the same order as the Beeb??)


Return to “acorn atom”

Who is online

Users browsing this forum: No registered users and 2 guests