home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
archives
/
appleii.zip
/
appmsv.m65
< prev
next >
Wrap
Text File
|
1990-12-05
|
9KB
|
286 lines
.TITLE KERMIT-65 Microtek SV-622 serial com card
.SBTTL 6502 version - Ted Medin
; Version 1.0
; Based on the KERMIT Protocol.
; $Header: appmsv.m65,v 1.9 90/10/15 14:25:50 medin Locked $
.SBTTL Define start address for assembly
.=$1003 ; Start assembly at hex 1003
.SBTTL Revision History
;
; Edit # Description
; ------ -----------
;
;$Log: appmsv.m65,v $
Revision 1.9 90/10/15 14:25:50 medin
new org of $7f00 for 3.87
version 1.8
;Revision 1.8 88/12/22 09:40:58 medin
;use time constant for the wait routine
;Revision 1.7 88/08/16 16:20:30 medin
;fix break so it doesnt drop dtr
;Revision 1.6 88/02/06 21:45:13 medin
; Change output routine to check for input character before exiting.
;Revision 1.5 88/01/15 08:41:02 medin
;New origin for 3.81
;Revision 1.4 87/06/29 10:05:13 medin
; Change wait rtn to use apple rom rtn, change origin to $7600
;Revision 1.3 87/05/13 18:12:04 medin
; Change org to correspond with 3.76
;Revision 1.2 87/02/21 00:05:40 medin
; Put the version in the hearld so we can keep track of
;the com drivers also. Thanks Rhoda
; DONT FORGET TO UPDATE THE VERSION
;Revision 1.1 86/10/28 10:28:13 medin
;Initial revision
;
;
; Vector for com cards starts here
; location $1003 for data
; location $1020 for routine jumps
; location $1040 for main routines
;
sscdbd: .blkb 1 ;contains baud index(ala super serial card) used by init
; 6 - 300 baud
; 7 - 600
; etc
.blkb 1
crdnam: .word herld ; null terminated string of who we are
kersli: .blkb 1 ; com slot $n0
kerins: .blkb 1 ; force initialization flag-when 0
endker: .blkb 2 ; address of end of main kermit
flowfg: .blkb 1 ; flow flag for xon/xoff controll b7=1 yes
tl0end .word endcom ;[1.5] end of this routine
timect .blkb 1 ;[1.7] 1 ms delay via rom wait rtn
.=$1020 ; future expansion
tlinit: jmp tl2int ; initialize com card
tl0cmd: jmp tl2cmd ; command for ACIA in A
;
; 0 - hang up
; $0b - set baud
; $0c - set break on the line
; $91 - xon
; $93 - xoff
;
; routine will return false(0) if unable
tl0cp: jmp tl2cp ; check for input ch ready-0 false
tl0gpc: jmp tl2gpc ; get input ch
tl0ppc: jmp tl2ppc ; put output character
tl0exi: jmp tl2exi ; reset card and restore initialized
.=$1040 ; futures
;[1.4]wait: .blkb 3 ; wait routine-a reg contains milliseconds
wait: .blkb 3 ; rom wait rtn 220=125ms,206=108ms,25=2ms
prstr: .blkb 3 ; print string x=lsb,y=msb x&y->null terminated string
rdkey: .blkb 3 ; read keyboard
prcrlf: .blkb 3 ; print cr and lf
telcnc: .blkb 3 ; check for keyboard character
telspa: .blkb 3 ; set character parity
;[1.4] .=$7200 ; place to start com card assembly
.=$7f00 ;[1.8][1.5] place to start com card assembly
start = . ;need a label at begining
kr2pch = $c088 ;data port
kr2pst = $c089 ;status port
kr2pcr = $c08a ;command port
kr2pcc = $c08b ;control port
mncinb = $18 ; Control port init(8 bit,no par,1-stop,1200 baud)
mnminb = $b ; Master port init(DTR, RTS, no interrupts)
mssinb = $8 ; status bit for input ready
mssoub = $10 ;status bit for output busy
moutb = $c ; mask for the output bits of command
moutnt = $4 ; command to start output with interupts
pinptr: .byte ; input buffer pointer
inptr: .byte ; input buffer pointer for get
poutpt .byte ;[59] output buffer pointer
outptr .byte ;[59] " " " for put
kwrk01 .byte ;[1.7]
irqsva = $45 ;place dos saves a reg
hctrlq = $91 ;^Q with high bit on
hctrls = $93 ;^S "
ctrlq = $11 ;[59] ^Q
ctrls = $13 ;[59] ^S
dirq = $3fe ; interupt address
sscstp = $578 ; +slot,bit 7 on turns off commands to ssc
herld nasc <MICROTEK SV-622 V1.8> 1 ;tell who we are
bad nasc <*****ERROR***** COM ROUTINES ASSEMBLED TOO LOW IN MEMORY> 1
;
; Microtek serial interface support - These routines support the
; SV-622 card
;
tl2int:
lda #start^
cmp endker+1 ;are we loaded above main
beq dontno ;cant tell yet
bcc trble ;yes we are in trouble
bcs setnm ;ok
dontno lda #start\ ;well lets check 16 bits
cmp endker
beq setnm ;whee just exactly right
bcs setnm ;ok
trble ldx #bad\ ;got to tell someone
ldy #bad^
jsr prstr ;print the message
jsr prcrlf ;and terminate it properly
setnm:
lda kerins
bne tl2prr ; already initialized
lda #0 ; clear pointers etc
sta pinptr ; buffer starts at 0
sta inptr ; buffer starts at 0
sta poutpt ;[59] "
sta outptr ;[59] "
ldx kersli ;now for the slot $n0
lda #mnminb ; Master port init
sta kerins ; tell weve been here
sta kr2pst,x ; Com port status
sta kr2pcr,x ; Com master port
lda #mncinb ; Control port init
and #$f0 ; drop baud
ora sscdbd ; and add default baud
sta kr2pcc,x ;
tl2prr: rts ; Return
tl2cp: ldx kersli ; Offset into I/O locations
tl2cp1: lda kr2pst,x ; Try for a character
and #$08 ; Check for receive register full
beq tl2cp7 ; no we dont have a ch
lda kr2pch,x ; yes get ch
ldy pinptr ; where to put it in buf
sta inbuf,y ; save it
inc pinptr ; ready for next ch
bit flowfg ;[59] how about flow control
bpl tl2cp7 ;[59] no
lda inbuf,y ;[59] get input ch
and #$7f ;[59] drop parity etc
; bvc tl2cp4 ;[59] yes,how about ^S received?, no
cmp #ctrlq ;[59] is this continue(start up outputing)
bne tl2cp4 ;[59] no, check for ^S
lda flowfg ;[59] tattle about the continue
and #$bf ;[59]
sta flowfg ;[59]
dec pinptr ;[59] forget about this character
tl2cp2 ldy outptr ;[59] see if any to output
cpy poutpt ;[59] well?
beq tl2cp7 ;[59] no more we have put all
tl2cp3 lda kr2pst,x ;[59] check status for output
and #$10 ;[59] ready?
beq tl2cp3 ;[59] no, spin
lda outbuf,y ;[59] output ch
sta kr2pch,x ;[59] bye
inc outptr ;[59] ready for next
jmp tl2cp2 ;[59]
tl2cp4 cmp #ctrls ;[59] is this stop?
bne tl2cp7 ;[59] no
lda #$40 ;[59] yes, tattle
ora flowfg ;[59]
sta flowfg ;[59] now everyone knows
dec pinptr ;[59] forget about the ^S character
tl2cp7:
lda pinptr
cmp inptr
rts ;return with false(0) or true(non 0)
tl2gpc: ldx inptr ; get where it is in buf
lda inbuf,x ; get the ch
inc inptr ; ready for next get
tl2rtc: rts ; and return
tl2ppc: pha ; Hold the byte to send
ldx kersli ; Get I/O location offset
tl2pp1: lda kr2pst,x ; Get the status byte
and #$10 ; Isolate the flag we want (TRE)
beq tl2pp2 ; Transmit register is NOT empty, try again
bit flowfg ;[59] flow control?
bpl tl2pp0 ;[59] no
bvc tl2pp0 ;[59] should we stop outputing?,no
ldy poutpt ;[59] yes, save this ch in buffer
pla ;[59]
sta outbuf,y ;[59]
inc poutpt ;[59] tell how many
;[1.6] rts ;[59] thats all
jmp tl2cp1 ;[1.6] check for input and return
tl2pp0 ;[59]
pla ; Fetch the data byte off the stack
sta kr2pch,x ; Stuff it at the proper loc to send it
;[1.6] rts ; and return
jmp tl2cp1 ;[1.6] check for input and return
tl2pp2: jsr tl2cp1 ; see if there is an input ch
jmp tl2pp1 ;and try again
tl2exi:
lda #0 ;tell we did this
sta kerins ;just in case init gets called
ldx kersli ; get slot number
sta kr2pst,x ;shut it down
sta kr2pcr,x
exit9: rts
tl2cmd: ;find out what command
beq tl2rts ;its drop line and we cant
cmp #$0c
beq break ;its a break command
cmp #$0b
beq baud ;its a set baud command
cmp #hctrlq
beq tl2sac ;its a xon command
cmp #hctrls
beq tl2sac ;its a xoff command
tl2fls: lda #0 ;unknown command
tl2rts: rts ;que passo ? return false(0)
tl2sac: ldx flowfg ;do we have flow control
bpl tl2fls ;no return false
and #$7f ;drop high bit and send the ch
jsr telspa ;set parity
jsr tl2ppc ;output the ch
lda #1 ;set true return
rts
baud: ldx kersli ; get slot number
lda kr2pcc,x ; get com control
and #$f0 ; and clear baud
ora sscdbd ; enter
sta kr2pcc,x ; and set new baud rate
rts ;return true(non 0)
break:
ldy kersli ; ss card routine is not on
lda kr2pcr,y ; get current command
pha ;
;[1.7] lda #$c ;
ora #$c ;[1.7] keep dtr up???
sta kr2pcr,y ; start the break
;[1.4] lda #233 ; for 233 millseconds
;[1.4] jsr wait ; the y reg is not clobered
;[1.7] lda #220 ;[1.4] 125ms
lda #233 ;[1.7] 233 ms
sta kwrk01 ;[1.7]
break3 lda timect ;[1.7] 1 ms at a time
jsr wait ;[1.4]
dec kwrk01 ;[1.7]
bne break3 ;[1.7]
;[1.7] lda #206 ;[1.4] 108ms
;[1.7] jsr wait ;[1.4]
pla ; restore command
sta kr2pcr,y ;
lda #1 ;return true
rts
inbuf .blkb 256 ;input buffer
outbuf .blkb 256 ;[59] output "
endcom ;[1.5]