English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 05 September 2019, 14:56   #21
Shatterhand
Warhasneverbeensomuchfun
 
Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
Quote:
Originally Posted by Steril707 View Post
Just go for ASM, it's not that hard if you understood a couple of simple concepts.
In the end, it's just almost like some kind of very abstract looking BASIC coding.

Also, we are more than happy to help you here if you don't understand something..
I had some x86 ASM in College, but some very simple stuff (Add two values from a register, load it in a third register, INC and DEC, this kind of stuff). And this was like moons ago.

Every time I see long sheets of code in ASM I just think "I'm too old to waste my time learning this, this is insane".

Yet I keep hearing SO MUCH "You really should go for ASM" that I guess at some point I'll give in

Last edited by Shatterhand; 05 September 2019 at 15:20.
Shatterhand is offline  
Old 05 September 2019, 15:07   #22
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
Life is too short to learn all things. Pick what you want to learn and use that.

I do use assembly, but I'm just a gigantic sucker for banging the hardware of retro computers directly. Looking at what you managed to do in Blitz in such a short time, I'm kind of envious. Sure, Blitz is slower - but you got a lot done and it all works well enough.

IMHO, assembly is something you should only use if you either need it (i.e. you can't manage to get the speed you want without it and you've done all you can to make the non-assembly program itself as efficient as you can), or want to use it. IIRC, Blitz actually offers a nice compromise here - you can include inline assembly easily if you want too. But you don't need to
roondar is online now  
Old 05 September 2019, 16:00   #23
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
For AGA colours you bank in/out banks of 32 colours and upper/lower 12-bit halfs of the 24-bit colour.
Which means that on boot-up it will default to the first 32 colours and upper 12 bits.

Incidently, writing to the upper 12 bits will copy the exact same value to the lower 12 bits. So write the lower 12 bits last.
NorthWay is offline  
Old 05 September 2019, 17:22   #24
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Steril707 View Post
AGA feels to me like they needed to stick a new part on top of an existing cars engine to make it faster.

Well, that's because that's exactly what CBM had to do to keep compatibility with OCS
hooverphonique is offline  
Old 05 September 2019, 19:19   #25
nogginthenog
Amigan
 
Join Date: Feb 2012
Location: London
Posts: 1,309
Quote:
Originally Posted by Shatterhand View Post
I had some x86 ASM in College, but some very simple stuff (Add two values from a register, load it in a third register, INC and DEC, this kind of stuff). And this was like moons ago.

Every time I see long sheets of code in ASM I just think "I'm too old to waste my time learning this, this is insane".
If it helps 68000 is much easier than x86!
nogginthenog is offline  
Old 06 September 2019, 08:17   #26
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Quote:
Originally Posted by nogginthenog View Post
If it helps 68000 is much easier than x86!
68000 is certainly nicer, not sure I'd agree with it being easier.
Hewitson is offline  
Old 06 September 2019, 09:32   #27
Tigerskunk
Inviyya Dude!
 
Tigerskunk's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
I agree with 68K asm being easier.
68K asm is almost like coding in C.

x86 asm is like someone repeatingly hitting your head with a stick and laughing at you.
Tigerskunk is offline  
Old 06 September 2019, 10:00   #28
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
Quote:
Originally Posted by NorthWay View Post
For AGA colours you bank in/out banks of 32 colours and upper/lower 12-bit halfs of the 24-bit colour.
Which means that on boot-up it will default to the first 32 colours and upper 12 bits.

Incidently, writing to the upper 12 bits will copy the exact same value to the lower 12 bits. So write the lower 12 bits last.
Now we're talking AGA setting anyway, here's the way to select banks & select between upper and lower 12 bits. To select the colour bank, use register BPLCON3 ($106). Bits 13-15 select which bank you wish to use (numbered 0-7). Each bank is the next 32 colours in the palette.

Code:
Copper example:
select bank 0: $0106,$0000 ; colours 0-31
select bank 1: $0106,$2000 ; colours 32-63
...
select bank 7: $0106,$E000 ; colours 224-255
Note: the other bits of BPLCON3 have other functions such as border blanking or the second playfields colour index offset*. I've set those to zero in the example above, but they should be set as required by the program.

To select whether writes to colour registers set the upper or lower colour 12 bits, register BPLCON3 is used again. Bit 9 selects upper or lower bits. Set this bit to 0 to set the upper 12 bits and set to 1 to set the lower 12 bits. This setting should be combined with the bank number.
Code:
Copper example:
select bank 0/upper 12 bits of colour: $0106,$0000 ; upper 12 bits of colours 0-31
select bank 0/lower 12 bits of colour: $0106,$0200 ; lower 12 bits of colours 0-31
select bank 1/upper 12 bits of colour: $0106,$2000 ; upper 12 bits of colours 32-63
select bank 1/lower 12 bits of colour: $0106,$2200 ; lower 12 bits of colours 32-63
...
select bank 7/upper 12 bits of colour: $0106,$E000 ; upper 12 bits of colours 224-255
select bank 7/lower 12 bits of colour: $0106,$E200 ; lower 12 bits of colours 224-255
As before: I've set all other bits to zero, but they should be set as required by the program.

