Newsgroups: comp.sys.sinclair
Path: ulke.hiMolde.no!trane.uninett.no!nac.no!Norway.EU.net!EU.net!howland.reston.ans.net!torn!nott!cunews!freenet.carleton.ca!FreeNet.Carleton.CA!ac355
From: ac355@FreeNet.Carleton.CA (David Solly)
Subject: Help:  Sinclair UDG to Q[uick]Basic
Message-ID: <D8F6wA.98u@freenet.carleton.ca>
Sender: ac355@freenet2.carleton.ca (David Solly)
Reply-To: ac355@FreeNet.Carleton.CA (David Solly)
Organization: The National Capital FreeNet
Date: Thu, 11 May 1995 15:26:34 GMT
Lines: 86



   Does anyone know if Q[uick]Basic has any capabilities for making User
Defined Graphics (UDG) like those used ZX Spectrum or Timex/Sinclair
Basic?  I have been porting some Sinclair Basic programs over to QBasic
and I have been able to overcome most problems except this one.

Some background to the problem
------------------------------

   In BASIC for the ZX Spectrum and the Timex/Sinclair 2068 the letters
from CHR$(144) to CHR$(164) (also called UDG-A to UDG-U) can be used to
print User Defined Graphics.  Below is a snippet from an actual program
which defines the pattern for lower case "gamma" in UDG-A and upper case
"delta" in UDG-B and prints them at certain locations on the screen.


 250 POKE USR "A"+0,BIN 00000000
 251 POKE USR "A"+1,BIN 00100010
 252 POKE USR "A"+2,BIN 00010100
 253 POKE USR "A"+3,BIN 00001000
 254 POKE USR "A"+4,BIN 00010100
 255 POKE USR "A"+5,BIN 00010100
 256 POKE USR "A"+6,BIN 00010100
 257 POKE USR "A"+7,BIN 00001000
 260 PRINT AT 10,30;CHR$ 144 : REM Print UDG-A
 270 FOR I=220 TO 240 STEP 4: PLOT I,87: NEXT I
 280 LET J=1
 281 POKE USR "B"+0,BIN 00010000
 282 POKE USR "B"+1,BIN 00101000
 283 POKE USR "B"+2,BIN 00101000
 284 POKE USR "B"+3,BIN 01000100
 285 POKE USR "B"+4,BIN 01000100
 286 POKE USR "B"+5,BIN 10000010
 287 POKE USR "B"+6,BIN 11111110
 288 POKE USR "B"+7,BIN 00000000
 289 PRINT AT 0,23;CHR$ 145;"J= ";DJ : REM CHR$ 145 is UDG-B

   Below is my effort to replicate part of this in Q[uick]Basic.  I have
been able to duplicate the pattern for the characters but I require each
character to be printed only once at a certain location rather than the
whole screen painted with them.

   I thank you all in advance for your time and trouble

David Solly

-------------8<--------------------------

CLS
SCREEN 2

RESTORE

Gamma$ = ""
Delta$ = ""

DATA 0, 34, 20, 8, 20, 20, 20, 8
DATA 16, 40, 40, 68, 68, 130, 254, 0

FOR i = 1 TO 8
  READ a
  Gamma$ = Gamma$ + CHR$(a)
NEXT i

PAINT (0, 0), Gamma$

SLEEP

CLS


FOR i = 1 TO 8
  READ a
  Delta$ = Delta$ + CHR$(a)
NEXT i

PAINT STEP(0, 0), Delta$

------------8<-------------


--
David Solly                  ac355@freenet.carleton.ca
Ottawa, Ontario, CANADA      FidoNet:  1:163/215
Voice: (613)731-2120
