News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_bluestar

Load SYMBOL from DATA (Basic)

Started by bluestar, 16:46, 07 July 24

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

bluestar

Hi there,

I wonder if is possible to use SYMBOL reading pixels from DATA.

10 SYMBOL 255,[pixels from line 30]
30 DATA &7,&7,&6,&1E,&0,&0,&0,&0 (or in decimal)

Thanks in advance!

PS: using only BASIC

bluestar

Ok... each pixel is a separated variable... so I can read into an array

10 DIM a(8)
20 FOR i=1 TO 8
30 READ a(i)
40 NEXT i
50 SYMBOL 20,a(1), a(2), a(3), a(4), a(5), a(6), a(7), a(8)
60 DATA 255,222,222,4,5,6,11,67



abalore

#2
I don't know if "using only BASIC" excludes POKE, but you can poke the values right after HIMEM, being the first defined character in SYMBOL AFTER in HIMEM+1, and the rest sequentially after it:

10 RESTORE
20 DEFINT a-z
30 SYMBOL AFTER 240
40 a!=HIMEM+1
50 FOR i=1 TO 8
60 READ b
70 POKE a!,b
80 a!=a!+1
90 NEXT
100 PRINT CHR$(240)
110 DATA 255,129,129,129,129,129,129,255


The advantage of this method is you can define all your characters in a single loop. Also is a lot faster than calling SYMBOL

ZorrO

CPC+PSX 4ever

McArti0

Or...

1 restore 100
10 ?chr$(25);:for i%=0 to 8:read n%:?chr$(n%);:next
50 ?chr$(255)

100 DATA 255,0,170,0,55,0,170,0,55
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

bluestar

Quote from: abalore on 17:55, 07 July 24I don't know if "using only BASIC" excludes POKE, but you can poke the values right after HIMEM, being the first defined character in SYMBOL AFTER in HIMEM+1, and the rest sequentially after it:

10 RESTORE
20 DEFINT a-z
30 SYMBOL AFTER 240
40 a!=HIMEM+1
50 FOR i=1 TO 8
60 READ b
70 POKE a!,b
80 a!=a!+1
90 NEXT
100 PRINT CHR$(240)
110 DATA 255,129,129,129,129,129,129,255


The advantage of this method is you can define all your characters in a single loop. Also is a lot faster than calling SYMBOL

Noted. But no POKES this time  :P

bluestar

Quote from: McArti0 on 22:36, 07 July 24Or...

1 restore 100
10 ?chr$(25);:for i%=0 to 8:read n%:?chr$(n%);:next
50 ?chr$(255)

100 DATA 255,0,170,0,55,0,170,0,55
Oh... it works nice... 
How? I mean... chr$(255)chr$(0)chr$(170)....

andycadley

Chr$(25) is equivalent to the SYMBOL command. When you print it, the next nine bytes printed will be the character code, followed by the 8 bytes that define it.

bluestar

Quote from: andycadley on 18:52, 08 July 24Chr$(25) is equivalent to the SYMBOL command. When you print it, the next nine bytes printed will be the character code, followed by the 8 bytes that define it.
Cool!

McArti0

?"ǂ"; : REM <--- CTRL-Y on CPC keyboard equ chr$(25)
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

abalore

Just curious, why you want to do it with DATA? Doing with SYMBOL is just replacing one word and it's more straightforward, with no extra code required.

Powered by SMFPacks Menu Editor Mod