News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Fabrizio Radica

Locomotive Basic - ColorMap Address

Started by Fabrizio Radica, 20:42, 21 June 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fabrizio Radica

Hi :)i would like to put a simple char (or pixel) into memory and color it.for testing (so not oprimized) i've made this code

10 cls:mode 2:ink 0,0:border 0:ink 1,26
20 add=&c000:x=40:y=1
30 coord=add+x*2+y*80
150 poke coord,&41
160 locate x,y:print chr$(peek(coord))


How can i colorize it?
What color address does it have?
I would simply like to create a tilemap by drawing directly into memory.
Thanks you :)
Ciao!


AMSDOS

Quote from: Fabrizio Radica on 20:42, 21 June 19
Hi :)i would like to put a simple char (or pixel) into memory and color it.for testing (so not oprimized) i've made this code

10 cls:mode 2:ink 0,0:border 0:ink 1,26
20 add=&c000:x=40:y=1
30 coord=add+x*2+y*80
150 poke coord,&41
160 locate x,y:print chr$(peek(coord))


How can i colorize it?
What color address does it have?
I would simply like to create a tilemap by drawing directly into memory.
Thanks you :)
Ciao!


In MODE 2 it's easy to Colourise because there's only 2 Colours, so the shape is represented as an 8-bit Binary Number, so in my MODE 2 example, this generates a small Ball at the top of the screen:




100 MODE 2:DIM o(4):GOSUB 1000
110 s=&C000
120 FOR p=1 TO 4
130   POKE s,o(p)
140   s=s+&800
150 NEXT p
160 LOCATE 1,10:END
1000 FOR a=1 TO 4
1010   READ o(a)
1020 NEXT a
1030 RETURN
1040 DATA 24,60,60,24



The DATA to produce that Ball Looks like this in Binary:



00011000
00111100
00111100
00011000



Test by Changing to MODE 1 and it becomes a little Imperial Fighter and in MODE 0 a Colourful Equals Sign.


You have to remember you're dealing with Sprites when POKEing to the Screen, I wrote a BASIC example of that back in 2011, which is quite slow and the coding of it could be improved I suspect (draw sprite/enter loop/delete sprite/draw sprite in new position), which that isn't doing.


I also wrote this programme , which is used to gather the Byte Masks in Mode 0, the idea is to draw the Image onscreen using the DATA to represent the Colours you want, the image is drawn and then the Byte Masks are obtained from that.
* 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

Powered by SMFPacks Menu Editor Mod