Have you ever written a
program in Graphics 1 with a text window and wished that you could have
the space of Graphics 0 but still use the window? Well, you can.
Normally changing the screen means altering the display list but as the
window itself is in Graphics 0 I would consider this an impossibility.
You may be able to use the vertical blank interrupt but you would need
to know machine language. The answer is really very simple. When you
call a Graphics mode the machine must store either 24 lines of Graphics
0, 4 lines for the window of another mode or 0 lines for a Graphics mode
+ 16 (i.e. no text window). Location 703 is used for this purpose. All
you need to do is call GR.0 and POKE 703,4. When the display handle
reads 703 it is forced to open device #6 as with any other mode with a
window. This means you PRINT#6; to the top 20 lines and PRINT to the
bottom 4 lines. Didn't I say it was simple?
If you have little memory
to spare and want to try out Player Missile Graphics in single-line
resolution do you realise that you can only use five players (four plus
the combined missiles) maximum which means 5 x 256 bytes? As you need to
start on a 2K boundary, you may think that there are 3 x 256 bytes
wasted. Not at all. You can still store other bits of data here if you
wish but, be warned, BASIC A+ uses this technique so be careful if you
use this language.
Have you ever wished to
add a utility to your program but cannot as both the utility and the
program use the page 6 storage area? The answer is simple. Set one or
both routines up as a string. For example
10
FOR 1=0 TO 30: READ DATA: POKE 1536+I,DATA: NEXT I
20
X=USR(1536)
uses page 6. Try the
following
10
DIM A$(31): READ DATA: A$(I,I)=CHR$(DATA) : NEXT I
20
X=USR(ADR(A$))
Although you have used extra
memory through the DIM statement the routine itself has now become
relocatable, i.e. the computer protects the string itself and will move
it around in memory to do so.
Alternatively you could use
10 DIM A$(31): FOR 1=0
TO 30: READ DATA: POKE ADR(A$)+I,DATA: NEXT I
The FOR/NEXT- READ
statements will take up a lot of space, so I suggest that once you have
the string defined, delete the above lines and use the following after
having RUN line 10 only.
PRINT
A$ (in direct mode)
Use
the editing features to make 19 spaces before the printed string and
add
10
DIM A$(31): A$"
After
the printed A$ add - ":X=USR(ADR(A$))
You can now delete all the
DATA and save yourself some memory.
By taking this one stage
further you could use X=USR(ADR('" assembly codes ""))
and save eight bytes by not using a string. By coincidence you can
also save eight bytes each time you use POKE instead of SETCOLOR and,
finally, using cursor control characters takes one byte each instead of
the massive 15 for a POSITION statement.
I am now finding this
column hard to compile. Not because I have nothing to write about but
mainly because I am limited to one page and the articles I would like to
include would take more room. What I need now is readers suggestions,
either to me or the Editor, for page size articles. With your help I can
explore the areas YOU wish to read about.
You will be reading this
in September and, hopefully, I should be in sunny Florida in October. If
you want any questions answered directly please write as soon as
possible, otherwise you may have to wait many weeks for a reply.
Finally, I hope that by
the time you read this I will have my last(?) FIRST STEPS TUTORIAL tape
out. I hope that they have been of some benefit and, although they were
designed for the beginner, I hope that the tapes included something for
the more advanced.
Write to Mark at BAUG
SOFTWARE, P.O. BOX 10, BELFAST, BT10 0DB
top