16 May 2014, 16:33 | #1 |
Posts: n/a
|
rastering with vhposr
Hello,
I'm totally new in Amiga 68k programming. I'm learning slowly, and study the beast reading the hardware manual guide, which 3rd edition is available online. I'v decided as a little exercice to play with color 0: just changing background color at a given line. I was thinking of doing this with copper, but i got too much problem implementing this. Then, i found Scoopex tutorial on YouTube, and i decided to follow his way. The Scoopex tutorial can be viewed here: [ Show youtube player ] He's not using copper, but do a polling loop which read a hardware register. This is this one (0xDFF006): http://amiga-dev.wikidot.com/hardware:vhposr I don't understand how it is done, in the video. He's waiting a line, and then change the color 0. Ok. So, looking at the VHPOSR register, the formula should be something like this: the line i want to reach: (line << 8) As bits 0 to 7 are dedicated to horizontal position, and the vertical position comes from 8 to 15. If i do this way, the line is never reached. Instead, i've seen i should to something like this: Code:
waitline: ; 0x2c + 0x12c / 2 == 0xac ; 44d + 300d / 2 == 172 cmp.b #0xac,vhposr(a0) bne.b waitline move #0xfff,color00(a0) I don't understand the calculus he is doing: why 0x2c + 0x12c / 2 ? Where those values are coming from (i guess that the division is for landing in the middle of the screen). It's explained in the video, but i cannot understand it (i'm not good at listening english). Thank you It's hard to begin Last edited by pixel; 16 May 2014 at 19:47. Reason: added a link to the Scoopex tutorial |
16 May 2014, 19:53 | #2 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
The register is 16 bit but one can read a byte from it just as from any other memory address.
68k is Big Endian so vhposr(a0) is the high byte, low byte is at vhposr+1(a0). |
16 May 2014, 20:18 | #3 |
Posts: n/a
|
Ooohh… i see! As you guessed, i was confused with big/little endian (only assembly language i've practiced was intel assembly)
And i guess that visible raster starts at position 0x2c, doesn't it ? Thank you ! |
17 May 2014, 21:33 | #4 |
Registered User
Join Date: Sep 2008
Location: Germany
Age: 49
Posts: 137
|
The visible display is defined with the DIWSTRT & DIWSTOP registers (display window start & display window stop). You define here the width, height and position of your display. If the tutorial uses $2c as the first line of bitmap then its probably because DIWSTRT uses $2c as the vertical start position. Note, I say first line of bitmap as you can change e.g. the background color with copper or cpu outside of this display window.
|
17 May 2014, 22:49 | #5 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
It starts at line 21 on NTSC and line 29 on PAL, and you have 240 and 283 visible lines respectively, but on most TV sets (at least CRTs) you will only see about 220 and 270 lines, and vertical centering also differs a little from TV to TV.
|
17 May 2014, 23:25 | #6 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Yep, I do address big-endian vs little-endian in the tutorial on memory for coders come from big-endian systems.
I use absolute custom chip register addresses in the first tutorials to not get into byte/word/longword register and memory accesses too early on. An "r" at the end of a custom chip register symbol signifies that it's a read-only register, so in other words, you're polling a memory address updated by the video hardware until it matches your desired stop position. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|