English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 16 May 2014, 16:33   #1
pixel
 
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)
Ok… but why does he writes a byte (as the register is 16 bits), and why does he writes in low section (horizontal bits) ?

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
 
Old 16 May 2014, 19:53   #2
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
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).
Mrs Beanbag is offline  
Old 16 May 2014, 20:18   #3
pixel
 
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 !
 
Old 17 May 2014, 21:33   #4
Apollo
Registered User
 
Apollo's Avatar
 
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.
Apollo is offline  
Old 17 May 2014, 22:49   #5
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by pixel View Post
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 !
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.
Leffmann is offline  
Old 17 May 2014, 23:25   #6
Photon
Moderator
 
Photon's Avatar
 
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.
Photon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:37.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08677 seconds with 14 queries