Автор: T.A. Bratley
Год: 1985
Издатели: Your Computer
Производитель: Your Computer
Языки:
Английский
Формат:
TZX лента
Требования:
ZX Spectrum 16K,
ZX Spectrum 48K
Ссылки:
Страница на ZXArt
Страница на World Of Spectrum
Страница на Spectrum Computing
Скриншоты:
Год: 1985
Издатели: Your Computer
Производитель: Your Computer
Языки:
Формат:
Требования:
Ссылки:
Скриншоты:
Scrolls
* T A Bratley * Grimsby, South Humberside
Here is a set of eight versatile, easily used and interes-
ting scroll routines which can bve added to your Basic
programs to clear all or part of a screen in one of 8
directions.
The routines scroll one character square at a time in the
following compass directions: N, S, E, W, NE, NW, SE, SW.
The old character square is blanked out and its attribute
is replaced with one of your choice.
The difference between these and previously published
routines is that any section of the screen can be scrolled
in any direction and leave any colour attribute behind.
This includes the bottom two lines.
There are only five parameters you have to supply in
order to define the section of the screen to be scrolled,
and below are the addresses you need to poke for both 16K
and 48K machines (16 in brackets).
POKE 64000 (31232), h (1 to 24)
POKE 64001 (31233), w (1 to 32)
POKE 64002 (31234), r (0 to 23)
POKE 64003 (31235), c (0 to 31)
POKE 64004 (31236), a (attribute)
This defines a box of height h, width w, with a top left-
hand corner at r,c (where r and c are the normal PRINT AT
coordinates), to be replaced with a new attribute a.
Height and width must always be at least one because a
box must have two dimensions, and care must be taken to see
that the box does not exceed the screen limits.
The attribute is calculated in the usual way by multi-
plying the paper colour by eight and then adding the ink
value. If bright is required, add a further 64 to the total
so far, and finally if flash is required add a further 128.
After poking the values for machine code routines to use
you will then have to select whichever scroll direction you
require.
The table below gives you the addresses for both
machines:
DIRECTION 16K 48K
N 31241 64009
S 31253 64021
E 31265 64033
W 31277 64045
NE 31289 64057
SE 31303 64071
SW 31317 64085
NW 31331 64099
These routines use the values r,c (row, column) to calcu-
late the actual memory address of the top left-hand corner
of the box and its corresponding attribute address. They
then take the width and height of the box and use the lower
of these two values as a loop counter within the machine
code to repeatedly call the appropriate routines until the
box is cleared. This saves using a For Next loop in Basic
and therefore speeds up the scrolling. However, this has a
slight disadvantage in that very small boxes are scrolled
off so fast that the effect is lost.
Because the machine code is not relocatable I have given
two decimal dumps
[ ...and this is where it goes wrong. The dumps given in
the article were hexdumps. The loader described was
absent; in its place was the usual Your Computer hex-
loader. There is talk of a demonstration program, which
is also missing. I've provided one of my own on the TZX,
which works on both 16K and 48K - it checks RAMTOP to
decide which code to load and which addresses to poke
and call.
Only a few of the sentences after this actually apply to
the code as published in the article; they are: ]
To load the code CLEAR 31231 for a 16K or 63999 for a 48K,
then LOAD ""CODE. [...] A good idea is to set up the
parameters of the box first, then load a screen$ from a
commercial game and finally run a routine to clear part of
the screen. This gives you a very interesting effect,
especially the diagonal scrolls.
* T A Bratley * Grimsby, South Humberside
Here is a set of eight versatile, easily used and interes-
ting scroll routines which can bve added to your Basic
programs to clear all or part of a screen in one of 8
directions.
The routines scroll one character square at a time in the
following compass directions: N, S, E, W, NE, NW, SE, SW.
The old character square is blanked out and its attribute
is replaced with one of your choice.
The difference between these and previously published
routines is that any section of the screen can be scrolled
in any direction and leave any colour attribute behind.
This includes the bottom two lines.
There are only five parameters you have to supply in
order to define the section of the screen to be scrolled,
and below are the addresses you need to poke for both 16K
and 48K machines (16 in brackets).
POKE 64000 (31232), h (1 to 24)
POKE 64001 (31233), w (1 to 32)
POKE 64002 (31234), r (0 to 23)
POKE 64003 (31235), c (0 to 31)
POKE 64004 (31236), a (attribute)
This defines a box of height h, width w, with a top left-
hand corner at r,c (where r and c are the normal PRINT AT
coordinates), to be replaced with a new attribute a.
Height and width must always be at least one because a
box must have two dimensions, and care must be taken to see
that the box does not exceed the screen limits.
The attribute is calculated in the usual way by multi-
plying the paper colour by eight and then adding the ink
value. If bright is required, add a further 64 to the total
so far, and finally if flash is required add a further 128.
After poking the values for machine code routines to use
you will then have to select whichever scroll direction you
require.
The table below gives you the addresses for both
machines:
DIRECTION 16K 48K
N 31241 64009
S 31253 64021
E 31265 64033
W 31277 64045
NE 31289 64057
SE 31303 64071
SW 31317 64085
NW 31331 64099
These routines use the values r,c (row, column) to calcu-
late the actual memory address of the top left-hand corner
of the box and its corresponding attribute address. They
then take the width and height of the box and use the lower
of these two values as a loop counter within the machine
code to repeatedly call the appropriate routines until the
box is cleared. This saves using a For Next loop in Basic
and therefore speeds up the scrolling. However, this has a
slight disadvantage in that very small boxes are scrolled
off so fast that the effect is lost.
Because the machine code is not relocatable I have given
two decimal dumps
[ ...and this is where it goes wrong. The dumps given in
the article were hexdumps. The loader described was
absent; in its place was the usual Your Computer hex-
loader. There is talk of a demonstration program, which
is also missing. I've provided one of my own on the TZX,
which works on both 16K and 48K - it checks RAMTOP to
decide which code to load and which addresses to poke
and call.
Only a few of the sentences after this actually apply to
the code as published in the article; they are: ]
To load the code CLEAR 31231 for a 16K or 63999 for a 48K,
then LOAD ""CODE. [...] A good idea is to set up the
parameters of the box first, then load a screen$ from a
commercial game and finally run a routine to clear part of
the screen. This gives you a very interesting effect,
especially the diagonal scrolls.