02-14-2011, 07:42 PM
slenkar Wrote:The above listing is right. You can CHR(144) up to... ???. Honestrly, not sure, but at least you should be able to use up to UDG "Z" (not existing in the original BASIC).Code:70 REM UDG
71 DIM udg(1, 7) AS uByte => { {60, 66, 129, 129, 129, 129, 66, 60}, _
{24, 60, 60, 60, 126, 251, 247, 126}}
73 POKE UINTEGER 23675, @udg(0, 0): REM Sets UDG variable to first element
74 LET S$ = CHR$(144): LET F$ = CHR$(145)
Is CHR(144) the first user defined graphic ?
what is the last one you can have? CHR(?)
Remeber you can use "\A" instead of CHR$(144) for your commodity, so "\A"..."\Z". I'm currently a bit busy, but if I recall correctly, I wanted the user to use upper ASCII codes as UDG (e.g. PRINTing CHR$(210) won't print a token, but probably rubbish). I will update this info later.
slenkar Wrote:and talking of graphics should I investigate the 4sprite library?Al the sprites and UDG go into general memory. In fact, there is no "UDG memory" in ZX BASIC: This is because you are now in machine code (not in real BASIC). Classic UDG graphics were located beyond RAMTOP. Now the RAMTOP is by default 32767 (see CLEAR 32767 in the generated basic listing upon your program exit. Type LIST<enter> after your program return). By doing the above or using incbin and POKEing 23675 you are reserving memory for your UDG the right way.
also, if I create an image and import it as a BIN, does the sprite go into UDG memory or general memory?
slenkar Wrote:also, is there a script or library that replaces the spectrum font with something nicer?By default, PRINT already has some features. Try
Code:
PRINT BOLD 1; ITALIC 1; "HELLO WORLD"
Expanding UDG and graphics:
Needless to say you can have several arrays in your program, and POKE them (UDG, or CHARS) during runtime to have several UDG tables. This is very fast (and even more in ASM).