Table of Contents

REMOTE

Source Code

00100 *******************************
00110 *            REMOTE           *
00120 *A REMOTE TERMINAL DRIVER     *
00130 *FOR THE COCO                 *
00140 *DAN DOWNARD  RAINBOW  11/83  *
00150 *******************************
00160         ORG     $3F00
00165 *EQUATES FOR ROM AND RAM ADDRESSES
00170 IHOOK   EQU     $016A
00180 OHOOK   EQU     $0167
00190 PIA     EQU     $FF22
00200 POLCAT  EQU     $A000
00210 RSOUT   EQU     $8E0C
00220 BAUD    EQU     $E6
00225 BAUDR   EQU     $C9
00230 DEV     EQU     $6F
00240 FLAG    EQU     $70
00245 *INITIALIZE RAM HOOKS
00250 START   LDA     #BAUDR
00260         STA     <BAUD
00270         LDX     1+OHOOK
00280         STX     1+ORET2,PCR
00290         LDX     1+IHOOK
00300         STX     1+IRET2,PCR
00310         LDA     #$7E
00320         STA     IHOOK
00330         STA     OHOOK
00340         LEAX    OUT,PCR
00350         STX     1+OHOOK
00360         LEAX    IN,PCR
00370         STX     1+IHOOK
00380 RET     RTS
00385 *OUTPUT CHARACTER IF DEV=0
00386 *INSERT LINE FEEDS TO REMOTE DEVICE
00387 *USE ROM SUBROUTINE
00390 OUT     PSHS    A
00400         TST     <DEV
00410         BNE     ORET1
00420         CMPA    #$0D
00430         BNE     REMOUT
00440         LDA     #$0A
00450         JSR     RSOUT
00460         LDA     #$0D
00470 REMOUT  JSR     RSOUT
00480 ORET1   PULS    A
00490 ORET2   JMP     RET
00495 *INPUT FROM KEYBOARD OR RS-232
00496 *IF DEV=0
00497 *USE RSIN FOR REMOTE INPUT
00500 IN      CLR     <FLAG
00510         TST     <DEV
00520         BNE     IRET2
00530         LEAS    2,S
00540         PSHS    B,CC,X
00550 IN1     JSR     [POLCAT]
00560         BEQ     REMIN
00570         BRA     IRET1
00575 *CHECK FOR REMOTE INPUT
00580 REMIN   LDB     $FF22
00590         RORB
00600         BCS     IN1
00605 *RS-232 INPUT ROUTINE
00606 *BYTE INTO A REGISTER
00610 RSIN    BSR     HALF
00620         LDB     #1
00630         PSHS    B
00640         CLRA
00650 RSIN1   BSR     FULL
00660         LDB     PIA
00670         RORB
00680         BCC     RSIN2
00690         ORA     0,S
00700 RSIN2   ASL     0,S
00710         BCC     RSIN1
00720         LEAS    1,S
00730         ANDA    #$7F
00740 IRET1   PULS    B,CC,X,PC
00750 IRET2   JMP     RET
00755 *BAUD RATE DELAYS
00760 FULL    BSR     HALF
00770 HALF    PSHS    A
00780         LDA     <BAUD
00790 HALF1   BRN     HALF1
00800         DECA
00810         BNE     HALF1
00820         PULS    PC,A
00830         END     START

Assembly Listing

             00001         00100 *******************************
             00002         00110 *            REMOTE           *
             00003         00120 *A REMOTE TERMINAL DRIVER     *
             00004         00130 *FOR THE COCO                 *
             00005         00140 *DAN DOWNARD  RAINBOW  11/83  *
             00006         00150 *******************************
             00007         00160         ORG     $3F00
             00008         00165 *EQUATES FOR ROM AND RAM ADDRESSES
     016A    00009         00170 IHOOK   EQU     $016A
     0167    00010         00180 OHOOK   EQU     $0167
     FF22    00011         00190 PIA     EQU     $FF22
     A000    00012         00200 POLCAT  EQU     $A000
     8E0C    00013         00210 RSOUT   EQU     $8E0C
     00E6    00014         00220 BAUD    EQU     $E6
     00C9    00015         00225 BAUDR   EQU     $C9
     006F    00016         00230 DEV     EQU     $6F
     0070    00017         00240 FLAG    EQU     $70
             00018         00245 *INITIALIZE RAM HOOKS
