Значок ресурса

Print 64

Нет прав на скачивание
Автор: Kai Weber
Год: 1984
Издатели: ZX Computing
Языки: 🇬🇧 Английский
Формат: 📼 TAP лента
Требования: 🖥️ ZX Spectrum 48K

Ссылки:
Страница на ZXArt
Страница на World Of Spectrum
Страница на Spectrum Computing

Скриншоты:
Print64.gif


PRINT 64


by Kai Weber





Get 64 characters per line rather than the normal 32 on your Spectrum.





One of the many disadvantages of the Spectrum, as opposed to, say,


Auntie Beeb's micro, is its very low character resolution - 32 by 24.


Anyone who has endeavoured to write a word processor on a humble


Spectrum will appreciate that it is very difficult to overcome the


character problem, unless you happen to have software that can


generate at the very least 64 characters per line. You may well be


asking where you can get such software from - well, look no further!


The machine code routine in this article will allow you, by a very


slight alteration to your print statements, to output to the screen


all the normal characters but at 64 per line instead of the normal 32.


Both sizes of text can be mixed on the screen at the same time.





I was inspired to write the program after reading Mike Lord's article


"Spectrum Streams" (ZX Computing August/September '83) in which he


stated that the values in the system variable STRMS were in fact


pointers pointing to the Channel Information area of RAM. So I thought


to myself, why not make stream four point to a new printing


sub-routine instead of the usual error routine by poking locations


23568/9 (see "Spectrum Streams").





Getting in print





Fig.1 is a disassembly of the 48K version of Print 64. Basically, what


the routine does is to first change the Spectrum character set by


altering location 23606/7 CHAR$ into something which is a little more


suited to 64 characters per line ie. each character occupies only the


first four bits. Next, it will perform one of two operations. If the


current print position (in 64 character mode) is an even number or


zero it will simply print the character in the A register at the


position. However, if the current x-axis print position is an odd


number the character in the A register is first rotated right four


times before being printed OVER 1 at the current position (OVER 1 is


used because it means the character does not instantly delete the


previously printed character). Finally, the character set is made to


point back to the data held in ROM before returning. Sounds


complicated? It is!





The machine code and character data occupy just over 1K of memory


directly beneath the UDG's - 1215 bytes to be exact. To use the


routine first type in listing one. You should then proceed to input


all the numbers in Fig.2a if you own a 16K or 2b if you own a 48K. The


computer automatically compiles a checksum and when you have finished


typing will inform you of any errors. If you do make any errors, I am


afraid you will just have to enter all the numbers again. When


everything is correct, the computer will inform you in 64 character


mode and then save the code to tape. If you experience difficulty


reading the text at first try altering the tuning of your TV set very


slightly.





Using the routine





The only alterations needed to a


simple print statement are:


1. The addition of '#4;' just before the text to be printed.


2. The addition of the seemingly useless squiggle (located under the


'A' key) just before the text. (Don't worry! This character does not


actually get printed.)





So therefore, PRINT "text" would become PRINT #4;"(squiggle)text"





What it cannot do





For complicated reasons, the program cannot handle keywords or UDGs.


It simply subtracts 128 from them to turn them into ordinary


characters. It is also incapable of dealing with control characters,


so therefore any FLASH, OVER, AT, TAB, INK etc, statements should be


placed before the # character, ie.





PRINT INK 1; AT 12,12;#4;"(squiggle)text"





N.B: The numbers after AT and TAB are still expressed as values


between 0 & 31 - the first character to be printed always appears on


the left hand side of the current 32 character mode print position.





Unfortunately, for some reason unknown to me, the routine does not


like the CHR$ statement. It simply refuses to print anything if you


type, say,





PRINT #4;"(squiggle)";CHR$ 65





which should display an 'A'.





Get scrolling





If the screen fills up and the computer prompts "scroll?", you will


probably notice that the message is made up of small characters, but


with a space between each. if you stop the computer scrolling, all


output appears like the message. To restore normality, type PRINT #4;""





I said earlier that you needed a squiggle character at the beginning


of the text but this is not necessary if the previous print statement


was terminated by a semi-colon and you wish the next piece of text to


buffer onto the previous. For example, suppose you wanted to print out


the character set from space to copyright symbol, you would use a


program something like this:





10 PRINT #4;"(squiggle)";: REM


the first print statement should


always contain a squiggle.


20 FOR F=32 TO 127


30 LET A$=CHR$ F: PRINT #4;A$;


40 NEXT F





The only reason for putting the character to be printed into the


variable A$ is that, as mentioned previously, the routine does not


like the CHR$ statement. Generally speaking, upper case output tends


to look neater than lower case, which, in my opinion, often looks


straggly.





When using the routine in your own programs, If you do not already


have the machine code on board, you should place this line at the very


beginning:





CLEAR USR "A"-1215: LOAD ""CODE: LOAD ""CODE





You should then save both blocks of code directly after your program.


To save the code, first load it in using the above commands and then


simply copy both lines with 'SAVE' in them from the BASIC program in


listing 1.





Text editor





Listing two is a very simple text editor which sorts out text so that


no word overlaps from one line to another. The program assumes that


you have the machine code on board. When run, it will ask you to input


some text which should be more than 64 characters in length to see


what the routine does. Once entered, the program will display the


edited text at 64 characters per line. The only way to get it onto


printer paper is to use the COPY command - LPRINT #4 does not work


properly. Listing two is not meant to be a full-blooded word


processor, just an example of how the routine can be used - a word


processor may well feature in another article sometime in the future.


As can be seen from this article the potential applications of using


different streams are very powerful.





Print 64 has very obvious advantages for people wishing to use their


Spectrums for serious uses rather than ridding the complete and utter


universe of Klingons or similar alien menace. Your only problem now


for word processing on a Spectrum is getting a decent keyboard, a


decent printer, a printer interface and last but not least the actual


word processor software - watch this space!





Fig.1 - Disassembled listing


----------------------------


65180 FE7E CP 126


65182 C8 RET Z


65183 A7 AND A


65184 CBBF RES 7,A


65186 CDB2FE CALL weber


65189 CDF409 CALL PRINT-OUT


65192 CDB9FE CALL sincl


65195 21C1FE LD HL,65217


65198 2256FF LD (65366),HL


65201 C9 RET


65202 219AFA weber LD HL,64154


65205 22365C LD (23606),HL


65208 C9 RET


65209 21003C sincl LD HL,15360


65212 22365C LD (23606),HL


65215 C9 RET


65216 00 NOP


65217 FE7E CP 126


65219 CAEBFE JP Z,strms


65222 A7 AND A


65223 CBBF RES 7,A


65225 CDB2FE CALL weber


65228 CD12FF CALL sethl


65231 CDF2FE CALL rotr


65234 CD21FF CALL dfcc


65237 F5 PUSH AF


65238 CD38FF CALL over1


65241 F1 POP AF


65242 F5 PUSH AF


65243 CDF409 CALL PRINT-OUT


65246 CD44FF CALL over


65249 F1 POP AF


65250 CD12FF CALL sethl


65253 CD02FF CALL rotl


65256 CDB9FE CALL sincl


65259 219CFE strms LD HL,65180


65262 2256FF LD (65366),HL


65265 C9 RET


65266 0E08 rotr LD C,008


65268 F5 PUSH AF


65269 0604 loop LD B,004


65271 CB1E il RR (HL)


65273 A7 AND A


65274 10FB DJNZ il


65276 23 INC HL


65277 0D DEC C


65278 20F5 JR NZ,loop


65280 F1 POP AF


65281 C9 RET


65282 0E08 rotl LD C,008


65284 F5 PUSH AF


65285 0604 loop2 LD B,004


65287 CB16 il2 RL (HL)


65289 A7 AND A


65290 10FB DJNZ il2


65292 23 INC HL


65293 0D DEC C


65294 20F5 JR NZ,loop2


65296 F1 POP AF


65297 C9 RET


65298 F5 sethl PUSH AF


65299 D5 PUSH DE


65300 110800 LD DE,00008


65303 47 LD B,A


65304 219AFA LD HL,64154


65307 19 loop3 ADD HL,DE


65308 10FD DJNZ loop3


65310 D1 POP DE


65311 F1 POP AF


65312 C9 RET


65313 21845C dfcc LD HL,23684


65316 35 DEC (HL)


65317 F5 PUSH AF


65318 ED4B885C LD BC,(23688)


65322 0C INC C


65323 ED43885C LD (23688),BC


65327 ED4B885C LD BC,(23688)


65331 2A845C LD HL,(23684)


65334 F1 POP AF


65335 C9 RET


65336 3A915C over1 LD A,(23697)


65339 32B05C LD (23728),A


65342 21915C LD HL,23697


65345 CBC6 SET 0,(HL)


65347 C9 RET


65348 3AB05C over LD A,(23728)


65351 32915C LD (23697),A


65354 C9 RET
Автор
Verter_bot
Загрузки
0
Просмотры
1
Расширение
zip
Размер
1.4 КБ
Хэш
0ff03a69fdc8ce051aaca76cddf083cc
Первый выпуск
Последнее обновление

Оценки

0.00 звезд(ы) 0 оценок
Назад
Вверх