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
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
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
More advance? ::) Look there:
https://www.cpcwiki.eu/forum/programming/basic-programming-tips/msg117543/#msg117543
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
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
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)....
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.
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!
?"ǂ"; : REM <--- CTRL-Y on CPC keyboard equ chr$(25)
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.