3F00 86C9    00019         00250 START   LDA     #BAUDR
3F02 97E6    00020         00260         STA     <BAUD
3F04 BE0168  00021         00270         LDX     1+OHOOK
3F07 AF8D003500022         00280         STX     1+ORET2,PCR
3F0B BE016B  00023         00290         LDX     1+IHOOK
3F0E AF8D006400024         00300         STX     1+IRET2,PCR
3F12 867E    00025         00310         LDA     #$7E
3F14 B7016A  00026         00320         STA     IHOOK
3F17 B70167  00027         00330         STA     OHOOK
3F1A 308D000B00028         00340         LEAX    OUT,PCR
3F1E BF0168  00029         00350         STX     1+OHOOK
3F21 308D001D00030         00360         LEAX    IN,PCR
3F25 BF016B  00031         00370         STX     1+IHOOK
3F28 39      00032         00380 RET     RTS
             00033         00385 *OUTPUT CHARACTER IF DEV=0
             00034         00386 *INSERT LINE FEEDS TO REMOTE DEVICE
             00035         00387 *USE ROM SUBROUTINE
3F29 3402    00036         00390 OUT     PSHS    A
3F2B 0D6F    00037         00400         TST     <DEV
3F2D 260E    00038         00410         BNE     ORET1
3F2F 810D    00039         00420         CMPA    #$0D
3F31 2607    00040         00430         BNE     REMOUT
3F33 860A    00041         00440         LDA     #$0A
3F35 BD8E0C  00042         00450         JSR     RSOUT
3F38 860D    00043         00460         LDA     #$0D
3F3A BD8E0C  00044         00470 REMOUT  JSR     RSOUT
3F3D 3502    00045         00480 ORET1   PULS    A
3F3F 7E3F28  00046         00490 ORET2   JMP     RET
             00047         00495 *INPUT FROM KEYBOARD OR RS-232
             00048         00496 *IF DEV=0
             00049         00497 *USE RSIN FOR REMOTE INPUT
3F42 0F70    00050         00500 IN      CLR     <FLAG
3F44 0D6F    00051         00510         TST     <DEV
3F46 262D    00052         00520         BNE     IRET2
3F48 3262    00053         00530         LEAS    2,S
3F4A 3415    00054         00540         PSHS    B,CC,X
3F4C AD9FA00000055         00550 IN1     JSR     [POLCAT]
3F50 2702    00056         00560         BEQ     REMIN
3F52 201F    00057         00570         BRA     IRET1
             00058         00575 *CHECK FOR REMOTE INPUT
3F54 F6FF22  00059         00580 REMIN   LDB     $FF22
3F57 56      00060         00590         RORB
3F58 25F2    00061         00600         BCS     IN1
             00062         00605 *RS-232 INPUT ROUTINE
             00063         00606 *BYTE INTO A REGISTER
3F5A 8D1E    00064         00610 RSIN    BSR     HALF
3F5C C601    00065         00620         LDB     #1
3F5E 3404    00066         00630         PSHS    B
3F60 4F      00067         00640         CLRA
3F61 8D15    00068         00650 RSIN1   BSR     FULL
3F63 F6FF22  00069         00660         LDB     PIA
3F66 56      00070         00670         RORB
3F67 2402    00071         00680         BCC     RSIN2
3F69 AA60    00072         00690         ORA     0,S
3F6B 6860    00073         00700 RSIN2   ASL     0,S
3F6D 24F2    00074         00710         BCC     RSIN1
3F6F 3261    00075         00720         LEAS    1,S
3F71 847F    00076         00730         ANDA    #$7F
3F73 3595    00077         00740 IRET1   PULS    B,CC,X,PC
3F75 7E3F28  00078         00750 IRET2   JMP     RET
             00079         00755 *BAUD RATE DELAYS
3F78 8D00    00080         00760 FULL    BSR     HALF
3F7A 3402    00081         00770 HALF    PSHS    A
3F7C 96E6    00082         00780         LDA     <BAUD
3F7E 21FE    00083         00790 HALF1   BRN     HALF1
3F80 4A      00084         00800         DECA
3F81 26FB    00085         00810         BNE     HALF1
3F83 3582    00086         00820         PULS    PC,A
             00087         00830         END     START