Page 1 of 1

[SOLVED][VDP] What are the two bytes that have to be written into the VDP status address?

Posted: Sun Feb 11, 2018 5:46 pm
by Fabrizio Caruso
Hi

I need to access the VDP. I have understood the basics of the read/write procedure but not the details.

What do I need to write into the status read/write registers?
The first byte is the LSB.
The second byte seems to be the MSB + something else.
What is the something else?

Fabrizio

Re: [VDP] What are the two bytes that have to be written into the VDP status address?

Posted: Tue Feb 27, 2018 10:52 am
by carlsson
You add $40 to indicate the address is set up for writing, or $00 to indicate it is set up for reading.

This doc is for the Spectravideo but is has the same type of VDP, see Address Register: http://samdal.com/svvideo.htm

Re: [VDP] What are the two bytes that have to be written into the VDP status address?

Posted: Thu Mar 15, 2018 2:44 pm
by Fabrizio Caruso
Sorry I still do not understand why on other examples I see $80 added instead of $40.

I need some simple to write into VDP memory from C without using interrupts.
I am supposed to do this in C with very little Assembly.

Let us assume the VDP registers are already set.
I need:
1. a function VPOKE(loc,value) to write value onto loc (VDP memory) and
2. a function VPEEK(loc) to read the value contained in loc (VDP memory).

If I understand well, this can be done by writing/reading into two registers (for value and status).
I do not understand what to write into the status registers.

Re: [VDP] What are the two bytes that have to be written into the VDP status address?

Posted: Fri Mar 16, 2018 12:20 am
by ThomHa
If you add 0x80 then you'll write to a register instead of to VRAM.

Logic is:

To write to a register, write the value you want to set, then write (the register address) + 0x80.

To write to VRAM, write the low byte of the address, then write the high byte + 0x40, then write the value to write to the data register.

When the TMS next has an access slot, it'll write the value you submitted. A design flaw is that there's no way to know when the value has been written and if you supply the next byte to write too soon, you'll overwrite the previous value. So don't attempt to do block transfers in a tight loop. Wait for interrupt to get better access shoot availability.

Pseudocode is:

Disable interrupts.
Read the status register.
Write low byte of address.
Write high byte + 0x40.
Write data.
Wait.
Write data for address + 1.
Etc.

Reading the status register has the effect of making it explicit that the next thing you're going to write us the low byte, not the high. You don't know what state the VFP has been left in by the previous user.

Apologies for the vagueness on 'wait' — I know the TMS fairly well but not the CreatiVision, or any other 6502 TMS machine; when paired with the Z80 it's usually connected as an IO device, which makes accessing it quite slow and usually means you don't need to take that much care.

Re: [VDP] What are the two bytes that have to be written into the VDP status address?

Posted: Sat Oct 19, 2019 10:17 am
by Fabrizio Caruso
Thanks!