Switching to and from HIRES mode in assembly?

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
Antiriad2097
Flying Officer
Posts: 158
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Switching to and from HIRES mode in assembly?

Post by Antiriad2097 »

I've started tinkering again, but can't find anywhere that tells me how to switch graphic modes in assembly using the OSDK.

I'm guessing its just a particular memory location I need to change the value of, but not sure.

Also, I'm further guessing there's possibly already a function in the OSDK that I can use, but the documentation doesn't give a clear description of each existing function and its usage.

Can anyone help? Once I get past this hurdle I think I understand enough to get useful results.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Switching to and from HIRES mode in assembly?

Post by Dbug »

It basically depends if you want to be "any oric" compatible, or if you are fine with your code working only on the Oric Atmos machines.

For the Atmos, it's easy:

Code: Select all

jsr _hires
If you want to be compatible with any machine, then you have to do it yourself by setting a GRAPHICS switch attribute in the screen: The next frame will be in HIRES.
You can test that very easily:

Code: Select all

POKE #BB80,30  ' GRAPHICS 50hz in the first TEXT byte.
Of course that would be too simple, if you do that you will see only half of the screen as HIRES because around midscreen the HIRES addresses matches the location of the redefined charsets, and some of these values contain values that are interpreted as switch to TEXT attributes.

That's the reason why when you use the HIRES command in basic, you see the screen temporarily show plenty of @@@@@@@@, it's the value 64 which is also the neutral HIRES value.
Antiriad2097
Flying Officer
Posts: 158
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Re: Switching to and from HIRES mode in assembly?

Post by Antiriad2097 »

Dbug wrote:if you do that you will see only half of the screen as HIRES because around midscreen the HIRES addresses matches the location of the redefined charsets, and some of these values contain values that are interpreted as switch to TEXT attributes.
If we know these values exist, can we switch to HIRES and clear the values to give us the full HIRES screen?

I'd like to work on either system, since I don't think what I want to do should hit any real problems with this. Its almost all just changing the hires screen which we know the address of, reading the keyboard and a little maths to manipulate some tables. A fairly simple concept as a test bed for me that might evolve into something fun if I can get my head around 6502 and the OSDK.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Switching to and from HIRES mode in assembly?

Post by Dbug »

If you don't mind losing the redefined characters (you can still reconfigure them later using your own font anyway), you can try that:
- Write 30 (HIRES attribute) to BFDF (last byte of the last text line, always visible in TEXT or HIRES)
- Set all the memory from A000 to BFDE to the value 64
- Copy some charset to 9800-9C00

This will flicker a bit and show visible artifacts like @@@@@@@@, it's what the ROM is doing.

The other method - the one I use is a bit longer but removes the artifacts:
- Set all the memory from A000 to BFDE to the value 16 (black paper) or 0 (black ink)
then same thing as before
- Write 30 (HIRES attribute) to BFDF (last byte of the last text line, always visible in TEXT or HIRES)
- Set all the memory from A000 to BFDE to the value 64
- Copy some charset to 9800-9C00

The only difference is that by covering the screen in color attributes you don't see any characters being redefined, no glitches.

Note: It is important that you don't erase the value 30 from BFDF before it has been read by the ULA, which means at least one full frame duration. Normally by the time the memset has been done you are fine :)
Antiriad2097
Flying Officer
Posts: 158
Joined: Tue May 09, 2006 9:42 pm
Location: Aberdeen, UK
Contact:

Re: Switching to and from HIRES mode in assembly?

Post by Antiriad2097 »

That's perfect Dbug, exactly what I needed to know and well explained. Thanks a lot for the speedy response.
User avatar
Iapetus
Flying Officer
Posts: 135
Joined: Thu Mar 19, 2009 10:47 pm

Re: Switching to and from HIRES mode in assembly?

Post by Iapetus »

That was awesome Dbug, I have been wondering about this myself. Thx
Twitter: @newIapetus
Ko-fi:iapetusretrostuff
itch.io: Iapetus
Youtube: Iapetus Retro Stuff
Post Reply