Advertisement
crb3

morse.m51

Oct 12th, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. ;--------------------------------------------------------
  2. ;
  3. ;morse.m51 --CHR$(13)30MAR87/09APR87
  4. ;
  5. ;acc,b KEYTIM
  6. ;r0,r1,r2 MORSER/IAMBIC
  7. ;dptr HLMORS
  8. ;r0 ILMORS
  9. ;
  10. ;Look up the character in the table. Each table entry is
  11. ; two bytes, a baud-count nibble plus up to the remainder
  12. ; of two bytes to be shifted rightwards out the door.
  13. ; The character symbols algorithm is from a message keyer
  14. ; program in 73 by VE3CWY, originally written for the
  15. ; CDP1802, which I used in the Morse-code readout for TSCRT.
  16. ;
  17. ;ILMORS uses r0, preserves dptr. HLMORS advances dptr past null.
  18. ;ILMORS does ex (sp),dptr and then calls HLMORS, then ex (sp),dptr
  19. ; and ret.
  20. ;
  21. ILMORS: mov r0,sp
  22. ;
  23. xch a,@r0 ;a<-hicall, (sp)<-aval
  24. xch a,dph ;dph<-hicall, a<-dphi
  25. xch a,@r0 ;a<-aval, (sp)<-dphi
  26. dec r0
  27. xch a,@r0
  28. xch a,dpl
  29. xch a,@r0
  30. ;
  31. call HLMORS
  32. ;
  33. mov r0,sp
  34. xch a,@r0
  35. xch a,dph
  36. xch a,@r0
  37. dec r0
  38. xch a,@r0
  39. xch a,dpl
  40. xch a,@r0
  41. ;
  42. ret
  43. ;
  44. ;;;
  45. ;
  46. HLMORS: clr a
  47. movc a,@a+dptr
  48. inc dptr
  49. jz HLMRDN
  50. call MORSER
  51. jmp HLMORS
  52. HLMRDN: ret
  53. ;
  54. ;;;
  55. ;
  56. ;Call here with char to send in a.
  57. ;
  58. MORSER: cjne a,#' ',NSPC
  59. jmp SPACE
  60. NSPC: cjne a,#'&',NES
  61. jmp AMPSND
  62. NES: push dpl
  63. push dph
  64. mov dptr,#TABLE
  65. add a,acc
  66. jnb acc.7,LOHALF
  67. mov dptr,#HITABL
  68. clr acc.7
  69. LOHALF: mov r0,a
  70. movc a,@a+dptr ;pick up lobyte
  71. xch a,r0
  72. inc dptr
  73. movc a,@a+dptr ;pick up hibyte
  74. mov r1,a
  75. pop dph
  76. pop dpl
  77. anl a,r0 ;with what's in r1
  78. inc a
  79. jnz IAMBIC
  80. ret ;ffff = filler, not a real code.
  81. ;
  82. ;One element at a time, shift the bits right and out.
  83. ; A hi is a dah, a lo is a dit. Each is followed by
  84. ; a dit of quiet. The character is followed by a dah
  85. ; of quiet.
  86. ;
  87. IAMBIC: mov a,r1
  88. cjne a,#0FFh,BIGGIE
  89. mov a,r0
  90. BIGGIE: swap a
  91. anl a,#0Fh
  92. mov r2,a
  93. IAMLUP: xch a,r0
  94. rrc a
  95. xch a,r0
  96. jnc DODIT
  97. DODAH: call DAH
  98. jmp IAMDEC
  99. DODIT: call DIT
  100. IAMDEC: djnz r2,IAMLUP ;countdown: done?
  101. IAMEND: call UNKEY
  102. call UNKEY
  103. ;
  104. IF FNSWTH
  105. ;
  106. call UNKEY ;Extra white space between
  107. call UNKEY ; letters... the Farnsworth
  108. call UNKEY ; method.
  109. call UNKEY
  110. call UNKEY
  111. call UNKEY
  112. ;
  113. ENDIF
  114. ;
  115. ret
  116. ;
  117. ;;;
  118. ;
  119. ;It's the final frontier... ask John Cage.
  120. ;
  121. SPACE: call IAMEND
  122. call IAMEND
  123. jmp UNKEY
  124. ;
  125. ;;;
  126. ;
  127. DIT: call KEY
  128. jmp UNKEY
  129. ;
  130. DAH: call KEY
  131. call KEY
  132. call KEY
  133. jmp UNKEY
  134. ;
  135. ;;;
  136. ;
  137. AMPSND: call DIT
  138. call UNKEY
  139. call DIT
  140. call DIT
  141. call DIT
  142. call UNKEY
  143. jmp UNKEY
  144. ;
  145. ;;;
  146. ;
  147. KEY: clr KEYLIN
  148. jmp KTIMR
  149. UNKEY: setb KEYLIN
  150. KTIMR: mov b,MTIME ;codespeed delay variable
  151. clr a
  152. KTLP: djnz acc,KTLP
  153. djnz b,KTLP
  154. ret
  155. ;
  156. ;;;
  157. ;
  158. ;Table by VE3CWY.
  159. ;
  160. TABLE: db FX,FX,FX,FX ;NUL SOH
  161. db FX,FX,FX,FX ;STX ETX
  162. db FX,FX,FX,FX ;EOT ENQ
  163. db 8,50h,FX,FX ;ACK...<sn> BEL
  164. db 0,80h,FX,FX ;BS...<hh> HT
  165. db 0Bh,60h,FX,FX ;LF...<al> VT
  166. db 15h,50h,51h,70h ;FF...<ka> CR...<bk>
  167. db FX,FX,FX,FX ;SO SI
  168. db FX,FX,FX,FX ;DLE DC1
  169. db FX,FX,FX,FX ;DC2 DC3
  170. db FX,FX,FX,FX ;DC4 NAK
  171. db FX,FX,0Ah,50h ;SYN ETB...<ar>
  172. db FX,FX,FX,FX ;CAN EM
  173. db FX,FX,FX,FX ;SUB ESC
  174. db FX,FX,FX,FX ;FS GS
  175. db FX,FX,FX,FX ;RS US
  176. db FX,FX,2,50h ;<space> !...<as>
  177. db 2Dh,60h,28h,60h ;" #...<sk>
  178. db 84h,70h,21h,50h ;$...<sx: dollarsign>
  179. ;%...<au: fractions follow>
  180. db FX,FX,1Eh,60h ;&...set up ES in a sub
  181. ;'
  182. db 0Dh,50h,2Dh,60h ;( )
  183. db 2,50h,0Ah,50h ;+...<ar> *...<as>
  184. db 33h,60h,21h,60h ;, -
  185. db 2Ah,60h,9,50h ;. /...<fraction bar>
  186. db 1Fh,50h,1Eh,50h ;0 1
  187. db 1Ch,50h,18h,50h ;2 3
  188. db 10h,50h,0,50h ;4 5
  189. db 1,50h,3,50h ;6 7
  190. db 7,50h,0Fh,50h ;8,9
  191. db 7,60h,15h,60h ;: ;
  192. db FX,FX,11h,50h ;< =...<doubledash>
  193. db FX,FX,0Ch,60h ;> ?
  194. HITABL: db 0Ah,50h,22h,FX ;@...<ar> A
  195. db 41h,FX,45h,FX ;B C
  196. db 31h,FX,10h,FX ;D E
  197. db 44h,FX,33h,FX ;F G
  198. db 40h,FX,20h,FX ;H I
  199. db 4Eh,FX,35h,FX ;J K
  200. db 42h,FX,23h,FX ;L M
  201. db 21h,FX,37h,FX ;N O
  202. db 46h,FX,4Bh,FX ;P Q
  203. db 32h,FX,30h,FX ;R S
  204. db 11h,FX,34h,FX ;T U
  205. db 48h,FX,36h,FX ;V W
  206. db 49h,FX,4Dh,FX ;X Y
  207. db 43h,FX,FX,FX ;Z [
  208. db 51h,70h,FX,FX ;\...<bk> ]
  209. db 8,50h,2Ch,60h ;^ _
  210. db FX,FX,22h,FX ;accent grave, a
  211. db 41h,FX,45h,FX ;b c
  212. db 31h,FX,10h,FX ;d e
  213. db 44h,FX,33h,FX ;f g
  214. db 40h,FX,20h,FX ;h i
  215. db 4Eh,FX,35h,FX ;j k
  216. db 42h,FX,23h,FX ;l m
  217. db 21h,FX,37h,FX ;n o
  218. db 46h,FX,4Bh,FX ;p q
  219. db 32h,FX,30h,FX ;r s
  220. db 11h,FX,34h,FX ;t u
  221. db 48h,FX,36h,FX ;v w
  222. db 49h,FX,4Dh,FX ;x y
  223. db 43h,FX,8,50h ;z {
  224. db FX,FX,FX,FX ;| }
  225. db 0Dh,50h,0,80h ;~...<kn> DEL...<hh>
  226. ;
  227. ;Prosigns:
  228. ; SIGN KEY USED MEANING
  229. ; au % fractions follow
  230. ; sx $ dollar-sign
  231. ; ar +,@,ETB end of message or cross
  232. ; bk \,CR "over."
  233. ; sn ACK,{ understand
  234. ; as *,! wait
  235. ; hh BS,DEL error
  236. ; sk # QSO END
  237. ; kn (,~ go only
  238. ;
  239. ;'&', <es>, is best handled as an exception.
  240. ; Inter-letter space is dah = 3 dits... space needed is 2 dits.
  241. ;
  242. ;
  243. ;eof MORSE.M51/std[std.]--CHR$(13)30MAR87
  244. ;
  245. ;----------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement