Updating User-Defined Graphics on the screen.

Popular in previous forums place your programming snippets here
Post Reply
User avatar
Martin
Global Admin
Posts: 286
Joined: Mon Jan 02, 2023 5:18 pm

Updating User-Defined Graphics on the screen.

Post by Martin »

Jaap eluded to this in one of his papers.
When printing UDG's to the screen, you don't need to rePRINT them. If they're changed they are updated on the screen as they are updated in the code.

Remember Jaap has a handy UDG Creator to help design them..

ON an LZ/LZ64

Code: Select all

TUDG:
LOCAL c%,i%
UDG 0,0,14,17,17,17,14,0,0
i%=10                           :REM Keep this value small
c%=1                            :REM loop value
AT 10,1 :PRINT CHR$(0)
DO
 PAUSE i%
 UDG 0,0,0,14,14,14,0,0,0
 PAUSE i%
 UDG 0,0,14,17,17,17,14,0,0
 c%=c%+1
 IF KEY :STOP :ENDIF            :REM Emergency exit
UNTIL c%>10
AT 1,1 :PRINT "Finished"
GET
ON a CM/XP
First a UDG creator command

Code: Select all

UDG:(x%,a%,b%,c%,d%,e%,f%,g%,h%)
POKEB $180,64+x%*8
POKEB $181,a%
POKEB $181,b%
POKEB $181,c%
POKEB $181,d%
POKEB $181,e%
POKEB $181,f%
POKEB $181,g%
POKEB $181,h%
Then the demonstration Temp UDG program

Code: Select all

TUDG:
LOCAL c%,i%
UDG:(0,0,14,17,17,17,14,0,0)     :REM Colon: and (values in brackets)
i%=10                            :REM Keep this value small
c%=1                             :REM loop value
AT 10,1 :PRINT CHR$(0)
DO
 PAUSE i%
 UDG:(0,0,0,14,14,14,0,0,0)      :REM Colon: and (values in brackets)
 PAUSE i%
 UDG:(0,0,14,17,17,17,14,0,0)    :REM Colon: and (values in brackets)
 c%=c%+1
 IF KEY :STOP :ENDIF             :REM Emergency exit
UNTIL c%>10
AT 1,1 :PRINT "Finished"
GET
Further reading on creating UDG's

LZ/LZ64
Appendix A (page 93 of the re-published LZ Programming Manual) has details of the UDG Command
Syntax: UDG x%,a%,b%,c%,d%,e%,f%,g%,h%
Defines a display character. x% is the number of the character (0-7) and the integers a% to h% define each line of the character. For example, the instruction:
UDG 7,0,0,0,0,0,0,0,31 Defines UDG 7 as an underline character.

CM/XP
A bit more complicated as there is no specific UDG command. Appendix A (page 193) of the original Organiser II (CM/XP) manual has details
The the code used above is taken from the CM/XP Manual (page 160)

Regards Martin
Post Reply