*) for more information on all things AGA, including BPLCON3 settings, see: http://www.stashofcode.fr/code/affic...ndyOfComax.txt

On the 68000 vs X86 topic: not sure that is on topic and I do believe this thread is already a split thread of a split thread
(but I'd agree that 68000 is nicer to write )

Last edited by roondar; 06 September 2019 at 10:16. Reason: Added colour numbers
roondar is online now  
Old 22 September 2019, 11:38   #29
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Could someone spoon feed through my first copper list in 30 years?

I'm trying to make a split screen display, the top half being a 320x128 16 colour screen and the bottom half being a 320x128 8 colour screen.

The thing I'm most troubled by are the wait instructions at the start and middle of the list, but I know there are other bits missing too.

This is what I have so far:

Code:
    WORD copperList[] = {
        0x0000, 0x0000,                 // wait for top of screen

        BPLCON0, COLORON | 4,           // 4 bit planes

        BPL1PTH, NULL,
        BPL1PTL, NULL,
        BPL2PTH, NULL,
        BPL2PTL, NULL,
        BPL3PTH, NULL,
        BPL3PTL, NULL,
        BPL4PTH, NULL,
        BPL4PTL, NULL,

        COLOR00, 0x000, // Black
        COLOR01, 0x8ce, // Sky Blue
        COLOR02, 0xdb8, // Tan
        COLOR03, 0x282, // Forest Green

        COLOR04, 0xfff, // White
        COLOR05, 0xaaa, // Lightest Grey
        COLOR06, 0x999, // Light Grey
        COLOR07, 0x777, // Medium Grey
        COLOR08, 0x555, // Dark Grey
        COLOR09, 0x444, // Darkest Grey
        COLOR10, 0xf00, // Red
        COLOR11, 0x800, // Dark Red
        COLOR12, 0xf80, // Dark Orange
        COLOR13, 0xfdb, // Wheat
        COLOR14, 0x682, // Olive Drab
        COLOR15, 0x59a,  // Cadet Blue

        0x0000, 0x0000,                 // wait for middle of screen

        BPLCON0, COLORON | 3,           // 3 bit planes

        BPL1PTH, NULL,
        BPL1PTL, NULL,
        BPL2PTH, NULL,
        BPL2PTL, NULL,
        BPL3PTH, NULL,
        BPL3PTL, NULL,

        COLOR00, 0x000, // Black
        COLOR01, 0xfff, // White
        COLOR02, 0x999, // Light Grey
        COLOR03, 0x777, // Medium Grey
        COLOR04, 0x555, // Dark Grey
        COLOR05, 0xf00, // Red
        COLOR06, 0x0f0, // Green
        COLOR07, 0x0f7, // Orange

        0xffff, 0xfffe                  // end
    };

Last edited by deimos; 22 September 2019 at 11:54.
deimos is offline  
Old 22 September 2019, 12:51   #30
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Code:
    WORD copperList[] = {
	0x01fc, 0x0000, 0x008e, 0x2c81, 0x0090, 0x2cc1,
	0x0092, 0x0038, 0x0094, 0x00d0,	// change it for scroll screen

	// wait for top of screen
	0x2b07, 0xfffe,
	0x0102, 0x0000, 0x0108, 0x0000, 0x010a, 0x0000,	// change it if needed
	BPLCON0, COLORON | 4,				// 4 bit planes

        BPL1PTH, NULL,
        BPL1PTL, NULL,
        BPL2PTH, NULL,
        BPL2PTL, NULL,
        BPL3PTH, NULL,
        BPL3PTL, NULL,
        BPL4PTH, NULL,
        BPL4PTL, NULL,

        COLOR00, 0x000, // Black
        COLOR01, 0x8ce, // Sky Blue
        COLOR02, 0xdb8, // Tan
        COLOR03, 0x282, // Forest Green
        COLOR04, 0xfff, // White
        COLOR05, 0xaaa, // Lightest Grey
        COLOR06, 0x999, // Light Grey
        COLOR07, 0x777, // Medium Grey
        COLOR08, 0x555, // Dark Grey
        COLOR09, 0x444, // Darkest Grey
        COLOR10, 0xf00, // Red
        COLOR11, 0x800, // Dark Red
        COLOR12, 0xf80, // Dark Orange
        COLOR13, 0xfdb, // Wheat
        COLOR14, 0x682, // Olive Drab
        COLOR15, 0x59a, // Cadet Blue

	// wait for middle of screen
	0xabd7, 0xfffe,
	0x0102, 0x0000, 0x0108, 0x0000, 0x010a, 0x0000,	// change it if needed
	BPLCON0, COLORON | 3,				// 3 bit planes

        BPL1PTH, NULL,
        BPL1PTL, NULL,
        BPL2PTH, NULL,
        BPL2PTL, NULL,
        BPL3PTH, NULL,
        BPL3PTL, NULL,

        COLOR00, 0x000, // Black
        COLOR01, 0xfff, // White
        COLOR02, 0x999, // Light Grey
        COLOR03, 0x777, // Medium Grey
        COLOR04, 0x555, // Dark Grey
        COLOR05, 0xf00, // Red
        COLOR06, 0x0f0, // Green
        COLOR07, 0x0f7, // Orange

	0xffff, 0xfffe	// end
    };
Feel free to ask for clarification.

Cheers.

EDIT: only C

Last edited by ross; 22 September 2019 at 13:42. Reason: cleaned
ross is offline  
Old 22 September 2019, 13:32   #31
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by ross View Post
Feel free to ask for clarification.

Cheers.
Thanks. I've taken your code and formatted as C, which is where I'm at at the moment. I might need some help with the bits that are "just numbers", i.e.

Code:
        0x01fc, 0x0000
Code:
        0x2b07, 0xfffe,
and

Code:
        0xabd7, 0xfffe,
Your originals below:

Code:
        dc.l	$01fc0000,$008e2c81,$00902cc1,$00920038,$009400d0

is

        0x01fc, 0x0000,
        DIWSTRT, 0x2c81,
        DIWSTOP, 0x2cc1,
        DDFSTRT, 0x0038,
        DDFSTOP, 0x00d0

--

        dc.l	$2b07fffe,$01004200,$0108ffd8,$010affd8,$01020000

is

        0x2b07, 0xfffe,
        BPLCON0, 0x4200,
        BPL1MOD, 0xffd8,
        BPL2MOD, 0xffd8,
        BPLCON1, 0x0000

--

        dc.l	$abd7fffe,$01020088,$01003200,$01080000,$010a0000

is

        0xabd7, 0xfffe,
        BPLCON1, 0x0088,
        BPLCON0, 0x3200,
        BPL1MOD, 0x0000,
        BPL2MOD, 0x0000
deimos is offline  
Old 22 September 2019, 13:49   #32
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by deimos View Post
0x01fc, 0x0000
Disable AGA fetches.

Code:
        0x2b07, 0xfffe,
A line before start of BPL DMA fetches.
07 because is the first position where COLOR00 do not appear on previous line, but you can change in case.

Code:
        0xabd7, 0xfffe,
Position near the right edge before the horizontal blank where you do not interact with the previous DMA fetch.
This way you have time to set parameters and colors before the next line, which is located in the vertical middle of the screen.

Code:
        BPL1MOD, 0xffd8,
        BPL2MOD, 0xffd8,
        BPLCON1, 0x0000
You need to change this to your needs.
ross is offline  
Old 22 September 2019, 14:31   #33
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by ross View Post
Disable AGA fetches.
Huh. That's new.

Quote:
Originally Posted by ross View Post

Code:
        0x2b07, 0xfffe,
A line before start of BPL DMA fetches.
07 because is the first position where COLOR00 do not appear on previous line, but you can change in case.
Not sure I get this, but I guess I can just accept it and come back if something doesn't look right later.

Quote:
Originally Posted by ross View Post
Code:
        0xabd7, 0xfffe,
Position near the right edge before the horizontal blank where you do not interact with the previous DMA fetch.
This way you have time to set parameters and colors before the next line, which is located in the vertical middle of the screen.
This sounds good.

Quote:
Originally Posted by ross View Post
Code:
        BPL1MOD, 0xffd8,
        BPL2MOD, 0xffd8,
        BPLCON1, 0x0000
You need to change this to your needs.
Will do.


I'll keep your explanations as comments in my code, and I'll probably be back with questions after I get all the other bits plugged in.

Thanks.
deimos is offline  
Old 22 September 2019, 16:18   #34
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by deimos View Post
Huh. That's new.
FMODE:
http://www.winnicki.net/amiga/memmap/FMODE.html
With FMODE=0 you reset to OCS/ECS 16bit fetches.

Quote:
Not sure I get this, but I guess I can just accept it and come back if something doesn't look right later.
Yes, I explained it too quickly.
Actually when copper waits at xxnn, where nn<7, beam is still in line xx-1.
So if the first MOVE after the WAIT is COLOR00 you can view the change in the far right border.
If you WAIT for xx07 you're sure to have the change in the blanked part.
Obviusly if you change some other register there's no problem.

In the case in question the registers to be set are too many to do in the ($2c)HB so you must do it in the previous line ($2b).
Setting to 07 is just a habit for me.
Actually is the first screen so you can do it where you like even without the WAIT

But suppose you have an overscan screen and another split between lines $1a and $2b...
ross is offline  
Old 20 August 2021, 11:04   #35
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
I understand it's not possible to wait until Y>255 but actually it is with "special" PAL wait.

but the "special PAL wait" part isn't clear to me.
Code:
dc.w  $FFDF,$FFFE
My display is full pal, I'd like to wait until say Y=260 to trigger a copper interrupt. How do I do that?
when I add a color write in the copper interrupt, it still appears around 240 or such.

I could draw in the VBLANK interrupt but I'd like to save a few raster lines and race the beam (specially because I'm using sprites)
jotd is offline  
Old 20 August 2021, 12:28   #36
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Wait, maybe you are confusing absolute video position with relative position from the start of the screen.

