1000 * ----------------------------------- 1010 *Main program loop 1020 * ----------------------------------- 1030 * 1040 MLOOP JSR SHOWBUF Show buffer filling up 1050 LDA CR1 Modem register 1060 ROR Test for bit one on 1070 BCC KEYIN If not, no character at input port 1080 JSR CHARIN Get character from input port 1090 * ----------------------------------- 1100 *Lowercase keyboard input 1110 * ----------------------------------- 1120 * 1130 KEYIN LDA $C000 Keyboard input 1140 BMI GOTONE A key has been pressed - go get it 1150 JMP MLOOP No key has been pressed 1160 GOTONE BIT $C010 Clear strobe 1170 LDX $C063 Game port 1180 CPX #$80 Shift key pressed? 1190 BCS LOWER No, so lower case 1200 CMP #$DD 1210 BEQ CAP Capital M 1220 CMP #$DE 1230 BEQ CAP Capital N 1240 CMP #$C0 1250 BEQ CAPP Capital P 1260 OUTPUT JMP BACK 1270 LOWER CMP #$C0 Set range from A-Z only 1280 BCC OUTPUT Z, no conversion 1310 CLC 1320 ADC #$¢20 Convert to lower case 1330 JMP OUTPUT 1340 CAP SEC Special cases "N" AND "M" 1350 SBC #$10 1360 JMP OUTPUT 1370 CAPP CLC Special case "P" 1380 ADC #$10 1390 JMP OUTPUT 1400 BACK CMP #$88 Back arrow? 1410 BNE ESC No, check for command 1420 JSR #$FC10 Backspace one 1430 LDA #$A0 Print a space 1440 JSR COUT 1450 LDA #$88 Restore accumulator 1460 ESC CMP #$9B Escape? 1470 BEQ ESCAPE Yes-go to command handler routine 1480 STA CHAR Set up to output char thru modem 1490 JSR OUTA Output character 1500 JMP MLOOP 1510 CHARIN LDA CR1+1 Get char from input port 1520 ORA #$80 Set high bit 1530 CMP #$8A Linefeed? 1540 BEQ SKIP Skip linefeeds 1550 STA TEMP Save character 1560 LDA CAPFLAG Check capture status on or off 1570 BEQ STORE 1580 LDA TEMP Retrieve character 1590 CMP #$E0 Lowercase? 1600 BCC DISP No-display on screen 1610 SEC 1620 SBC #$20 Convert to upper 1630 DISP JSR COUT Display 1640 RTS 1650 STORE LDA TEMP Retrieve character 1660 LDY #$00 1670 STA (PTR),Y Save character in buffer 1680 LDA TEMP 1690 CMP #$E0 Lower case? 1700 BCC CHARIN No-display on screen 1710 SEC 1720 SBC #$20 Convtrt to upper case 1730 CHARTN JSR COUT Print to screen 1740 INC PTR Increment buffer counter 1750 LDA PTR 1760 BNE SKIP 1770 INC PTR+1 1780 SKIP LDA PTR+1 1790 CMP #$90 Buffer full? 1800 BCS FULL Yes-print warning 1810 RTS Done