29.12.2012 Views

spectrum utility - OpenLibra

spectrum utility - OpenLibra

spectrum utility - OpenLibra

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ect if you've loaded the code in<br />

at 32256 but start anywhere<br />

else, and all the jumps will be<br />

wrong. Hence the crash. The<br />

answer — alter the addresses.<br />

Program 3 (supplied by our illustrious<br />

Editor) will do just that.<br />

In essence what it does is to<br />

POKE new (corrected) values into<br />

those JP commands, the<br />

values being calculated from<br />

where you start. SAVE it with<br />

SAVE "print" CODE (start<br />

address), 300<br />

and remember to CLEAR (start<br />

address — 1 ) before you LOAD<br />

it back in as part of a program.<br />

One word of warning. Don't<br />

answer the "start address" prompt<br />

with a value greater than<br />

65067 or you'll lose the end of<br />

the routine!<br />

UDCS<br />

That's relocation solved, now<br />

for problem two. Run Program<br />

2, but first replace the "H" with<br />

a user-defined graphic (UDG for<br />

short). Any letter will do. What<br />

appears on screen? Nothing.<br />

The reason for this is again<br />

found in Table A. Look at the line<br />

of op code at address 32272.<br />

The number in brackets is the<br />

address of a system variable<br />

called CHARS. This holds a two<br />

byte (number) value — normally<br />

0 and 60 — which tells the computer<br />

where to look (in the ROM)<br />

for the character set — the 8x8<br />

patterns of pixels which make<br />

up each of the characters. The<br />

Print machine code looks<br />

through this set to find a match<br />

for the character you want<br />

printed. As you design the UDGs<br />

no match is found — hence the<br />

blank screen.<br />

The solution to the problem is<br />

quite simple (although it took me<br />

some time to fathom.) What you<br />

have to do is convince the<br />

machine that the character set it<br />

wants to look at is not in the<br />

ROM but up in the UDG area.<br />

Look at Program 4. Line 5 is<br />

there simply to make the UDGs<br />

different from normal capitals<br />

(by underlining top and bottom).<br />

In line 10 "ABCDE" must be<br />

entered in Graphics mode,<br />

although they won't appear<br />

underlined until after the program<br />

is RUN. The POKEs following<br />

are the key. They tell the<br />

machine that the set it wants<br />

begins at address 64216<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!