Hardware of the Q68 and programming examples

Nagging hardware related question? Post here!
Post Reply
User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Hardware of the Q68 and programming examples

Post by Zarchos »

Hi all.

I have a series of questions about the Q68, so I thought it could be a good idea to put them under this thread.
Let's go !

1/ Q68 uses an FPGA.
What is necessary to reprogram it ?
I am asking that for various reasons, in particular implementing 8 bit per pixel screen modes, like 384 x 288 (overscan) or 768 x 288 (full pal, maximum a TV can take).
Also to add a few hardware registers maybe not available in what I describe hereafter.

2/ Bank switching / video DMA ?
How is bank switching achieved (in ASM, directly accessing the hardware please, not with OS call).
I ask that to be able to get vertical hardware scrolling (great for a game like Battle Squadron).
What is the maximal precision of DMA video in bytes ?
Having a whole line is good (and necessary to get hardware vertical scrolling) but the less we can get, the more opportunities it offers.

3/ Is it possible to get all addresses of hardware registers for the definition of screen modes and all DMAs ?
That will determine what we can do, hardware accelerated.

4/ There is a 25 ns high speed timer.
That is a really great feature.
How to program it ?
Is it a countdown model, where you write a value in a specific memory location, and it decreases to 0 at the frequency of 40 Mhz once you have issued a 'Go !' command ; and then intereupts the CPU to execute some code, including yours ?
Is it ultra precise (or the code to execute linked to it will execute only after the current opcode execution is complete.
Does it make the CPU enter privileged/supervisor mode or fast privileged/supervisor if it exists on the MC68000. It does on the ARM : IRQ mode vs FIQ mode ).
Having this very precise and the existence of 2/ opens the possibility of easy DMA video redirection on each scanline. (and thus effects à la Shadow Of The Beast for example, where layers of graphics are moved by DMA video redirection on each scanline, using the hardware resources, and not the CPU's).
In 50 Hz TV mode where a frame has 288 lines, to get the equivalent of an h-sync with a timer, you need it to have at least a granularity of 1/50/288=6,944.10 -5 s and here we have a granularity of 25.10-9 so it is perfect.
Is the memory address the 25 ns timer can jump to selectable ? (or is that a fixed location, where a handler will deal with a list of routines to call ?)
If yes and the code to execute can lay in the area of memory at very high speed, it means there could be enough time to reprogram the DMA video while there is flyback from the extreme right of the screen, to extreme left of the screen, to keep on drawing the current bank of memory selected as the screen to display.

Of course having a toggable on/off hardware h sync interrupt would be the best solution (no need of using the 40 Mhz timer), hence my question about reprogramming the FPGA to slightly amend the VHDL code implemented in the Q68.

Disclaimer : as I know forums can tend to be read various ways, in no way I am judging negatively the work done by the author of the Q68. I'd be happy if I could be able to do even as low as 5% of what he managed to achieve.
I 'simply' consider there could be not much to add / modify to the VHDL code to have the Q68 more games oriented, and nothing more. Believe me, as an Archie coder, I know very well what the lack of a few so easy to implement hardware features change negatively a lot of things, for games or demos ;-(


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Hardware of the Q68 and programming examples

Post by Peter »

Zarchos wrote:1/ Q68 uses an FPGA.
What is necessary to reprogram it ?
A Lattice JTAG adaptor is required.
The FPGA is not meant to be reprogrammed by the user.
Zarchos wrote:2/ Bank switching / video DMA ?
How is bank switching achieved (in ASM, directly accessing the hardware please, not with OS call).
There is no bank switching, at least not in the way you probably mean it.
Zarchos wrote:What is the maximal precision of DMA video in bytes ?
SDRAM burst access by the video controller is done in portions of 1024 bytes. But I'm not going to add new hardware features to the video controller anytime soon.
Zarchos wrote:3/ Is it possible to get all addresses of hardware registers for the definition of screen modes and all DMAs ?
Already answered.
Zarchos wrote:4/ There is a 25 ns high speed timer.
That is a really great feature.
How to program it ?
It is read-only. Please read the manual.
Zarchos wrote:I 'simply' consider there could be not much to add / modify to the VHDL code to have the Q68 more games oriented, and nothing more.
There are many things that could be added or improved on other areas as well. But for a long while, the hardware will remain as it is.

I think that a machine about 20 times faster than a QL should offer enough hardware speed to write an arcade game similar to the old ones, just with highcolour.
The issue is not lack of QL video acceleration, but lack of QL software developers.


User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Hardware of the Q68 and programming examples

Post by Zarchos »

Okay !
Understood.
There will be much possible, I have no doubt about it.
Understand that, of course, before starting programming on it, it is important to have more hardware, in-depth, knowledge.
It would be a pity, not to use it from day one, if it is available.

Thanks again for your time, and sorry for all these questions which were time wasting.
Xavier.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Hardware of the Q68 and programming examples

Post by Peter »

No problem! Sorry that video accelleration is not on my work list at the moment.

There is no additional knowlegde. Start of screen area, layout, and how to switch modes is documented. You can directly access the screen, if you like.

The register for the video modes is like on Q40/Q60, mirrored at $1C018. No advantage over using the DISP_MODE command. Even the mode numbers are exactly the same.


User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Hardware of the Q68 and programming examples

Post by Zarchos »

Peter wrote:No problem! Sorry that video accelleration is not on my work list at the moment.

There is no additional knowlegde. Start of screen area, layout, and how to switch modes is documented. You can directly access the screen, if you like.

I could document the register address for the video modes, but don't see an andavntage over useing DISP_MODE. Even the mode number is the same.
Sorry if it is again one of my time wasting comments because this is not possible, but well, in case it is :
- accessing directly the hardware can help save some precious CPU cycles and have mode change fast enough, using your 40 Mhz timer, to get that with a scanline precision.
I agree with 40 Mhz it should not be an issue (unless DISP_MODE is slow because it does a lot of unnecessary things for a game or a demo), but who knows, just in case : the fastest the switching can be made, always the best it is ;-)

There are numerous reasons to want that, in particular to display HUD in another screen mode, to have more colours (less to save bandwith) , or with / and a higher screen resolution.(less to save bandwith).

Very annoying Xavier with all his queries :mrgreen: oh yeah I know, I'm well known for that :?


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Hardware of the Q68 and programming examples

Post by Peter »

Zarchos wrote:- accessing directly the hardware can help save some precious CPU cycles and have mode change fast enough, using your 40 Mhz timer, to get that with a scanline precision.
Sorry, I was not aware you want to switch video modes in realtime while the picture is built. Sounds crazy, but might actually work somehow, because the Q68 keeps creating 1024x768. I have doubts about the benefit.


User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Hardware of the Q68 and programming examples

Post by Zarchos »

Peter wrote:
Zarchos wrote:- accessing directly the hardware can help save some precious CPU cycles and have mode change fast enough, using your 40 Mhz timer, to get that with a scanline precision.
Sorry, I was not aware you want to switch video modes in realtime while the picture is built. Sounds crazy, but might actually work somehow, because the Q68 keeps creating 1024x768. I have doubts about the benefit.
This is what games / demos programmers did on other platforms, for various good reasons. :mrgreen:


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Hardware of the Q68 and programming examples

Post by Peter »

I'd be more interested in this, if there first was an actual game, and the optimization done later. ;)


User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Hardware of the Q68 and programming examples

Post by Zarchos »

Peter wrote:I'd be more interested in this, if there first was an actual game, and the optimization done later. ;)
Ideal candidate, to me, is Pacmania.
Simple and addictive.
Understanding the code shouldn't be too difficult, and porting it to the Q68 could be, again, a great community project.
You know which source I'll use, I won't repeat again :mrgreen:
Using a ressourcer and adding some comments is what I am going to do this year's end.
It is 100% done by software programming, this is why I believe its doability on the Q68 makes it a perfect game to port.

If you are interested by how games can make full use of hardware acceleration, there is this well made web site :
http://codetapper.com/

See Pacmania on the Amiga : http://codetapper.com/amiga/sprite-tricks/pac-mania/
Impossible to do it this way on the Q68.
The only possibility is the Atari ST / Archie way.
Listen to its author, Shaun Hollingworth : https://youtu.be/hU23fEL154k?t=3m03s


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Hardware of the Q68 and programming examples

Post by Peter »

Zarchos wrote:
Peter wrote:I'd be more interested in this, if there first was an actual game, and the optimization done later. ;)
Ideal candidate, to me, is Pacmania.
Simple and addictive.
Understanding the code shouldn't be too difficult, and porting it to the Q68 could be, again, a great community project.
If there is even one single developer, that would already be a nice surprise.
To be straightforward, at the moment I see only yourself, Zarchos, who could do it. ;)


Post Reply