[comp.sys.amiga.tech] Reading absolute memory locations

hamilton@intersil.uucp (Fred Hamilton) (02/06/90)

Hello World.

I'm rolling my own real time clock for my A1000.  To read the registers, I
have to address specific memory locations.  I believe the correct way to
do this is along the lines of "value = *(long *)address;" (stop me now
if I've already blown it).  So I wrote a program to read some addresses
in the $00D80000-$00D80044 range (the same range the 500/2000's clock 
resides at), and I found I got this bizzare screen glitch when I read 
location $00D80028.  Here is the program (compiled with Lattice 5.04a
as "lc -L strange.c" ):

main()
{
long i, value;
long address = 0x00D80028;
/* for(i=0;i<1000000;i++) */
value = *(long *)address;
}

If you run the program once the screen you run it on will "bounce".  If you
run it several times you will notice that sometimes the screen ends up a
pixel higher than before you ran it, and sometimes it's a pixel lower.
If you take out the commented loop, the screen will go berserk for a few
seconds.

So, what is it?

	A)  I don't know how to program in C.  (typical)
	B)  My modified 1000 (LUCAS/FRANCES, CLtd HD controller) has
	    become rather weird.
	C)  The stock A1000 has something against people trying to read
	    location $D80028.
or	D)  Something else.

All I was trying to do was read the value at location $D80028 :-(

Any help will be appreciated.  Even if you can't help, please let me know
what the program does on your system if you try it.  Thanks.
-- 
Fred Hamilton                  Any views, comments, or ideas expressed here
Harris Semiconductor           are entirely my own.  Even good ones.
Santa Clara, CA

p554mve@mpirbn.UUCP (Michael van Elst) (02/08/90)

In article <75.25cde84e@intersil.uucp> hamilton@intersil.uucp (Fred Hamilton) writes:
>Hello World.
Hello Human :-)

>if I've already blown it).  So I wrote a program to read some addresses
>in the $00D80000-$00D80044 range (the same range the 500/2000's clock 
>resides at), and I found I got this bizzare screen glitch when I read 
>location $00D80028.

The stock Amiga maps the custom chip registers into addresses $c00000-$dfffff.
They are mirrored some hundred times and so (when you read at $d80028) you'll
actually read $dff028 which seems to be a WRITEONLY register. A WRITEONLY
register will even write something into itself if you read from it's
address. Since the 68000 wouldn't drive the data bus, you'll get some
random number written into that register.
If you enable GENLOC mode this way, you'll shutoff the main system clock
(and enabling an external clock). This will harm processor and memory
refresh functions.

Ugh, (I've experienced it myself).

Michael van Elst
uunet!unido!mpirbn!p554mve