Convert AT co-ordinates to PLOT co-ordinates
How do you convert the 2 from MC? I don't know how to convert the vertical value as they're differently ordered...
Heres what I have so far:
Heres what I have so far:
org 47000-2 x defb 0 y defb 0 ;calculated plot points ld a,(50000-3) ;vertical AT co-ord ld b,22 sub b add a,a ADD A,A add a,a ;times by 8 ld (x),a ;store vertical plot point ret
Post edited by daveysludge on
Comments
To go the other way round, multiply the character row by 8, then do 175-Y to turn it upside down. Though that will give you the plot position of the top of the character row. For the bottom of the character row, subtract another 7 to move down 7 pixels (or simply use 168-Y instead). e.g. 21 x 8 = 168 then 175-168 = 7 or 168-168 = 0.
Multiply and divide by two by using the arithmetic shift instructions rather than ADDs.
It's not neccesarily the quickest but you can probably follow:
LD A,(nnnn)
SLA A
SLA A
SLA A
LD B,A
LD A,168
SUB B
LD (nnnn),A
Or you could reverse the order of the sum by making A
negative first, then simply adding 168:
LD A,(nnnn)
SLA A
SLA A
SLA A
NEG A
ADD A,168
LD (nnnn),A
I think this is OK. The vertical position, because it could be greater than 127, is kind of breaking the rules for negative 8-bit numbers, but since they all wrap around it should work out OK in the end.
- IONIAN-GAMES.com -
Converting from AT vertical coordinate to lowest PLOT vertical coordinate (optimized):
Converting from AT vertical coordinate to highest PLOT vertical coordinate (optimized):
And converting from PLOT vertical coordinate to AT vertical coordinate (optimized):