Personal Computer News


Stringing Along With A Spectrum Screen

 
Published in Personal Computer News #079

Stringing Along With A Spectrum Screen

The Spectrum has a SCREEN$(Y,X) function which is very useful in games. Unfortunately, it cannot normally detect user-defined graphics characters.

The subroutine listed below overcomes this drawback but only works if the pointer to the start of the UDGs has not been tampered with.

Before calling the routine, Y and X should be set to the position to be checked. The C variable is used within the routine, so its contents should not be relied upon. On exit, the character at the position Y,X is in C$.

  10 REM line 10
  20 'Basic program revealer
  30 MODE 2
  40 address = 368
  50 bytes = PEEK(address)
  60 line.no = PEEK(address + 2)
  70 PRINT address;line.no;
  80 FOR count = 4 TO bytes - 2
  90 conts = PEEK(address + count)
 100 IF conts > 31 AND conts < 128 THEN PRINT CHR$(conts); ELSE PRINT conts;
 110 NEXT
 120 PRINT
 130 address = address + bytes
 140 GOTO 50

No name or address supplied

Anon