News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Mode 3

Started by sigh, 11:58, 25 January 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sigh

Has anyone created an application using this mode? Are there any advantages?

andycadley

There aren't really any advantages. It doesn't use any less memory and you can achieve the exact same effect by setting a bunch of the inks in Mode 0 to be the same colours. I'm sure if you tried very hard you could find a specific case where there is a marginal advantage to Mode 3 for a very specific effect, but it's not very likely and there are probably better effects you can accomplish by playing with the colours in Mode 0.


It's not really very interesting other than as something of a historical quirk.

billamu

The key 'advantage' of Mode 3 is that you can render sprites faster, with a trade off reduced colours.
The original release of Ghosts and Goblins uses Mode 3, as well a shmup that also manages smooth vertical scrolling with this method.

andycadley

You don't actually need Mode 3 for that though, it can be achieved in Mode 0 by strategic ink selections (the BASIC manual refers to a variation of the technique as Colour Plane Sprites)


GnG is using Mode 0 though, you can tell this quite easily because even though the sprites are only 3 colours, they are different to the background inks. This is because using Colour Plane style techniques is more flexible when you have more inks available than Mode 3 is. The same goes for Mission Genocide (which is probably the shooter you're thinking of)

roudoudou

Quote from: andycadley on 07:48, 26 January 20
You don't actually need Mode 3 for that though, it can be achieved in Mode 0 by strategic ink selections (the BASIC manual refers to a variation of the technique as Colour Plane Sprites)
Yeah, there is many legendary stories about games on Amstrad CPC  ;D
- CPC cannot do hardware scrollings

- you need to lose one color for transparency on software sprites
- it's impossible to redraw all the screen each frame
- bank switching is time consuming

- copying from RAM to VRAM is slow (i guess this one comes from Amiga dudes)
- [NEW] GnG is in mode 3! (mode 0 by the way)
...

My pronouns are RASM and ACE

GUNHED

Quote from: roudoudou on 11:39, 26 January 20
Yeah, there is many legendary stories about games on Amstrad CPC  ;D
- CPC cannot do hardware scrollings
- you need to lose one color for transparency on software sprites
- it's impossible to redraw all the screen each frame
- bank switching is time consuming
- copying from RAM to VRAM is slow (i guess this one comes from Amiga dudes)


:laugh: :laugh: :laugh: :laugh: :laugh: :laugh: :laugh:  Laughing my butt off!  :) :) :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

sigh

Quote from: andycadley on 21:46, 25 January 20
'm sure if you tried very hard you could find a specific case where there is a marginal advantage to Mode 3 for a very specific effect,
Thank you everyone for your answers. I am hoping that the above comment becomes true. If I had any programming knowledge - I would of given it a go myself.

andycadley

I think you'd really struggle. Basically you have to be relying on the kind of partial decoding that can also be accomplished by palette selection in Mode 0, but also need to be doing very tight palette switches of those colours.

sigh

You could just choose mode 1 and create the art using wide pixels to get the same effect as mode 3; but yes - it would be interesting to really see those differences when programming:)

GUNHED

Quote from: sigh on 11:58, 25 January 20
Has anyone created an application using this mode? Are there any advantages?


The big advantage of MODE 3 is that you can use 8 KB of the V-RAM for something else. However it's a bit nasty since every 2nd bit is free, not complete bytes.


One can do great effects in combination with other MODEs though.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

AMSDOS

Quote from: GUNHED on 15:47, 29 January 20

The big advantage of MODE 3 is that you can use 8 KB of the V-RAM for something else. However it's a bit nasty since every 2nd bit is free, not complete bytes.


So some sort of pixel representation using the 2nd bit could be used to build up to make an array and free up main memory to do other things. That would work nicely in some sort of Maze style game, would have to be in Assembly because I couldn't imagine BASIC extracting the information quickly.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

andycadley

Again though, you can do the exact same thing in Mode 0. There is no advantage to Mode 3 in this regard.

AMSDOS

Quote from: andycadley on 21:38, 31 January 20
Again though, you can do the exact same thing in Mode 0. There is no advantage to Mode 3 in this regard.