Assuming that yours is a PAL screen in standard position, the first visible line is 44.
This means that the wait
dc.w $fffd,$fffe
is at the relative line 256-44, and that you have another 44 lines visible after that
And successive CWAIT restart as if it were y=0 (but really is 256).
ross is offline  
Old 31 August 2021, 18:54   #37
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
BibbyM asked in an old thread: http://eab.abime.net/showthread.php?t=21866

now this is where I start to lose understanding.. can someone explain a little more how this works (masks beam position etc) and I'll finish this off!!

and it is really difficult to understand:

Now I wrote a processing sketch what explains me the copper masking.
(you have to entry the copper-command in line 24 and run the sketch.)
(sorry, my program comments are in german)

the result is on the bottom:
eg.

Code:
--- Copperanweisung ---
 für: dc.w  $3019,$FFFE
 VP=30 dez:48 bin:00110000 ,HP=18 dez:24 bin:00011000 Bit 0=1 0=move, 1=wait oder skip
 VE=7F dez:127 bin:01111111 ,HE=FE dez:254 bin:11111110 Bit 0=0 0=wait, 1=skip bfd: 01

--- Alle vertikalen maskierten Positionen ---
30   00110000   dez= 48  diese wait-Position wird ausgeführt - VP ist überschritten
B0   10110000   dez= 176  Position ab 0x80 kann nicht maskiert werden
Das sind 2 Treffer.

