Автор: Barry Lowry(Код)
Языки:
Английский
Формат:
Картридж Microdrive
Требования:
ZX Spectrum 48K
Ссылки:
Страница на ZXArt
Страница на Spectrum Computing
Скриншоты:
Языки:
Формат:
Требования:
Ссылки:
Скриншоты:
Expand your attributes
======================
Popular Computer Weekly (27/09/1984) - Page 26
Two new keywords for Interface 1 by B J Lowry
Any Spectrum Owner with Interface One will probably be aware of the Basic Extension facility with extra system variable Vector (Address 23735 and 23736) offers. Most Spectrum owners will also be aware of the lack of Basic commands to manipulate the attribute file, which at present can only be accessed via Pokes (hardly and aid to debugging) or via a Print statement which can be inconvenient.
The following machine code program is a way of using Basic Extension to give a greater flexibility when manipulating the attribute file from Basic. The program defines two new Basic keywords:
a) ATTR *I,P,C,L
Where I Ink (In the range 0-7)
P Paper (In the range 0-7)
C Column (In the range (0-31)
L Line (In the range 0-23)
b) ATTR @ L,C,N,F,I,P
Where L Start line (In the range 0-23)
C Start column (In the range 0-31)
N No of Characters per line (In the range 1-32)
F No of Lines duration (In the range 1-24)
I Ink (Range as before)
P Paper (Range as before)
Keyword a will allow the user to specify the ink and paper of any screen position (including the bottom status lines), without destroying anything printed there previously, by specifying the position in column/line co-ordinates.
Keyword b allows the user to define a rectangle of colour, of width N and length F that begins on Line L at Column C without destroying anything printed previously.
Although both new statements only act on ink and paper, the user can incorporate flash and bright. This is done by preceding the new statement with a line that sets the flash/bright on, and then immediately after the new statement inserting a line that sets flash/bright off. The user is able to do this because both commands access the system variable attr p (address 23693) and pick up the flash and bright bits.
The machine code is 413 bytes long, and I have located it above Ramtop at starting address FC6C (hex), 64860 (dec). For those of you without an assembler, I have included a decimal dump of the code and a small Basic program to load this routine.
Enter the Basic loader and run it. The computer will ask you to input each number from the dump from left to right, eg, starting with 215 then 24 then 0 then 254 then 171. After five numbers the computer will display the sum (in the case of the first line 644). If the number agrees with the sum for that line on the printout, the line is ok and you can enter the next line. After entering the code it should be saved before testing. Save as: Save "Name" Code 64860,413. After saving the code, New the computer and enter Lines 10 and 11 of the example program. Run these lines, Load back the code saved previously, then enter the rest of the example program. When entered the program can be run by typing Goto 14, and pressing Enter.
One thing must be noted when using the new command. Do not forget to change the system variable vector before trying to use them. Simply Poke 23735,92 and Poke 23736,253 at the beginning of any program which uses the commands, and don't forget to load the code.
Transcribed by Peter R Jones (18/09/2022)
======================
Popular Computer Weekly (27/09/1984) - Page 26
Two new keywords for Interface 1 by B J Lowry
Any Spectrum Owner with Interface One will probably be aware of the Basic Extension facility with extra system variable Vector (Address 23735 and 23736) offers. Most Spectrum owners will also be aware of the lack of Basic commands to manipulate the attribute file, which at present can only be accessed via Pokes (hardly and aid to debugging) or via a Print statement which can be inconvenient.
The following machine code program is a way of using Basic Extension to give a greater flexibility when manipulating the attribute file from Basic. The program defines two new Basic keywords:
a) ATTR *I,P,C,L
Where I Ink (In the range 0-7)
P Paper (In the range 0-7)
C Column (In the range (0-31)
L Line (In the range 0-23)
b) ATTR @ L,C,N,F,I,P
Where L Start line (In the range 0-23)
C Start column (In the range 0-31)
N No of Characters per line (In the range 1-32)
F No of Lines duration (In the range 1-24)
I Ink (Range as before)
P Paper (Range as before)
Keyword a will allow the user to specify the ink and paper of any screen position (including the bottom status lines), without destroying anything printed there previously, by specifying the position in column/line co-ordinates.
Keyword b allows the user to define a rectangle of colour, of width N and length F that begins on Line L at Column C without destroying anything printed previously.
Although both new statements only act on ink and paper, the user can incorporate flash and bright. This is done by preceding the new statement with a line that sets the flash/bright on, and then immediately after the new statement inserting a line that sets flash/bright off. The user is able to do this because both commands access the system variable attr p (address 23693) and pick up the flash and bright bits.
The machine code is 413 bytes long, and I have located it above Ramtop at starting address FC6C (hex), 64860 (dec). For those of you without an assembler, I have included a decimal dump of the code and a small Basic program to load this routine.
Enter the Basic loader and run it. The computer will ask you to input each number from the dump from left to right, eg, starting with 215 then 24 then 0 then 254 then 171. After five numbers the computer will display the sum (in the case of the first line 644). If the number agrees with the sum for that line on the printout, the line is ok and you can enter the next line. After entering the code it should be saved before testing. Save as: Save "Name" Code 64860,413. After saving the code, New the computer and enter Lines 10 and 11 of the example program. Run these lines, Load back the code saved previously, then enter the rest of the example program. When entered the program can be run by typing Goto 14, and pressing Enter.
One thing must be noted when using the new command. Do not forget to change the system variable vector before trying to use them. Simply Poke 23735,92 and Poke 23736,253 at the beginning of any program which uses the commands, and don't forget to load the code.
Transcribed by Peter R Jones (18/09/2022)