Apple Assembly Line Volume 1 -- Issue 10 July, 1981 In This Issue... ---------------- The Lower Case Apple . . . . . . . . . . . . . . . . . . . 2 Screen Printer . . . . . . . . . . . . . . . . . . . . . . 5 Restoring Clobbered Page 3 Pointers . . . . . . . . . . . . 9 Corrections to Variable Cross Reference Program . . . . . . 10 Step-Trace Utility . . . . . . . . . . . . . . . . . . . . 11 Renewing Subscriptions ---------------------- The 4-digit number in the upper right corner of your mailing label is the expiration date of your subscription. The first two digits are the year, and the last two digits are the month of the last issue you have paid for. If your label says "8109", now is the time to renew to be sure of uninterrupted service. Beneath Apple DOS ----------------- In the few weeks since I sent out last month's AAL, with the review of this book, I have sold 85 copies! My apologies if your shipment was delayed a little. Last Friday at 3:30 a shipment of 100 copies arrived; at 5:45 I took about 50 packages to the UPS station. Another 10 went out by mail this morning. A lot of work, but a lot of fun too. I expect another shipment of 100 copies about the time you get this newsletter, so go ahead and order your copy if you have been waiting. Using Firmware Card in Slot 4 ----------------------------- Are you tired of getting "LANGUAGE NOT AVAILABLE" errors? Do you have a 16K RAM card, and also an old Firmware Card with one of the Basics on it? You can patch DOS to allow the Firmware Card to be put in slot 4, and still keep your RAM card in slot 0 for Pascal or whatever. With DOS loaded, type CALL -151 to get to the monitor; then patch: *A5B8:C0 *A5C0:C1 Get back into Basic (3D0G), and INIT a disk with the modified DOS. If you have a disk utility program, you can patch the DOS image on an existing disk the same way. (From Michael W. Sanders, Decatur, GA) The Lower Case Apple..........................Bob Matzinger ----------------------------------------------------------- It occured to me that, since I have installed a Dan Paymar Lower Case Adapter, there ought to be a better way to generate lower case characters than by RAM-resident software. The major problem is the F8 ROM. The CAPTST routine at $FD7E will not allow lower case characters to pass; if they get this far, they will be converted to upper case here. I cannot figure a reason for this routine, since the Apple will not generate lower case codes in the first place! Anyway, there are only two ways I know of to avoid CAPTST: write my own line input subroutine (I want to avoid that!), or burn a new F8 ROM. All I would have to change is one lousy byte, at $FD83, from $DF to $FF. Seems like a waste of time...or is it? Maybe, since I am going to the trouble of burning the ROM, I can add some routines to extend the capabilities of my keyboard to access ALL of the ASCII characters. That is what I decided to do. But! How do I make it transparent? It should not interfere with or be interfered by any program or language. Within the monitor routines there are two that are not used; in fact, they were removed when the Autostart ROM came about. These are the 16-bit multiply and divide routines from $FB60 through $FBC0. I can insert my new code there. I also need two RAM locations for shift lock and case flags. I must find two locations that would probably NOT be used by any other program. There are a number of location in zero page that are not normally used; the bottom of the stack and the top of the input buffer might not be used. Checking that out, however, I have found that most other people have thought of these locations already. Where can I go? I found two bytes not used by anyone, inside the screen buffer area. They are reserved for the board plugged into slot 6, which in my case is the disk controller. The disk controller does not use locations $077E and $07FE ($0778+slot# and $07F8+slot#). More than likely, nobody would use these locations (at least that is what I am gambling on). Now that I have room for flags, the next step is to write the routines to fit between $FB60 and $FBC0, and set up calls to them. I have to be careful not to change any other routines. Here is what I want: 1. Upon RESET, initialize to upper case. 2. Have a shift and shift-lock routine. 3. Be able to enter all ASCII characters. When RESET is pressed, or when the Apple is turned on, the 6502 microprocessor executes a JMP indirect using the address at $FFFC and $FFFD. This effectively jumps to $FF59 in the monitor which is the reset routine. The reset routine calls INIT at $FB2F, which in turn ends with a JMP VTAB at $FB5D. If I change that last instruction, it can fall into the area formerly occupied by the multiply routine. How convenient! I'll put the code there to set upper case mode. Most programs written for use with the Paymar Adapter have their own input routines. The monitor routines are not used. Therefore my changes should have no adverse effect on these programs. The next thing I had to decide was which control-keys to use for shift, shift-lock, and the three characters not available from the standard Apple keyboard. I didn't want to use the escape key, since it is used by so many other programs. I finally chose these: control-Z: Shift and Shift-lock control-K: Left bracket and Left Brace control-L: Backslash and Vertical Bar control-O: Underline and Rubout One final problem to overcome is passing the cursor over a lower case character. The cursor, in the normal monitor, makes the character under the cursor flash. A lower case character will flash in upper case, so you cannot tell whether it was lower or upper case without moving the cursor. I decided to make lower case characters under the cursor display as inverse upper case, rather than flashing. That way there is no doubt. Now how do we get the patches into the ROM? First we need to get a copy of the standard ROM code into RAM. Then assemble the patches, and save the patched copy on disk. From inside the S-C Assembler II, type: :$6800=NEXT =QUIT A X Y P S / 3770 .HS 00 3780 *--------------------------------- 3790 * PRINT PC AND DASH 3800 *--------------------------------- 3810 PRINT.PC 3820 LDX MON.PC 3830 LDY MON.PC+1 3840 JMP MON.PRYX3 3850 *--------------------------------- 3860 * DISASSEMBLE NEXT OPCODE 3870 *--------------------------------- 3880 DISASSEMBLE 3890 JSR PRINT.PC 3900 LDY #0 3910 LDA (MON.PC),Y GET OPCODE 3920 JSR MON.INSDS2 3930 PHA SAVE MNEMONIC TABLE INDEX 3940 .1 LDA (MON.PC),Y 3950 JSR MON.PRBYTE 3960 LDX #1 PRINT ONE BLANK 3970 .2 JSR MON.PRBL2 3980 CPY MON.LENGTH 3990 INY 4000 BCC .1 4010 LDX #3 4020 CPY #3 4030 BCC .2 4040 PLA GET MNEMONIC TABLE INDEX 4050 TAY 4060 LDA MNEML,Y 4070 STA LMNEM 4080 LDA MNEMH,Y 4090 STA RMNEM 4100 .3 LDA #0 4110 LDY #5 4120 .4 ASL RMNEM SHIFT 5 BITS OF CHARACTER INTO A 4130 ROL LMNEM 4140 ROL 4150 DEY 4160 BNE .4 4170 ADC #$BF 4180 JSR MON.COUT 4190 DEX 4200 BNE .3 4210 LDA #$A0 PRINT BLANK 4220 JSR MON.COUT 4230 JSR MON.PRADDR 4240 JSR MON.CLREOL 4250 JSR MON.CROUT 4260 LDY #39 4270 .5 LDA BOTTOM.LINE,Y 4280 AND #$3F 4290 STA BASE.LINE24,Y 4300 DEY 4310 BPL .5 4320 DEC MON.CV 4330 RTS 4340 *--------------------------------- 4350 SAVE.AREA 4360 SAVE.S .BS 1 4370 SAVE.P .BS 1 4380 SAVE.Y .BS 1 4390 SAVE.X .BS 1 4400 SAVE.A .BS 1 4410 *--------------------------------- 4420 * TEST PROGRAM 4430 *--------------------------------- 4440 TEST JSR TEST1 4450 BRK 4460 TEST1 JSR TEST2 4470 TEST2 JSR TEST3 4480 TEST3 RTS