Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;--------------------------------------------------------
- ;
- ;morse.m51 --CHR$(13)30MAR87/09APR87
- ;
- ;acc,b KEYTIM
- ;r0,r1,r2 MORSER/IAMBIC
- ;dptr HLMORS
- ;r0 ILMORS
- ;
- ;Look up the character in the table. Each table entry is
- ; two bytes, a baud-count nibble plus up to the remainder
- ; of two bytes to be shifted rightwards out the door.
- ; The character symbols algorithm is from a message keyer
- ; program in 73 by VE3CWY, originally written for the
- ; CDP1802, which I used in the Morse-code readout for TSCRT.
- ;
- ;ILMORS uses r0, preserves dptr. HLMORS advances dptr past null.
- ;ILMORS does ex (sp),dptr and then calls HLMORS, then ex (sp),dptr
- ; and ret.
- ;
- ILMORS: mov r0,sp
- ;
- xch a,@r0 ;a<-hicall, (sp)<-aval
- xch a,dph ;dph<-hicall, a<-dphi
- xch a,@r0 ;a<-aval, (sp)<-dphi
- dec r0
- xch a,@r0
- xch a,dpl
- xch a,@r0
- ;
- call HLMORS
- ;
- mov r0,sp
- xch a,@r0
- xch a,dph
- xch a,@r0
- dec r0
- xch a,@r0
- xch a,dpl
- xch a,@r0
- ;
- ret
- ;
- ;;;
- ;
- HLMORS: clr a
- movc a,@a+dptr
- inc dptr
- jz HLMRDN
- call MORSER
- jmp HLMORS
- HLMRDN: ret
- ;
- ;;;
- ;
- ;Call here with char to send in a.
- ;
- MORSER: cjne a,#' ',NSPC
- jmp SPACE
- NSPC: cjne a,#'&',NES
- jmp AMPSND
- NES: push dpl
- push dph
- mov dptr,#TABLE
- add a,acc
- jnb acc.7,LOHALF
- mov dptr,#HITABL
- clr acc.7
- LOHALF: mov r0,a
- movc a,@a+dptr ;pick up lobyte
- xch a,r0
- inc dptr
- movc a,@a+dptr ;pick up hibyte
- mov r1,a
- pop dph
- pop dpl
- anl a,r0 ;with what's in r1
- inc a
- jnz IAMBIC
- ret ;ffff = filler, not a real code.
- ;
- ;One element at a time, shift the bits right and out.
- ; A hi is a dah, a lo is a dit. Each is followed by
- ; a dit of quiet. The character is followed by a dah
- ; of quiet.
- ;
- IAMBIC: mov a,r1
- cjne a,#0FFh,BIGGIE
- mov a,r0
- BIGGIE: swap a
- anl a,#0Fh
- mov r2,a
- IAMLUP: xch a,r0
- rrc a
- xch a,r0
- jnc DODIT
- DODAH: call DAH
- jmp IAMDEC
- DODIT: call DIT
- IAMDEC: djnz r2,IAMLUP ;countdown: done?
- IAMEND: call UNKEY
- call UNKEY
- ;
- IF FNSWTH
- ;
- call UNKEY ;Extra white space between
- call UNKEY ; letters... the Farnsworth
- call UNKEY ; method.
- call UNKEY
- call UNKEY
- call UNKEY
- ;
- ENDIF
- ;
- ret
- ;
- ;;;
- ;
- ;It's the final frontier... ask John Cage.
- ;
- SPACE: call IAMEND
- call IAMEND
- jmp UNKEY
- ;
- ;;;
- ;
- DIT: call KEY
- jmp UNKEY
- ;
- DAH: call KEY
- call KEY
- call KEY
- jmp UNKEY
- ;
- ;;;
- ;
- AMPSND: call DIT
- call UNKEY
- call DIT
- call DIT
- call DIT
- call UNKEY
- jmp UNKEY
- ;
- ;;;
- ;
- KEY: clr KEYLIN
- jmp KTIMR
- UNKEY: setb KEYLIN
- KTIMR: mov b,MTIME ;codespeed delay variable
- clr a
- KTLP: djnz acc,KTLP
- djnz b,KTLP
- ret
- ;
- ;;;
- ;
- ;Table by VE3CWY.
- ;
- TABLE: db FX,FX,FX,FX ;NUL SOH
- db FX,FX,FX,FX ;STX ETX
- db FX,FX,FX,FX ;EOT ENQ
- db 8,50h,FX,FX ;ACK...<sn> BEL
- db 0,80h,FX,FX ;BS...<hh> HT
- db 0Bh,60h,FX,FX ;LF...<al> VT
- db 15h,50h,51h,70h ;FF...<ka> CR...<bk>
- db FX,FX,FX,FX ;SO SI
- db FX,FX,FX,FX ;DLE DC1
- db FX,FX,FX,FX ;DC2 DC3
- db FX,FX,FX,FX ;DC4 NAK
- db FX,FX,0Ah,50h ;SYN ETB...<ar>
- db FX,FX,FX,FX ;CAN EM
- db FX,FX,FX,FX ;SUB ESC
- db FX,FX,FX,FX ;FS GS
- db FX,FX,FX,FX ;RS US
- db FX,FX,2,50h ;<space> !...<as>
- db 2Dh,60h,28h,60h ;" #...<sk>
- db 84h,70h,21h,50h ;$...<sx: dollarsign>
- ;%...<au: fractions follow>
- db FX,FX,1Eh,60h ;&...set up ES in a sub
- ;'
- db 0Dh,50h,2Dh,60h ;( )
- db 2,50h,0Ah,50h ;+...<ar> *...<as>
- db 33h,60h,21h,60h ;, -
- db 2Ah,60h,9,50h ;. /...<fraction bar>
- db 1Fh,50h,1Eh,50h ;0 1
- db 1Ch,50h,18h,50h ;2 3
- db 10h,50h,0,50h ;4 5
- db 1,50h,3,50h ;6 7
- db 7,50h,0Fh,50h ;8,9
- db 7,60h,15h,60h ;: ;
- db FX,FX,11h,50h ;< =...<doubledash>
- db FX,FX,0Ch,60h ;> ?
- HITABL: db 0Ah,50h,22h,FX ;@...<ar> A
- db 41h,FX,45h,FX ;B C
- db 31h,FX,10h,FX ;D E
- db 44h,FX,33h,FX ;F G
- db 40h,FX,20h,FX ;H I
- db 4Eh,FX,35h,FX ;J K
- db 42h,FX,23h,FX ;L M
- db 21h,FX,37h,FX ;N O
- db 46h,FX,4Bh,FX ;P Q
- db 32h,FX,30h,FX ;R S
- db 11h,FX,34h,FX ;T U
- db 48h,FX,36h,FX ;V W
- db 49h,FX,4Dh,FX ;X Y
- db 43h,FX,FX,FX ;Z [
- db 51h,70h,FX,FX ;\...<bk> ]
- db 8,50h,2Ch,60h ;^ _
- db FX,FX,22h,FX ;accent grave, a
- db 41h,FX,45h,FX ;b c
- db 31h,FX,10h,FX ;d e
- db 44h,FX,33h,FX ;f g
- db 40h,FX,20h,FX ;h i
- db 4Eh,FX,35h,FX ;j k
- db 42h,FX,23h,FX ;l m
- db 21h,FX,37h,FX ;n o
- db 46h,FX,4Bh,FX ;p q
- db 32h,FX,30h,FX ;r s
- db 11h,FX,34h,FX ;t u
- db 48h,FX,36h,FX ;v w
- db 49h,FX,4Dh,FX ;x y
- db 43h,FX,8,50h ;z {
- db FX,FX,FX,FX ;| }
- db 0Dh,50h,0,80h ;~...<kn> DEL...<hh>
- ;
- ;Prosigns:
- ; SIGN KEY USED MEANING
- ; au % fractions follow
- ; sx $ dollar-sign
- ; ar +,@,ETB end of message or cross
- ; bk \,CR "over."
- ; sn ACK,{ understand
- ; as *,! wait
- ; hh BS,DEL error
- ; sk # QSO END
- ; kn (,~ go only
- ;
- ;'&', <es>, is best handled as an exception.
- ; Inter-letter space is dah = 3 dits... space needed is 2 dits.
- ;
- ;
- ;eof MORSE.M51/std[std.]--CHR$(13)30MAR87
- ;
- ;----------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement