1010 *S.BIG.BUFF 1030 *---------------------------- 1040 *BIG BUFF terminal program for 1050 *Apple II+ with Micro Modem II 1060 * 1070 * 1080 * 1090 *(C) 1984 Jan G. Eugenides 1100 *11601 N.W. 1B ST. 1110 *Pembroke Pines FL 33026 1120 *305-431-6892 1130 *12/5/84 1140 *---------------------------- 1150 *CONFIGURED FOR SLOT 2 1160 *---------------------------- 1170 * 1180 PTR .EQ $06 1190 CR1 .EQ $C0A6 1200 CR2 .EQ $C0A5 modem control port 1210 CHAR .EQ $77B temp char storage 1220 RDKEY .EQ $FD0C 1230 OUTA .EQ $C202 1240 COUT .EQ $FDED 1250 HOME .EQ $FC5B 1260 GETLN .EQ $FD6F 1270 BUFF .EQ $200 1280 VTAB .EQ $FC22 ??? $F022 1290 CH .EQ $24 cursor horiz. position 1300 BASL .EQ $2B 1310 STORADV .EQ $FBF0 1320 CV .EQ $25 cursor vert. position 1330 PROMPT .EQ $33 1340 CURLIN .EQ $35 1350 LANG .EQ $AAB6 1360 IPBUF .EQ $9600 input buffer 1370 IPTR .EQ $F9 1380 CAPFLAG .EQ $FB 1390 TEMP .EQ $FC 1400 LNGTH .EQ $19 1410 INVFLG .EQ $32 1420 WAIT .EQ $FCA8 1430 VTEMP .EQ $09 1440 HTEMP .EQ $0A 1450 CTR .EQ $0B 1460 * 1470 .OR $9100 1480 .TF BIG.BUFF 1490 1500 *---------------------------- 1510 *Initialization 1520 *---------------------------- 1530 LDA #$0 1540 STA CAPFLAG Capture flag 1550 JSR HOME Clear screen 1560 LDA #4 1570 STA $22 1580 LDA #$00 1590 STA PTR Set buffer top to $800 1600 LDA #$08 1610 STA PTR+1 1620 *---------------------------- 1630 *Allow direct file commands 1640 *---------------------------- 1650 LDA #$40 1660 STA LANG 1670 STA CURLIN+1 1680 LDA #$06 1690 STA PROMPT 1700 *---------------------------- 1710 LDA #$40 1720 STA $D8 Set errflag so that errors 1730 LDA #CLOSER go to file close routine 1740 STA #9D5A 1750 LDA /CLOSER 1760 STA $9D5B 1770 1780 *---------------------------- 1790 *Print header 1800 *---------------------------- 1810 JSR PRINT 1820 .AS -"BIG BUFF TERM PROGRAM---BUFFER TOP=$" 1830 .HS 8D8D 1840 .AS -" CAPTURE: ON (C)JAN G. EUGENIDES" 1850 .HS 8D00 1860 LDA #$03 1870 STA CV VTAB 3 1880 JSR VTAB 1890 JSR PRINT 1900 .AS -"--------------------" 1902 .AS -"--------------------" 1904 .HS 00 1910 * ----------------------------------- 1920 Get number to call 1930 * ----------------------------------- 1940 START JSR DiALUP 1950 JSR CDETECT Check for carrier 1960 JSR PRINT 1970 .HS 8D84 1980 .AS - IN#2" Turn on modem for input 1990 .HS 8D00 2000 * ----------------------------------- 2010 *n Main program loop 2020 * ----------------------------------- 2030 * 2040 MLOOP JSR SHOWBUF Show buffer filling up 2050 LDA CR1 Modem register 2070 ROR Test bit one on 2080 BCC KEYIN If not, no charater at input port 2090 JSR CHARIN Get character from input port 2100 * ----------------------------------- 2110 * Lowercase keyboard input 2120 * ----------------------------------- 2130 * 2140 KEYIN LDA $C000 Keyboard input 2150 BPL MLOOP No key has been pressed 2160 NOP Leave space 2170 NOP for lowercase 2180 NOP Routine 2190 GOTONE BIT $C010 Clear strobe 2200 JMP OUTPUT Skip lowercase routine - configure program pokes 2210 * new code in here for lowercase action 2220 * ----------------------------------- 2230 *Lowercase routine first part 2240 *gets poked in by configure program 2250 * ----------------------------------- 2260 CPX #$80 Pressed? 2270 BCS LOWER No, so lower case 2280 CMP #$DD 2290 BEQ CAP Capital M 2300 CMP #$DE 2310 BEQ CAP Capital N 2320 CMP #$C0 2330 BEQ CAPP Capital P 2340 OUTPUT JMP BACK 2350 LOWER CMP #$C0 Set range from A-Z only 2360 BCC OUTPUT Z, no conversion 2390 CLC 2400 ADC #$20 Convert to lower case 2410 JMP OUTPUT 2420 CAP SEC Special case "N" and "M" 2430 SBC #$10 2440 JMP OUTPUT 2450 CAPP CLC Special case "P" 2460 ADC #$10 2470 JMP OUTPUT 2480 BACK CMP #$88 2490 BNE ESC 2500 JSR #$FC10 2510 LDA #$A0 2520 JSR CDUT 2530 LDA #$88 2340 ESC CMP #$9B Escape? 2550 BEQ ESCAPE Yes-go to command handler routine 2560 STA CHAR Set up to output car thru modem 2570 JSR OUTA Output character 2580 JMP MLOOP 2590 CHARIN LDA CR1+1 Get char from input port 2600 ORA #$80 Set high bit 2610 CMP #$8A Linefeed? 2620 BEQ SKIP Skip linefeed 2630 STA TEMP Save character 2640 LDA CAPFLAG Check capture states an or off 2650 BEQ STORE 2660 LDA TEMP Retrieve character 2670 CMP #$E0 Lowercase? 2680 BCC DISP No-display on screen 2690 SEC 2700 SBC #$20 Convert to upper 2710 DISP JSR COUT Display 2720 RTS 2730 STORE LDA TEMP Retrieve character 2740 LDY #$00 2750 STA (PTR),Y Save character in buffer 2760 LDA TEMP 2770 CMP #$E0 Lowercase? 2780 BCC CHARTN No-display on screen 2790 SEC 2800 SBC #$20 Convert to upper case 2810 CHARTN JSR COUT Print to screen 2820 INC PTR Increment buffer counter 2830 LDA PTR 2840 BNE SKIP 2850 INC PTR+1 2860 SKIP LDA PTR+1 2870 CMP #$90 Buffer full? 2880 BCS FULL Yes-print warning 2890 RTS Done 2900 * ----------------------------------- 2910 *Full buffer routine 2920 * ----------------------------------- 2930 * 2940 FULL LDA #$3F Inverse 2950 STA INVFLG 2960 JSR PRINT 2970 .AS -"BUFFER FULL" 2980 .HS 8D00 2990 LDA #$FF Normal 3000 STA INVFLB 3010 JSR XOFF Stop incoming data 3020 RTS 3030 *----------------------------------- 3040 * END X-OFF 3030 *----------------------------------- 3060 XOFF LDA #$93 Ctrl-S 3070 STA CHAR 3080 JSR OUTA Send X-OFF 3090 RTS 3100 *----------------------------------- 3110 *SEND X-ON 3120 *----------------------------------- 3130 XON LDA #$91 Ctrl-Q 3140 STA CHAR 3130 JSR OUTA Send X-ON 3160 RTS 3170 *----------------------------------- 3180 *Escape command handler 3190 *----------------------------------- 3200 * 3210 ESCAPE JSR XOFF 3220 LDA $C000 Get keyboard input 3230 BPL ESCAPE 3240 BIT $C010 3250 CMP #$DA "Z" 3260 BEQ ZBUFF Zero buffer 3270 CMP #$D8 "X" 3280 BEQ HANGUP Hangup phone 3290 CMP #$D3 "S" 3300 BEQ SAVE Save buffer 3310 CMP #$C2 "B" 3320 BEQ BTOGL Toggle capture 3330 CMP #$D5 "U" 3340 BEQ UPLOAD upload files 3350 CMP #$C3 "C" 3360 BEQ CAT Catalog disk 3370 CMP #$D2 "R" 3380 BEQ REV Reiew buffer 3390 JSR XON 3400 JMP MLOOP 3410 UPLOAD JMP READ 3420 CAT JMP CATALOG 3430 REV JMP REVIEW 3440 SAVE JUMP SAVEBUF 3450 *----------------------------------- 3460 *Zero buffer-reset pointer to $800 3470 *----------------------------------- 3480 * 3490 ZBUFF LDA #$00 3500 STA PTR 3510 LDA #$08 3520 STA PTR+1 3530 JSR XON 3540 JMP MLOOP 3550 *----------------------------------- 3560 *Hangup phone 3570 *----------------------------------- 3580 HANGUP LDA #$80 3590 STA #$D8 3600 LDA #$00 3610 STA CR2 Hang up modem 3620 JMP SAVEBUF Last chance 3630 *----------------------------------- 3640 *Toggle capture on and off 3650 *----------------------------------- 3660 BTOGL LDA CAPFLAG Get flag 3670 CMP #$FF Off? 3680 BNE CAPOFF No-turn it off 3690 LDA #$00 Turn it on 3700 JSR CURS Save cursor position 3710 JSR PRINT Change indicator 3720 .AS -" ON" 3730 .HS 00 3740 JSR RCURS Restore cursor position 3750 JMP C0NT1 3760 CAPOFF LDA #$FF Turn it off 3770 JSR CURS Save cursor position 3780 JSR PRINT Change indicator to "OFF" 3790 .AS -"OFF" 3800 .HS 00 3810 JSR RCURS Restore cursor position 3820 C0NT1 JSR XON 3830 JMP MLOOP 3840 * 3850 *----------------------------------- 3860 CURS STA CAPFLAG 3870 LDA CV Vertical cursor position 3880 STA VTEMP 3890 LDA CH Horizontal cursor position 3900 STA HTEMP 3910 LDA #$02 VTAB 2 3920 STA CV 3930 JSR VTAB 3940 LDA #13 HTAB 13 3950 STA CH 3960 RTS 3970 * ----------------------------------- 3980 RCURS LDA HTEMP 3990 STA CH 4000 LDA VTEMP 4010 STA CV 4020 JSR VTAB 4030 RTS 4060 *-------------------------------- 4070 *Save buffer to text file 4080 *---------------------------- 4090 SAVEBUF LDA #$8D 4100 JSP COUT Start new line 4110 LDA #00 Set beginning of file to $800 4120 STA LNGTH 4130 LDA #$0B 4140 STA LNGTH+1 4150 ** 4160 * 4170 LDA #$3F 4180 STA INVFLG Inverse 4190 JSR PRINT 4200 .AS -"FILE NAME TO SAVE?" 4210 .HS 8D00 4220 LDA #$FF Normal 4230 STA INVFLG 4240 ** 4250 JSR INPUT Get file name 4260 * 4270 JSR PRINT 42B0 .HS 8D8D84 (CR)+CTRL-D 4290 .AS -"OPEN" 4300 .HS 00 4310 LDY #$00 4320 BLOOP LDA (IPTR),Y Get file name from IPBUFFER 4330 BEQ BL1 Zero means end of name 4340 JSR COUT 4350 INY 4360 JMP BLOOP 4370 BL1 JSR PRINT 4380 .HS 8D84 4390 .AS -"WRITE" 4400 .HS 00 4410 LDY #$00 4420 BLOOP2 LDA (IPTR),Y 4430 BEQ BL2 4440 JSR COUT 4450 INY 4460 JMP BLOOP2 4470 BL2 JSR PRINT 4480 .HS 8D00 4490 * 4500 4510 LDY #0 4520 STLOOP LDA (LNGTH),Y Write buffer to disk 4530 JSR COUT 4540 INC LNGTH 4550 BNE .2 4560 INC LNGTH+1 4570 .2 LDA LNGTH 4580 CMP PTR 4590 LDA LNGTH+1 4600 SBC PTR+1 4610 BCC STLOOP 4620 * 4630 LDA #$8D put at end 4640 JSR COUT 4650 * 4660 JMP CLOSER 4670 *--------------------------------- 4680 .Catalog disk 4690 *--------------------------------- 4700 CATALOG JSR PRINT 4710 .HS 8D8D84 4720 .AS -"CATALOG" 4730 .HS 8D00 4740 JSR XON 4750 JMP MLOOP 4760 * 4770 *--------------------------------- 47B0 *Review 4790 *--------------------------------- 4800 REVIEW LDA #$8D 4810 JSR COUT Start new line 4820 LDA #0 Set beginning of file to $800 4830 STA LNGTH 4840 LDA #$08 4850 STA LNGTH+1 4860 * 4870 LDY #0 4880 RWLOOP LDA (LNGTH),Y Get character from buffer 4890 CHP #$E0 Lowercase? 4900 BCC .3 No 4910 SEC 4920 SBC #$20 Yes-convert to upper case 4930 .3 JSR COUT Display on screen 4940 LDA #40 4950 JSR WAIT Slow t down a bit 4960 INC LNGTH Increment pointer 4970 BNE .2 4980 INC LNGTH+1 4990 .2 LDA LNGTH 5000 CMP PTR 5010 LDA LNGTH+1 5020 SBC PTR+1 5030 BCC RWLOOP More to go 5040 * 5050 JSR XON 5060 JMP MLOOP 5070 *--------------------------------- 5080 *Show buffer high address * 5090 *--------------------------------- 5100 SHOWBUF LDA PTR 5110 AND #$0F Get low nibble 5120 CMP #$0A Convert to screen ascii 5130 BCS LETTER1 It's A-F 5140 ORA #$D0 It's 0-9 5150 STA $427 5160 JMP HINIB1 5170 LETTER1 ORA #$D0 Convert to screen ascii 5180 CLC 5190 ADC #7 5200 STA $427 Print to screen 5210 HINIB1 LDA PTR Repeat for hi nibble 5220 LSR 5230 LSR 5240 LSR 5250 LSR 5260 CMP #$0A 5270 BCS LETTER2 5280 ORA #$80 5290 STA $426 5300 JMP H1NIB2 5310 LETTER2 ORA #$B0 5320 CLC 5330 ADC #7 5340 STA $426 5350 * 5360 5370 HINIB2 LDA PTR+1 Now do the hi byte of the address 5380 AND #$0F Get low nibble 5390 CMP #$0A 5400 BCS LETTER3 5410 ORA #$B0 5420 STA $425 5430 JMP HINIB3 Repeat for hi nibble 5440 LETTER3 ORA #$B0 5450 CLC 5460 ADC #7 5470 STA $425 5480 HINIB3 LDA PTR+1 5490 LSR 5500 LSR 5510 LSR 5520 LSR 5530 CMP #$0A 5540 BCS LETTER4 5550 ORA #$B0 5560 STA $424 5570 JMP HINIB4 5580 LETTER4 ORA #$B0 5590 CLC 5600 ADC #7 5610 STA $424 5620 H1NIB4 RTS 5660 * ----------------------------------- 5670 * 5680 *Get number and dial phone * 5690 * ----------------------------------- 5700 5710 DIALUP JSR HOME 5720 P1 LDA #$05 5730 STA CV VTAB 5 5740 JSR VTAB 5750 JSR PRINT 5760 .AS -"DIAL WHAT NUMBER?" 5770 .HS 00 5780 JSR INPUT GET NUMBER 5790 JSR PHNUM 5800 RTS 5810 5820 *--------------------------------- 5822 *INPUT 5824 *--------------------------------- 5826 INPUT LDA #$80 5830 STA $D8 5840 LDA #IPBUF Store at $9600 5850 STA IPTR 5860 LDA /IPBUF 5870 STA IPTR+1 5880 LDX #0 5890 JSR GETLN Get a line of input 5900 TXA X holds length of line 5910 BEQ EXIT If , just exit 5920 TAY 5930 LDA #$0 5940 STA BUFF,Y Put zero at end of line 5950 .2 LDA BUFF,Y 5960 STA (IPTR),Y Move to $9600 for safekeeping 5970 DEY 5980 CPY #$FF 5990 BNE .2 6000 RTS 6010 EXIT LDA CR1 On line? 6020 CMP #128 6030 BCC .1 6040 LDA #$40 6050 STA #D8 6060 PLA 6070 PLA 6080 JSR XON 6090 JMP MLOOP 6100 .1 JMP $3D0 Return to basic if off-line 6220 * ----------------------------------- 6230 *DIAL PHONE 6240 * ----------------------------------- 6250 PHNUM JSR PRINT 6260 .HS 8D8D84 6270 .AS -"PR#2" Turn on modem for output 6280 .HS 8D9100 Print ctrl-Q 6290 LDY #0 Print phone number 6300 NUMOUT LDA (IPTR),Y 6310 BEQ DONE 6320 JSR COUT 6330 INY 6340 JMP NUMOUT 6350 DONE JSR PRINT Print CTRLD"PR#0" 6360 .HS 8D8DB4 6370 .AS -"PR#0" Turn off modem for output 6380 .HS 8D00 6390 RTS 6400 *--------------------------------- 6402 * Print routine 6404 * 6406 *--------------------------------- 6408 PRINT PLA Get address 6410 STA CTR 6412 PLA 6414 STA CTR+1 6416 LDY #$01 6418 .1 LDA (CTR),Y Get data to print 6420 BEQ .3 Zero? then end 6422 JSR COUT Print character 6424 INY 6426 BNE .1 6430 .3 CLC Return to next instruction after data 6440 TYA 6450 ADC CTR 6460 STA CTR 6470 LDA CTR+1 6480 ADC #$00 6490 PHA 6500 LDA CTR 6510 PHA 6520 RTS 6530 *--------------------------------- 6540 *Read text file 6550 *--------------------------------- 6560 READ 6580 LDA #$8D 6590 JSR COUT 6600 * 6610 LDA #$3F 6620 STA INVFL3 INVERSE 6630 JSR PRINT 6640 .AS -"FILE NAME TO UPLOAD?" 6650 .HS 8D00 6660 LDA #$FF Normal 6670 STA INVFLG 6680 ** 6690 JSR INPUT Get file nane 6700 JSR PRINT 6710 .HS 8D8D84 6720 .AS -"OPEN" 6730 .HS 00 6740 LDY #$00 6750 RBLOOP LDA (IPTR),Y 6760 BEQ RL1 6770 JSR COUT 6780 INY 6790 JMP RBLOOP 6800 RL1 JSR PRINT 6810 .HS 8D8D84 6820 .AS -"READ" 6830 .HS 00 6840 LDY #$00 6850 RBLOP2 LDA (IPTR),Y 6860 BEQ RDLOOP 6870 JSR COUT 6880 INY 6890 JMP RBLOP2 6900 RDLOOP JSR PRINT 6910 .HS 8D00 6920 JMP IO Get data 6930 CLOSER JSR PRINT 6940 .HS 8D04 6950 .AS -"CLOSE" Close files 6960 .HS 8D00 6990 LDA #$3F 7000 STA INVFLG 7010 JSR PRINT 7020 .HS 8D 7030 .AS -/DONE/ 7040 .HS 8D00 7050 LDA #$FF 7060 STA INVFLG 7070 JSR XON 7080 JMP MLOOP 7090 *--------------------------------- 7100 *Input from file 7110 *--------------------------------- 7120 IO JSR XON 7130 * 7140 IOLOOP JSR RDKEY Get character 7150 STA CHAR Set up to ouput from modem 7160 ORA #$80 Insure normal video 7170 .1 JSR STORADV Display on screen 7180 LDA CHAR 7190 BEQ IODONE Zero? then done 7200 JSR OUTA Output character to modem 7210 LDA #$70 ????? 7220 JSR WAIT Slow down to 300 Baud 7230 JMP IOLOOP Do it again 7310 * ----------------------------------- 7320 CDETECT 7330 LDA CR1 7340 AND #4 check bit 4 7350 BNE NOCAR 7360 RTS Carrier detected, resume 7370 NOCAR JMP START No carrier, start over