Author Topic: Locomotive Basic - ColorMap Address  (Read 1271 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabrizio Radica

  • Supporter
  • CPC664
  • *
  • Posts: 135
  • Country: it
  • Amiga and CPC6128 User
    • Retroacademy
    • Awards
Locomotive Basic - ColorMap Address
« on: 22: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
Code: [Select]
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!

like
0
No reactions
Amstrad CPC6128 <3
http://www.facebook.com/groups/retroacademy/
Retroacademy.it - retrocomputing, retrogame anni &#039;70, &#039;80, &#039;90
Retroacademy.it - retrocomputing, retrogame anni '70, '80, '90

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
    • Awards
Re: Locomotive Basic - ColorMap Address
« Reply #1 on: 02:42, 22 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
Code: [Select]
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:


Code: [Select]

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:


Code: [Select]
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.
like
0
No reactions
* 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