This leads into my previous question about the C++ compiler.
As part of a...Basic GUI.
I have a mouse pointer moving around but where can I find an example code of what tile is directly under the sprite.
Earlier posts I was shown this formula.
; In: HL = XY
; Out: HL = Pointer to buffer
LD A, L
RRA
RRA
RRA
RRA
RR H
RRA
RR H
RRA
RR H
LD L, H
AND 3
ADD A, VRAM_NAME/256
LD H, A
CALL SETRD
XOR A
OUT (DATA_PORT), A
Which will take the Y/X coordinates of the sprite and give the tile underneath.
If I could be shown the formula which goes in the opposite direction.
I would like to put a sprite in an area of the screen, press a key which would place whatever value at that location.
So if I load a, with 'P' and press enter the value of 'P' will be entered into that vram address.
I would have thought that same formula would have resulted in the proper address except an in, you use an out.
Like LD A, 'P'
OUT (DATA_PORT), A
But it seems to go to the address to the right of where I need it.
My offsets are correct but, just not working out the way I planed.