English Amiga Board

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

Thread Tools
Old 14 May 2020, 06:28   #1
Registered User

Join Date: May 2019
Location: Norway
Posts: 14
How to retrieve the copper pointer - for all Amigas?


In order to make a proper exit from a demo/game I would like to set all registers back to the old values. Registers such as INTENA and DMACON are easy to fix since they have these values stored in they read-only versions of the registers.

But, for the copper pointer (COP1LC) it's different. There is no read-only register version.

In this article https://www.reaktor.com/blog/crash-c...y-programming/ there is a way of retrieving the copper pointer. This way seems to work fine on an A500. By using the debugger in WinUAE I can see that I get the correct values for the old copper pointer:

	move.l	4.w,a6
	moveq	#0,d0
	lea.l	GFXNAME,a1
	jsr	-552(a6)
	move.l	d0,a6
	move.l	38(a6),d0
	dc.b	'graphics.library',0

But this method does not seem to work on an A1200? I guess the reason is that the value 38 which is used as offset for the graphics base address is only valid for A500.

So I wonder if there is a way of retrieving the old copper pointer - regardless of the Amiga version? I've tried checking the standard functions from the grahics.library but without success....
pushead is offline  
Old 14 May 2020, 09:03   #2
OCS forever!

Antiriad_UK's Avatar
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 265
If a6 is gfx library pointer, and a5 is $dff000

move.l	gb_copinit(a6),cop1lch(a5)	;Startup copper adr
gb_copinit Is the 38 from your code above. It should work fine on all amigas (does for me).

All the code on that article are using full addresses for custom registers instead of the usual offsets so be wary of failing into the trap of mixing up cop1lch and cop1lch(ax)

Last edited by Antiriad_UK; 14 May 2020 at 09:11.
Antiriad_UK is offline  
Old 14 May 2020, 19:09   #3
Registered User

Join Date: May 2019
Location: Norway
Posts: 14
Thanks! It's seems to work fine on both A500 and A1200 now!

I've used the WinUAE debugger and see that I get the correct values for the cop1lc! Nice!
pushead is offline  

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve erased diskette content Dionysis support.Other 5 09 April 2018 20:58
Unable to retrieve default config ambien support.FS-UAE 1 14 March 2017 12:21
AmFTP cannot retrieve files with spaces in the name DopPie support.Apps 17 22 September 2016 21:32
Best way to mix blitting with copper and copper effects roondar Coders. Asm / Hardware 3 12 September 2016 13:12
Combining copper scrolling with copper background phx Coders. Asm / Hardware 14 16 June 2013 07:26

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 23:36.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07030 seconds with 15 queries