English Amiga Board


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

 
 
Thread Tools
Old 09 October 2019, 22:03   #1
Spec-Chum
Registered User
 
Join Date: Dec 2016
Location: England
Posts: 87
Hooooo gb_copinit and gb_LOFlist confusion

After a rather long hiatus, I'm back to try Amiga coding again \o/

However, I wrote some code like 3 years ago and I can't remember how it works

Can anyone explain how this code works?

Code:
          move.l     gb_copinit(a6), COP1LC(a5)    ; restore original CopperList 1
          move.l     gb_LOFlist(a6), COP2LC(a5)    ; restore original CopperList 2
I found info on why I did that few years ago, but i can't seem to remember where.

The docs state:
Code:
APTR    gb_copinit        ; struct *copinit; ptr to copper start up list
APTR    gb_LOFlist        ; current copper list being run
but if gb_LOFlist is current list, isn't that just putting my CL, which is the current one at this point, into COP2LC?

Also, ptr to copper start up list? Not sure what that even means?

Please help

Last edited by Spec-Chum; 09 October 2019 at 22:12.
Spec-Chum is offline  
Old 09 October 2019, 22:14   #2
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
You are restoring two copper lists from a structure in OS libraries. In detail: you read longwords from the structures. These are addresses in RAM where the OS copper lists reside - pointers to their starting addresses in Chip RAM.

a6 contains the library base address, and a5 contains the custom chip base address (for reading and writing to hardware registers), and you're using the symbols as offsets from those. COP1LC corresponds to an offset of $80 (128), and COP2LC to $84 (132), as per this hardware register list. So the first line writes to $dff080 and $dff084 in this list, to hopefully restore the screen you were watching before running this program.

Similarly, near the start of your program you might find a write to COP1LC that sets up the screen you want the program to show until exiting.

Last edited by Photon; 09 October 2019 at 22:20.
Photon is offline  
Old 09 October 2019, 22:26   #3
Spec-Chum
Registered User
 
Join Date: Dec 2016
Location: England
Posts: 87
Quote:
Originally Posted by Photon View Post
You are restoring two copper lists from a structure in OS libraries. In detail: you read longwords from the structures. These are addresses in RAM where the OS copper lists reside - pointers to their starting addresses in Chip RAM.

a6 contains the library base address, and a5 contains the custom chip base address (for reading and writing to hardware registers), and you're using the symbols as offsets from those. COP1LC corresponds to an offset of $80 (128), and COP2LC to $84 (132), as per this hardware register list. So the first line writes to $dff080 and $dff084 in this list, to hopefully restore the screen you were watching before running this program.

Similarly, near the start of your program you might find a write to COP1LC that sets up the screen you want the program to show until exiting.
Apologies @Photon, I worded the question a bit weird, reading it back.

I'm fine with 68k aspects and what it's doing in general, like what's transferring where, it's the gb_copinit and gb_LOFlist that's confusing me.

It says gb_LOFlist is the current copperlist, but wouldn't that be mine I put in COP1LC previously? If so, it's just setting COP2LC to mine?

Is gb_copinit like a system default copperlist? Would a better description of it be "ptr to start up copperlist"?
Spec-Chum is offline  
Old 10 October 2019, 08:03   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
There are two copperlists in the system : a global one, which hardly ever changes, and a local one, which depends on the screen being displayed. Or something like that.
First one is set in COP1LC. It does its job, then starts the other one in COP2LC.
You can find their base addresses in graphics.library's library base - your A6 above. It may even be a good idea to have a peek at what they actually do, with some debugger (if you can read a copperlist).
The code you have here merely restores the values at the end of a program that has altered them directly in hardware registers.
meynaf is offline  
Old 10 October 2019, 09:24   #5
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
An addendum to what meynaf wrote.

I think the main idea is to have a global initialization copper list (every VBL) and then sublists for the single video field.

As Amiga is basically a broadcast video machine (native interlace mode and genlock) make sense to split copper lists.

gb_copinit for the main setup in COP1LC that is autoloaded every VBL.
gb_LOFlist 'launched' by main CL for the LOng video Field (in COP2LC).
gb_SHFlist 'launched' by main CL for the SHort video Field (in COP2LC).
At the end you have an interlaced frame under full control.

For a single 50/60Hz video frame only gb_LOFlist is used.
ross is offline  
Old 10 October 2019, 14:34   #6
Spec-Chum
Registered User
 
Join Date: Dec 2016
Location: England
Posts: 87
Aha!

Perfect, thanks everyone.
Spec-Chum 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
Downloads confusion shovel support.Amiga Forever 51 19 December 2013 20:04
KGWHD - confusion nixxjsteve New to Emulation or Amiga scene 16 16 January 2011 22:18
Kickstart Confusion gklinger support.Hardware 1 23 August 2008 06:00
Yet another kickstart confusion... Shoonay support.Apps 2 01 April 2005 13:55
Confusion! five_magics New to Emulation or Amiga scene 3 29 June 2004 23:17

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 19:00.

Top

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