I did a little test using the MODE 3 Demo from ACU to switch to MODE 3, using a Square Block at the Top of the Screen, I could alter the yellow Pixel mask from &C0 through to &C3 without altering it's appearance, before &C4 changed it to Red. So in theory 0..3 could represent Data of an array without affecting the screen.


I made some screenshots with notes if people don't believe it.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

sigh

Quote from: AMSDOS on 23:16, 31 January 20

I did a little test using the MODE 3 Demo from ACU to switch to MODE 3, using a Square Block at the Top of the Screen, I could alter the yellow Pixel mask from &C0 through to &C3 without altering it's appearance, before &C4 changed it to Red. So in theory 0..3 could represent Data of an array without affecting the screen.


I made some screenshots with notes if people don't believe it.
Thank you for the test.
So this cannot be done in any of the other modes?
When would this method be used?

Axelay

Quote from: sigh on 01:56, 01 February 20
Thank you for the test.
So this cannot be done in any of the other modes?
When would this method be used?



Yes, that can be done in mode 0, and even mode 1.  If you carefully set specific inks to duplicate colours, you cannot 'see' the changed ink colours, exactly as if it were mode 3.  But mode 0 is more versatile, so you can do variations of that to produce things like the 'dual playfield' effect in mode 0 you see in Ghosts'n'Goblins, or the same idea in mode 1 which I am fairly sure was used in The 5th Axis (it's 3 colour mode 1, inks 2 & 3 are both black, the sprite colour).


Tank Busters also uses ink manipulation to create a 4 colour mode 0 screen that appears to be just like mode 3, but is double buffered in a single 16kb screen.  It swaps certain inks between frame updates to show and hide alternate frames, rather than showing a different physical block of memory.  It erases and draws the next frame using the hidden inks to the 'visible' screen, then swaps the inks to show what it just displayed and hide the old frame and repeats the process for the next frame with the newly hidden inks.


I would say the opportunities for mode 3 being advantageous to mode 0 is really quite small.

AMSDOS

Quote from: sigh on 01:56, 01 February 20Thank you for the test.So this cannot be done in any of the other modes?



Well there's tricks that can performed in the other MODEs to hide portions of the screen, though that's reducing the size of the screen. In MODE 3 a part of a Byte referred to technically as a Nybble can be altered without changing the result, the test I made earlier showed that I could alter a simple block with some simple values between 0..3, then some Memory can be set aside for DATA without drawing anything to screen in MODE 3, as soon as the other modes are used, bytes 0..3 cannot be used without placing something onscreen.

QuoteWhen would this method be used?



The idea I had was for creating a simple array, there are all sorts of those, but I thought if I could use Nybble part to represent 0 to 3, I could use them to represent 0 = blank, 1 = Wall, 2 = Hazard, 3 = Exit. 


I wrote this following code for demonstration, borrowing parts of Chris Wood's MODE 3 and Sean McManus' Sprite Driver to construct a Maze like feature from the Array which is positioned at the top of the Screen from &C000 to &C051. The Sprite Driver in this case is XOR based, so in my example when a Block is drawn where the information is stored, however the information is preserved, in this case the graphic is merely a block poking &C0 to the screen, however with my data in place there, the data goes from being &C0 to &C1 without changing the shape.




100 MEMORY &8FFF:DEFINT a-z
110 GOSUB 1000:CALL &9C70:GOSUB 1200
120 p=&C000
130 FOR y=0 TO 8
140   FOR x=0 TO 8
150     IF PEEK(p)=&C1 OR peek(p)=&1 THEN CALL &9C40,&9C7D,x,y
160     p=p+1
170   NEXT x
180 NEXT y
1000 MEMORY &8FFF
1010 RESTORE 1100:ad=&9C40
1020 FOR l=1 TO 6
1030   READ a$
1040   FOR p=1 TO 31 STEP 2
1050     POKE ad,VAL("&"+MID$(a$,p,2))
1060     ad=ad+1
1070   NEXT p
1080 NEXT l
1090 RETURN
1100 DATA DD6E00DD6602CD1ABCE5DD5E04DD5605
1110 DATA EB4E234623EBE1C5E51AAE77231310F9
1120 DATA E10100080930040150C009C10D20E8C9
1130 DATA AFCD0EBCF3D979F6034FD9FBC90804C0
1140 DATA C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0
1150 DATA C0C0C0C0C0C0C0C0C0C0C0C0C0C0C000
1200 RESTORE 1290:ad=&C000
1210 FOR l=1 TO 6
1220   READ a$
1230   FOR p=1 TO 31 STEP 2
1240     POKE ad,VAL("&"+MID$(a$,p,2))
1250     ad=ad+1
1260   NEXT p
1270 NEXT l
1280 RETURN
1290 DATA 01010101010101010101000100010000
1300 DATA 00010100010001000101010100010000
1310 DATA 00000001010001010100010101010001
1320 DATA 00010000000101000100010001010101
1330 DATA 00000000000000010101010101010101
1340 DATA 01000000000000000000000000000000
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Axelay


Quote from: AMSDOS on 06:27, 01 February 20
Well there's tricks that can performed in the other MODEs to hide portions of the screen, though that's reducing the size of the screen.


Changing the screen size is not necessary.   The following program will make mode 0 produce the same results as mode 3 with your example code.




10 mode 0
20 for x=0 to 15:read a:ink x,a:next x
30 locate 1,1:print chr$(143):locate 1,10:poke &d802,&c1
90 end
100 data 1,24,20,6
110 data 1,24,20,6
120 data 1,24,20,6
130 data 1,24,20,6



While technically different 'pens' are shown with &c0 through &c3, in real terms the duplicated inks mean you'll only see a visible difference once you poke &c4 to that memory location.



Quote from: AMSDOS on 06:27, 01 February 20
I wrote this following code for demonstration, borrowing parts of Chris Wood's MODE 3 and Sean McManus' Sprite Driver to construct a Maze like feature from the Array which is positioned at the top of the Screen from &C000 to &C051.


Oh, what issue was the Chris Wood article in?  It was ACU wasn't it?  I vaguely recall an ACU article about 'mode 3', but I'm not sure if it would be the same one you're referring to.

krusty_benediction

#17
This screen (image stolen to memoryfull.net) of this demo http://www.pouet.net/prod.php?which=67656  is made using mode 3 in order to reduce the memory screen usage (not enough memory to use a standard screen mode)

roudoudou

Can you explain where is the memory gain?  ;D
As Axelay said, there is "no" difference with mode 0, except you have to change more inks if you want to change the 4 primary inks...
My pronouns are RASM and ACE

krusty_benediction

Top half and bottom half of each scroller  lie on the same memory address instead of being at two different adresses. One is mode0 and the other mode 3

andycadley

It's not really a memory saving (again using Mode 3 doesn't get you any benefits there), but I suspect it's more a timing issue. It's faster to switch to Mode 3 than change all 16 inks and whilst you're in Mode 3 you can fiddle with the upper palette entries without getting on-screen effects giving you time to prepare for the switch back to Mode 0 again.


andycadley

But, as mentioned above, you can do that in Mode 0 by sticking to only a handful of colours and repeating palette entries, so you aren't actually saving any memory by using Mode 3.

GUNHED

Quote from: andycadley on 20:19, 03 February 20
But, as mentioned above, you can do that in Mode 0 by sticking to only a handful of colours and repeating palette entries, so you aren't actually saving any memory by using Mode 3.
No, you can change unseen colors in MODE 3 - you can't in MODE 0.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

andycadley

Quote from: GUNHED on 21:01, 03 February 20
No, you can change unseen colors in MODE 3 - you can't in MODE 0.
That's not changing the amount of memory used in either case though which is the same in both modes. It just allows a potential performance enhancement because you can gain some extra time to make the required palette changes. I'd put that in the very edge case benefit where you just might gain some advantage from Mode 3, although it's not really perfect as you still need to be able to do a full pallette swap after the portions which are in Mode 0.

Powered by SMFPacks Menu Editor Mod