MO5 raster position checking

Tout ce qui concerne le logiciel original et sa sauvegarde avec entre autre la régénération des disquettes ou autres supports physiques.

Modérateurs : Papy.G, fneck, Carl

Iapetus
Messages : 155
Inscription : 22 nov. 2012 15:36

MO5 raster position checking

Message par Iapetus »

Back to MO5 coding.

I have my sprite engine virtually finished

How can I check for example if the raster is on line 168 on a MO5?

I have been using bit 7 of $A7E7 to check when the computer starts to paint the horizontal borders and it is there that I call my routine to paint 4 sprites. But saving the background, restoring it, masking data , and ORing sprite data takes a bit more than the borders(about 32 raster lines more) and thus I would like to know the answer to my question so I can call my sprite routine earlier. Of course sprites wont be painted on those 32 lines, but I can have my score board there.

Thanks
MO5 - MO6 - TO8D - C64C - Timex TC2048 - Acorn Electron - Amiga 500
Daniel
Messages : 17316
Inscription : 01 mai 2007 18:30
Localisation : Vaucluse
Contact :

Re: MO5 raster position checking

Message par Daniel »

This question was discussed many times by Thomson demo-makers. The only way they found is executing a precise number of processor cycles from the last VBL before painting the sprite. Every other way is too much time expensive.
Daniel
L'obstacle augmente mon ardeur.
Iapetus
Messages : 155
Inscription : 22 nov. 2012 15:36

Re: MO5 raster position checking

Message par Iapetus »

Daniel, thank you for your answer.
MO5 - MO6 - TO8D - C64C - Timex TC2048 - Acorn Electron - Amiga 500
Avatar de l’utilisateur
gilles
Messages : 2779
Inscription : 07 août 2008 13:44
Localisation : Nantes
Contact :

Re: MO5 raster position checking

Message par gilles »

I think you can use gate array register A7E4 (16bits) that is a screen clock used for optical pen...
Try this on real hardware since nearly no MO5 programs use this register (you may unassemble FIRQ routine to find a way to transform from this register to colums/lines)
Daniel
Messages : 17316
Inscription : 01 mai 2007 18:30
Localisation : Vaucluse
Contact :

Re: MO5 raster position checking

Message par Daniel »

I tried to read the $A7E4 byte with a MO5 Basic program :

Code : Tout sélectionner

10 PRINTPEEK(&HA7E4);:GOTO10
A real MO5 with ROM version 1.0 (without the gate array) returns all zeroes.
A real MO5 with ROM version 2.1 (the last version, with the gate array) returns all 255.
I'll try to investigate further with a binary program.
Daniel
L'obstacle augmente mon ardeur.
Avatar de l’utilisateur
gilles
Messages : 2779
Inscription : 07 août 2008 13:44
Localisation : Nantes
Contact :

Re: MO5 raster position checking

Message par gilles »

ok so it's not a counter but a latch. It cannot be used in that context, sorry.

To test in basic you can just add a call to INPEN and use optical pen (I don't remember exactly, INPUTPEN is a blocking read, I think INPEN is the non blocking read)
Daniel
Messages : 17316
Inscription : 01 mai 2007 18:30
Localisation : Vaucluse
Contact :

Re: MO5 raster position checking

Message par Daniel »

I tried this program :

Code : Tout sélectionner

10 INPENX,Y:PRINTX,Y,PEEK(&HA7E4):GOTO10
The $A7E4 value changes with the ligthpen position from 0 to 246 (may be 255, but I didn't succeed to get a value over 246).
$A7E4=0 for (X=0, Y=0)
$A7E4=246 for (X=319, Y=198)
Daniel
L'obstacle augmente mon ardeur.
Répondre