Hires Graphics
Posted: Tue Jan 24, 2006 12:41 pm
The following program was listed in Elektronikvärlden, issue 6/7 June 1983. The hires routines were written by Thomas Magnusson, and presented as a ML listing, so VIC-MON or similar was required in order to input it. They used a lot of space describing the technique and some applications, but I think most people would have been better off with a Basic DATA loader.
The routines take 0.5K, the hires screen takes another 2K which leaves about 1K on an unexpanded machine. The routines would surely be possible to relocate or improve upon, but I haven't tried it yet. There may be better algorithms for e.g. line drawing too. Due to the limitations, there are no Basic extentions, so all routines are called via POKE and SYS:
Initialize screen
SYS 7168
Set dot colour to F
POKE 0,F:SYS 7212
Clear Screen
SYS 7223
Set Dot X,Y
POKE 0,X:POKE 1,Y:SYS 7346
Clear Dot X,Y
POKE 0,X:POKE 1,Y:SYS 7360
If Dot X,Y Then
POKE 0,X:POKE 1,Y:SYS 7373:IF PEEK(2) THEN
Draw Line X1,Y1 to X2,Y2
POKE 0,X1:POKE 1,Y1:POKE 2,X2:POKE 3,Y2:SYS 7576
Clear Line X1,Y1 to X2,Y2
POKE 0,X1:POKE 1,Y1:POKE 2,X2:POKE 3,Y2:SYS 7584
Save picture to tape
SYS 7592
Load picture from tape, set dot colour F, border R and background B
POKE 0,F:POKE 1,R:POKE 2,B:SYS 7610
Set dot colour F, border R and background B
POKE 0,F:POKE 1,R:POKE 2,B:SYS 7628
If you do SYS 7631, only border and background (equals POKE 36879) will change. The author suggests assigning variables such as:
SD=7346:POKE 0,X:POKE 1,Y:SYS SD
http://www.cbm.sfks.se/files/hires.d64
The routines take 0.5K, the hires screen takes another 2K which leaves about 1K on an unexpanded machine. The routines would surely be possible to relocate or improve upon, but I haven't tried it yet. There may be better algorithms for e.g. line drawing too. Due to the limitations, there are no Basic extentions, so all routines are called via POKE and SYS:
Initialize screen
SYS 7168
Set dot colour to F
POKE 0,F:SYS 7212
Clear Screen
SYS 7223
Set Dot X,Y
POKE 0,X:POKE 1,Y:SYS 7346
Clear Dot X,Y
POKE 0,X:POKE 1,Y:SYS 7360
If Dot X,Y Then
POKE 0,X:POKE 1,Y:SYS 7373:IF PEEK(2) THEN
Draw Line X1,Y1 to X2,Y2
POKE 0,X1:POKE 1,Y1:POKE 2,X2:POKE 3,Y2:SYS 7576
Clear Line X1,Y1 to X2,Y2
POKE 0,X1:POKE 1,Y1:POKE 2,X2:POKE 3,Y2:SYS 7584
Save picture to tape
SYS 7592
Load picture from tape, set dot colour F, border R and background B
POKE 0,F:POKE 1,R:POKE 2,B:SYS 7610
Set dot colour F, border R and background B
POKE 0,F:POKE 1,R:POKE 2,B:SYS 7628
If you do SYS 7631, only border and background (equals POKE 36879) will change. The author suggests assigning variables such as:
SD=7346:POKE 0,X:POKE 1,Y:SYS SD
http://www.cbm.sfks.se/files/hires.d64