--- Alle horizontalen maskierten Positionen ---
18   00011000   dez= 24
19   00011001   dez= 25
Das sind 2 Treffer.
the program calculates all possible vertical and horizontal wait-positions
under consideration of vertical and horizontal enable bits.
(dc.w $3001,$FFFE, dc.w $3101,$87fe, dc.w $3001,$ff01, dc.w $0B07,$00fe,...)

Last edited by Rock'n Roll; 09 July 2023 at 21:06. Reason: old file deleted
Rock'n Roll is offline  
Old 06 July 2023, 20:56   #38
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
I don't know how long I have been dealing with the topic of Copper Wait+Mask.
Then I had written myself a little program to understand the mask bits better.
The last time I used the program, I found an error.
I corrected the error and I added a graphical output to the program.
for use: https://processing.org/download

further more explanation on this tool.
copper waits like this: dc.w $2139,$fffe it's clear
but what about this: dc.w $0001,$80fe, dc.w $8001,$00fe or dc.w $9189,$6630, etc.

With this tool it is possible to adjust all 4 parameters VP,HP,VE,HE over sliders and set the Wait/Skip Bit and the BFD Bit.
The result is in realtime on the screen and shows the copper wait positions to the current setting and in the console.
You get an imagine how the mask bit works and where the copper wait position is.
Maybe nobody programs such a tool before? By the way, it's also a nice effect to watch the result.
With processing it's easy to start. Program Download, Open the File and Run.

It's clear every copper wait needs its own time. A next programstep could be to consider a distance between to copper waits.
(not implemented yet). Also normally the last line is 313. The program shows further more, but it is easy to change and the
program shows also copper waits behind $E2 till $FF.
Attached Thumbnails
Click image for larger version

Name:	Screen_Copper_Wait.png
Views:	22
Size:	13.0 KB
ID:	79576  
Attached Files
File Type: 7z Screen_Copper_Wait.7z (3.5 KB, 15 views)

Last edited by Rock'n Roll; 09 July 2023 at 21:32. Reason: further more explanation
Rock'n Roll 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
UHRES? Mistery/curiosity - any explanation? pandy71 Coders. Asm / Hardware 52 05 December 2020 15:38
A little explanation on GOTEK+HxC would be great.. appiah4 support.Hardware 19 22 December 2016 13:12
whdload decent explanation ? marcolau project.WHDLoad 5 01 December 2009 16:43
Error explanation?? ORSM T support.Hardware 7 01 June 2007 07:36
code explanation BippyM Coders. General 19 01 May 2007 14:12

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 14:28.

Top

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