| ★ APPLICATIONS ★ DIVERS ★ PRINTING MODES (POPULAR COMPUTING WEEKLY) ★ |
PRINTING MODES![]() | PRINTING MODES: PART 2![]() |
Following on from last week, this week brings another short machine code utility to enhance your hard copy on the 464. Run the Basic program, and save the code generated using Save "Printer", B, (your address), 100. The routine is activated by a direct call to the start address, and deactivated using start address plus two. In order to cue your text for double-width, or underlining, you have to choose a couple of characters, which the routine can recognise and send the appropriate codes to the printer. I have picked "—" (shifted zero), to signal underline and "t" (the exponent arrow under the £ sign), to signal double-width. Of course, using these characters in this way means that neither of them can be printed, but they are not symbols which often turn up in the ordinary course of typing. If you specially want them in your text, you could change them for something else; their positions are marked in the programs. If you want to load this routine piggyback with Easi-Amsword, you must beware that the word-processor uses some blocks of upper memory for its own purposes. Here is a rule of thumb Load sequence, which avoids the pitfalls.
This program uses Escape sequences which toggle on and off. That is, they switch on, using "SEC,(code), 1" and switch off with "ESC,(code),0". The Epson code for "underline" is 27,45,1: to switch it off, use 27,45,0. There is a similar one for "double-width": 27,57,1 for on; 27,57,0 for off. Most dot-matrix printers have options like this and you should have no trouble making your own modifications. For the benefit of people interested in machine language, who have a disassembler, you will discover a routine which finds its own address. It's based on ideas suggested by Toni Baker. She was working with a Spectrum, but the Amstrad uses a similar system of Interrupts for keyboard scanning etc, and it works just as well. Here's how it goes: First, give a Halt instruction; this makes the program wait until the next Interrupt. When this occurs, it goes off to do its key-scanning bit, which it treats as a sub-routine. This means that it puts the address of the next byte (DEC SP) on the stack. On return from the sub-routine, it POPs the stack address into the program counter and goes ahead. But it's a mistake to think that POPping the address gets rid of it. All that has happened is that the stack pointer has been incremented twice. The number is still there in RAM. So all you have to do is send back the stack pointer with two "DEC SP"s - and then POP the address into HL (which automatically restores the correct stack address). Copy this address into the IX register and after that, some simple arithmetic can calculate the relative addresses, needed for the program, and put in place using offsets in the IX Register. PopularComputingWeekly860213 |
| ![]() |
|