23 December 2022, 16:44 | #1 |
Registered User
Join Date: Dec 2022
Location: Canada
Posts: 4
|
A couple beginner questions
Hello, I have a couple beginner questions to ask at this time.
As I can see in the Amiga System Programmer's Guide, when doing a clean exit from a program that installs it's own copper list, it is common to do an operation such as Code:
move.l 38(a5),COP1LC(a6) Code:
move.l 50(a5),$84(a6) My second question is: What is the best way of handling data such as copper lists and screen buffers? Is it best to do like photon and declare them in sections such as DATA_C and BSS_C, or is it better to do as in the System Programmer's Guide, and make an AllocMem call for them then build them if necessary? What are the pros and cons of each method? Also, given the questions I have asked, is there any other advice you can think of that might be useful for me to know so I can avoid asking further questions? Last edited by Nyala; 23 December 2022 at 17:12. Reason: changed execbase in a6 to chip base in a6, Thanks Don_Adan |
23 December 2022, 17:10 | #2 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,083
|
A6 can not be exec base for these examples. Must be $DFF000 aka CHIP.
|
23 December 2022, 17:13 | #3 |
Registered User
Join Date: Dec 2022
Location: Canada
Posts: 4
|
|
23 December 2022, 21:16 | #4 | ||
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
Quote:
https://amigadev.elowar.com/read/ADC.../node0551.html Search for Gfxbase and you will find Offset Decimal 38 ($26 Hex) which is Copinit. The Second one has the calculated offset in both decimal and hex next to the structure function. Quote:
You can Exec.library/AllocMem(CHIP) or Graphics.Library/AllocRaster() Which will return a pointer of allocated memory in CHIP RAM and you can store that pointer in PUBLIC memory. If you need more info, just ask and some of the other programmers will help you |
||
23 December 2022, 22:04 | #5 |
Registered User
Join Date: Dec 2022
Location: Canada
Posts: 4
|
Thank you redblade. From the links you posted I can now see where those offsets come from and how they are found. I can see that
Code:
move.l 50(a5),$84(a6) On that note, why is there a COP2LC? When and why is it used or not used? |
24 December 2022, 00:14 | #6 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Quote:
Code:
include "graphics/gfxbase.i" include "hardware/custom.i" ... move.l gb_copinit(a5),cop1lc(a6) Quote:
GfxBase->ActiViewwith LoadView(), before starting the copinit list. Quote:
DATA_Cand BSS_Care directives known by many Amiga assemblers to create a section which is loaded into Chip RAM. Alternatives: section name,data_cor section name,data,chip. I think the intention was to allow conditional jumps (via COPJMP1, COPJMP2) between two copper lists. |
|||
24 December 2022, 00:21 | #7 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,376
|
Quote:
If you *must* take over the graphics system, use "LoadView(NULL)" (again from graphics) to ensure that you are operating on a native display and not an RTG display, and to restore the display, use LoadView(GfxBase->ActiveView). All these calls are, as Phx already mentioned, documented in the NDK and the RKRM Libraries, both freely available. The best way is through the graphics.library, and through the intuition.library, the latter includes also functions for double buffering and swapping screen buffers in a system-friendly way. Some example code how to arrange screens and screen buffers you find in the mentioned RKRM volume. |
|
24 December 2022, 10:28 | #8 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,513
|
Quote:
To do this it uses the value in gb_LOFlist: during the VBI it puts it in COP2LC and the main copper list jump to it with a strobe to COPJMP2. But there can also be the use of interlaced mode; in this case the value in gb_SHFlist for short fields is also used alternating (in progressive mode, long fields are normally used). Why is it done this way? - COP1LC remains unchanged and even if there are jumps in the copper list the next frame is always consistent - COP2LC can be dynamically changed at will and screens with different properties can be generated without side effects on subsequent frames So going back to why in your example gb_LOFlist is also saved.. well there would be no need. Saving gb_copinit is mandatory and essential because its value is unchanged over time, as well as that of gb_Actiview if you use LoadView(NULL). That of gb_LOFlist instead is 'optional' because the system, once restored, resets it during the VBI. BUT, provided system restore is done properly.. If for some reason the right COP2LC is not reset in time and the main system copper list jumps to 'old value', and at this point the used memory no longer contains a valid copper list, at best you would have video glitches, at worst a crash. Again, this should not in theory happen if your code is sane, but as a precautionary measure, if you modify COP2LC in your code, then it doesn't hurt to restore it. |
|
24 December 2022, 10:57 | #9 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,376
|
Ross,
what you describe here is not part of the operating system interface, it is just what the current implementation of graphics does - for native screens. The interface towards user provided screens goes through LoadView() from the graphics side. That will keep care of the system copper lists. If there is a copper, that is. |
24 December 2022, 11:13 | #10 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,513
|
Quote:
My speech absolutely does not exclude the use of LoadView() (and in fact I also wrote about it). But it seems that the OP wants to directly use the access to copper list custom registers (and he has all the rights); otherwise it would not make sense to actually restore the values at exit. Is it a bad and dirty way? Yes, and I can survive at it I'm not advising him anything, I'm just telling him how it works on a classic/native view Amiga (and answered his questions). Of course he can follow your advices and no one will tell him it's wrong. Last edited by ross; 24 December 2022 at 11:21. Reason: typo |
|
24 December 2022, 13:13 | #11 |
German Translator
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 204
|
From a beginner side I would say, the ordinary way is to put the copperlist
in section DATA_C. The advantage is you can easy modify the copperlist every time. In the most examples is this made so. And this is also the disadvantage for AllocMem for the copperlist, because you have to know the copperlist size from beginning or you allocate to much memory. I prefer to declare the copperlist in section DATA_C also from the esthetic side. It is easier to read and you need no OS-calls. Last edited by Rock'n Roll; 24 December 2022 at 13:31. Reason: spelling |
25 December 2022, 01:16 | #12 |
Registered User
Join Date: Dec 2022
Location: Canada
Posts: 4
|
Thank you for your responses everybody, the explainations are excellent and my questions are answered for now!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Couple of beginner questions | Laika | New to Emulation or Amiga scene | 3 | 08 March 2019 13:10 |
Beginner questions: text display in an Intuition window and scrolling | thyslo | Coders. System | 6 | 07 October 2018 18:47 |
Amiga Emulation Beginner: Questions | beaglelover | New to Emulation or Amiga scene | 1 | 18 February 2016 04:11 |
A couple of questions if I may? | Mclane | support.WinUAE | 4 | 25 April 2014 17:29 |
5 more beginner questions ( A 3000) | amiganer | support.Hardware | 20 | 15 August 2007 07:45 |
|
|