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: 36
Posts: 3,341
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: 1,288
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 offline  
Old 05 September 2019, 16:00   #23
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 609
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: 945
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: 840
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: 36
Posts: 3,319
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
Steril707
Tigerskunk!

Steril707's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 971
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.
Steril707 is offline  
Old 06 September 2019, 10:00   #28
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,288
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 offline  
Old 22 September 2019, 11:38   #29
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 235
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
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,008
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
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 235
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
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,008
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
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 235
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
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,008
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  
 


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 50 03 October 2019 20:22
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 05:20.


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