home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
luxorabc80
/
kerm7.asm
< prev
next >
Wrap
Assembly Source File
|
1990-07-07
|
15KB
|
704 lines
; KERM7.ASM
; Anders Franz`n <5258>
; Stockholm 1987-09-24
; Uppdaterad 1990-01-07 J. Westman <5074>
; Skicka SP i respons paketet om ingen REPT
; Uppdaterad 1990-01-08 J. Westman <5074>
; Ingen REPT om ej valt, i s{ndning
;Spara mottagna parametrar
RPARM CALL RDEFAULT
LD A,(IX+24) L{ngd packet
AND A
RETZ L{ngd = 0
LD HL,BUFF3 Mottaget data
LD A,(HL)
INC HL
CP 33
JRC RPM1
SUB 32
LD (IX+11),A MAXL
RPM1 LD A,(IX+24)
CP 2
RETC L{ngd < 2
LD A,(HL)
INC HL
CP 33
JRC RPM2
SUB 32
LD (IX+12),A TIME
RPM2 LD A,(IX+24)
CP 3
RETC L{ngd < 3
LD A,(HL)
INC HL
CP 33
JRC RPM3
SUB 32
LD (IX+13),A NPAD
RPM3 LD A,(IX+24)
CP 4
RETC L{ngd < 4
LD A,(HL)
INC HL
CP 33
JRC RPM4
XOR 64
LD (IX+14),A PADC
RPM4 LD A,(IX+24)
CP 5
RETC L{ngd < 5
LD A,(HL)
INC HL
CP 33
JRC RPM5
SUB 32
LD (IX+15),A EOL
RPM5 LD A,(IX+24)
CP 6
RETC L{ngd < 6
LD A,(HL)
INC HL
CP 33
JRC RPM6
LD (IX+16),A QCTL
RPM6 LD A,(IX+24)
CP 7
RETC L{ngd < 7
LD A,(HL)
INC HL
CP 33
JRC RPM8
CP "Y"
JRZ RPM7
CP 127
JRNC RPM8
CP 96
JRNC RPM7
CP 63
JRNC RPM8
RPM7 LD (IX+17),A QBIN
RPM8 LD A,(IX+24)
CP 8
RETC L{ngd < 8
LD A,(HL)
INC HL
SUB 48
CP 1
JRC RPM9
CP 3
JRNC RPM9
LD (IX+18),A CHKT
RPM9 LD A,(IX+24)
CP 9
RETC L{ngd < 9
LD A,(HL)
CP 33
RETC
CP 127
RETNC
CP 96
JRNC RPM10
CP 63
RETNC
RPM10 LD (IX+19),A REPT
RET
;Defaultparametrar "andra sidan"
RDEFAULT LD (IX+11),80 Default MAXL
LD (IX+12),5 TIME
LD (IX+13),0 NPAD
LD (IX+14),0 PADC
LD (IX+15),13 EOL
LD (IX+16),"#" QCTL
LD (IX+17),0 QBIN
LD (IX+18),1 CHKT
LD (IX+19),0 REPT
RET
;S{tt egna parametrar
SPARM LD HL,BUFF4
LD A,(IX+1) Maxl{ngd packet
ADD 32
LD (HL),A
INC HL
LD A,(IX+2) Timeout
ADD 32
LD (HL),A
INC HL
LD A,(IX+3) Antal PAD-tkn
ADD 32
LD (HL),A
INC HL
LD A,(IX+4) PAD-tkn
XOR 64
LD (HL),A
INC HL
LD A,(IX+5) EOL-tkn
ADD 32
LD (HL),A
INC HL
LD A,(IX+6) QCTL-tkn
LD (HL),A
INC HL
LD A,(IX+7) QBIN-tkn
LD (HL),A
INC HL
LD A,(IX+8) Checksummetyp
ADD 48
LD (HL),A
INC HL
LD A,(IX+9) REPEAT-tkn
OR A
JR NZ,SPA1
LD A,32
SPA1 LD (HL),A
RET
;Ta emot en packet. Om checksumman {r
;fel s{nds negativt svar. Carry vid
;retur betyder att nytt f|rs|k ska
;g|ras.
GPACK CALL RPACK Ta emot packet
RETNC Inget fel
BIT 3,(IX+0)
RETNZ ESCAPE
LD A,(IX+20)
DEC A
SCF
RETZ Sista f|rs|ket
LD A,(IX+23)
LD (IX+22),A Packetnr
LD (IX+24),0 L{ngd data
LD (IX+25),"N"
CALL SPACK Negativt svar
SCF
RET
;Ta emot en packet
RPACK CALL RCHAR
RETC Time out!
LD BC,(MARKER)
CP C
JRNZ RPACK V{nta p} SOH...
LD HL,0 Checksumma
CALL RCHAR
RETC Time out!
SUB 34
SUB (IX+8)
LD (IX+24),A L{ngd p} data
CALL RCHAR
RETC Time out!
SUB 32
LD (IX+22),A Packetnr
CALL RCHAR
RETC Time out
LD (IX+25),A Typ av packet
CP "S"
JRNZ RPK1
LD A,(IX+8)
CP 1
JRZ RPK1
INC (IX+24)
RPK1 LD A,(DEBUG)
DEC A
LD A,"R"
CALLZ DEBRUB
LD A,(IX+24) L{ngd data
AND A
JRZ RPK3 Inget data
LD B,A
LD DE,BUFF3
RPK2 PUSH DE
PUSH BC
CALL RCHARD H{mta datatkn
POP BC
POP DE
RETC Time out!
LD (DE),A Spara tecken
INC DE
DJNZ RPK2
RPK3 PUSH HL
CALL RCHAR H{mta checksumma
POP HL
RETC Time out!
LD E,A
LD A,(IX+25)
CP "S"
JRZ RPK4 Packettyp S
LD A,(IX+8)
CP 1
JRZ RPK4 CH-typ 1
PUSH HL Annars CH-typ 2
PUSH DE
CALL RCHAR
POP DE
POP HL
RETC Time out!
LD D,A
LD A,L
AND 63
ADD 32
CP D
SCF
RETNZ Fel checksumma
LD A,H
RLC L
RLA
RLC L
RLA A = HL/64
AND 63
ADD 32
CP E
JRZ RPK5
SCF
RET Fel checksumma
RPK4 LD A,L
AND 192
RLCA
RLCA A = A/64
AND 3 A = A/64
ADD L
AND 63
ADD 32
CP E
SCF
RETNZ Fel checksumma
RPK5 CALL RCHAR EOL
RET
RCHARD CALL RCHAR
RETC
LD A,(DEBUG)
DEC A
LD A,E
RETNZ
LD (SLASK),A
CALL DEBCHAR
LD A,(SLASK)
AND A
RET
;V{nta p} tecken fr}n V24
RCHAR LD B,50
LD A,(253:240)
LD C,A
RCH1 LD A,(253:240)
CP C
JRZ RCH2 Klocka ej r|rd
LD C,A
DJNZ RCH2 Klocka p} 50Hz
LD B,50
XOR A
DEC (IX+21) Minska tid kvar
SCF
RETZ Maxtid
RCH2 INP 58
AND 2
SCF
RETNZ B{rv}g saknas!
CALL EVBRYT Kolla CTRL-X/Z
BIT 3,(IX+0)
SCF
RETNZ ESCAPE nedtryckt
PUSH HL
CALL MOTTAG Mottaget tkn?
POP HL
JRNC RCH1 Nej, v{nta...
LD E,A
LD D,0
LD A,(PARITET)
AND A
JRZ RCH3 Paritet NONE
RES 7,E Sl{ck paritet
RCH3 ADD HL,DE \ka checksumma
LD A,(DEBUG)
CP 2
LD A,E
CALLZ DITTO
AND A Clear carry
RET
;S{nd iv{g en packet
SPACK LD A,(PAUSE)
AND A
JRZ SPK4 Ingen paus
LD HL,253:240
LD C,A Antal tiondelar
SPK1 LD B,5
SPK2 LD A,(HL)
SPK3 CP (HL)
JRZ SPK3 V{nta 1/50 sek
DJNZ SPK2 V{nta 1/10 sek
DEC C
JRNZ SPK1 Fler tiondelar
SPK4 LD A,(DEBUG)
DEC A
LD A,"S"
CALLZ DEBRUB
LD A,(IX+13) Antal PAD-tkn
AND A
JRZ SPK6 Inga PAD-tkn
LD B,A
SPK5 LD A,(IX+14) PAD-tkn
CALL SCHAR
RETC B{rv}g saknas
DJNZ SPK5
SPK6 LD A,(MARKER)
CALL SCHAR SOH
RETC
LD A,(IX+24)
ADD (IX+8)
ADD 34
LD L,A
LD H,0
CALL SCHAR L{ngd data
RETC
LD A,(IX+22) Nummer p} packet
ADD 32
LD E,A
LD D,0
ADD HL,DE
CALL SCHAR
RETC
LD A,(IX+25) Typ av packet
LD E,A
LD D,0
ADD HL,DE
CALL SCHAR
RETC
LD A,(IX+24) L{ngd data
AND A
JRZ SPK8 Inget data
LD B,A
LD DE,BUFF4 Pekar p} data
SPK7 LD A,(DE)
INC DE
PUSH DE
LD E,A
LD D,0
ADD HL,DE R{kna checksumma
POP DE
CALL SCHARD S{nd datatkn
RETC
DJNZ SPK7
SPK8 LD A,(IX+25)
CP "S"
JRZ SPK9 Packettyp S
LD A,(IX+8)
CP 1
JRZ SPK9 CH-typ 1
LD A,H
LD H,L
RLC L
RLA
RLC L
RLA A = HL/64
AND 63
ADD 32
CALL SCHAR
RETC
LD A,H
AND 63
ADD 32
CALL SCHAR
JRNC SPK10
RET
SPK9 LD A,L
AND 192
RLCA
RLCA
AND 3 A = A/64
ADD L
AND 63
ADD 32
CALL SCHAR
RETC
SPK10 LD A,(IX+15) EOL-tkn
CALL SCHAR
RET
DEBRUB LD (DEB2),A
PUSH HL
LD HL,DEB1
LD BC,DEB3-DEB1
CALL 0:11 Debug-rubrik
LD A,12
LD (253:244),A
LD A,(IX+25) Typ av packet
LD (SLASK),A
LD HL,SLASK
LD BC,1
CALL 0:11
LD A,19
LD (253:244),A
LD L,(IX+22) Nummer p} packet
LD H,0
CALL SKRIVTAL
LD A,30
LD (253:244),A
LD L,(IX+24) L{ngd data
LD H,0
CALL SKRIVTAL
CALL 7:66
POP HL
RET
DEB1 DB 13,10
DEB2 DM "Spack type= "
DM "seq= length="
DEB3
DEBCHAR PUSH HL
PUSH DE
PUSH BC
LD HL,SLASK
LD BC,1
CALL 0:11
POP BC
POP DE
POP HL
RET
SCHARD LD (SLASK),A
LD A,(DEBUG)
DEC A
CALLZ DEBCHAR
LD A,(SLASK)
CALL SCHAR
RET
SCHAR LD C,A
LD A,(DEBUG)
CP 2
LD A,C
CALLZ DITTO
CALL S[ND
RETC
CALL EVBRYT
AND A
RET
DITTO PUSH HL
LD HL,(DITTO1)
LD (HL),A
INC HL
LD (DITTO1),HL
POP HL
RET
DITTO1 DW 135:0
EVBRYT PUSH HL
PUSH BC
CALL TAN Polla tangenter
CALL CHECKTAN H{mta ev tangent
POP BC
POP HL
RETNC Ingen tangent
BIT 5,(IX+0)
RETZ Ignorera!
CP 24
JRZ EVB1 CTRL-X
CP 26
RETNZ Ej CTRL-Z
EVB1 ADD 64
LD (IX+37),A
LD (EVB3),A
LD A,32
LD (253:244),A
PUSH HL
PUSH DE
PUSH BC
LD HL,EVB2
LD BC,EVB4-EVB2
CALL WRITE
POP BC
POP DE
POP HL
RET
EVB2 DM "CTRL-"
EVB3 DM "x"
EVB4
;Packa upp data
UNPACK LD HL,BUFF3 Pekar p} data
LD A,(IX+24)
INC A
LD (IX+28),A
CALL UPK1
RETC
CALL TOFIL
RET
UPK1 LD DE,BUFF5
LD (IX+27),0
UPK2 AND A Clear carry
DEC (IX+28)
RETZ Inget mer data
LD A,(HL)
INC HL
LD BC,1:0
CP (IX+19)
JRNZ UPK3 Ej REPT
AND A
JRZ UPK3
DEC (IX+28)
RETZ
DEC (IX+28)
RETZ
LD A,(HL)
SUB 32
LD B,A
INC HL
LD A,(HL)
INC HL
UPK3 CP (IX+17)
JRNZ UPK4 Ej QBIN
AND A
JRZ UPK4
DEC (IX+28)
RETZ
LD C,128
LD A,(HL)
INC HL
UPK4 CP (IX+16)
JRNZ UPK6 Ej QCTL
AND A
JRZ UPK6
DEC (IX+28)
RETZ
LD A,(HL)
INC HL
BIT 7,A
JRZ UPK5
LD C,128
UPK5 AND 127
CP (IX+16)
JRZ UPK6 QCTL
CP (IX+17)
JRZ UPK6 QBIN
CP (IX+19)
JRZ UPK6 REPT
XOR 64
UPK6 OR C
UPK7 LD (DE),A
INC DE
INC (IX+27)
DJNZ UPK7
JPP UPK2
CALL TOFIL
JRNC UPK1
RET
TOFIL LD A,(IX+27)
AND A
RETZ
PUSH HL
LD HL,BUFF5
LD C,A
LD B,0
PUSH BC
CALL PUTFIL
POP BC
LD HL,(ANTBYTES)
ADD HL,BC
LD (ANTBYTES),HL
POP HL
RET
;Packa data att s{nda
PACK LD HL,BUFF4
LD (IX+24),0 L{ngd data
LD C,(IX+9)
PK1 LD A,(IX+11)
SUB 8
SUB (IX+24)
CCF
RETNC Packet full
PUSH HL
PUSH BC
CALL GETFIL H{mta ett tecken
POP BC
POP HL
RETC EOF eller ERROR
LD E,A Spara tecken
LD A,(IX+9) Kolla om ej REPT
AND A
JR Z,PK11
CP E
JRZ PK4 REPT-tkn
LD A,E Tillbaks med tecknet i A
CP C
JRZ PK2 Samma som f|rut!
PK11 LD C,A Kom ih}g tecknet
LD B,1 Repeatr{knare
LD (IX+34),L
LD (IX+35),H Spara pekare
LD A,(IX+24)
LD (IX+36),A Spara l{ngd
JR PK4
PK2 INC B \ka repeatantal
LD A,B
CP 4
JRC PK4 Mindre {n 4 lika
CP 94
JRC PK3 Max 94 repeat!
LD C,(IX+9)
PK3 LD L,(IX+34)
LD H,(IX+35) ]terst{ll pekare
LD A,(IX+36)
LD (IX+24),A ]terst{ll l{ngd
LD A,(IX+9)
LD (HL),A REPT-tecken
INC HL
INC (IX+24)
LD A,B Antal repeat
ADD 32
LD (HL),A
INC HL
INC (IX+24)
PK4 BIT 7,E
JRZ PK5 Ej }ttabitsdata
LD A,(IX+7)
AND A
JRZ PK5 Ej QBIN
LD (HL),A
INC HL
INC (IX+24)
RES 7,E
PK5 LD A,E
CP 32
JRC PK6 Tecken < 32
CP 127
JRZ PK6
AND 127
CP (IX+6)
JRZ PK6 QCTL
CP (IX+9)
JRZ PK6 REPT
CP (IX+7)
JRNZ PK8 Ej QBIN
AND A
JRZ PK8 QBIN anv{nds ej
PK6 LD A,(IX+6)
LD (HL),A
INC HL
INC (IX+24)
LD A,E
CP 32
JRC PK7
CP 127
JRNZ PK8
PK7 XOR 64
LD E,A
PK8 LD (HL),E
INC HL
INC (IX+24)
JP PK1