home *** CD-ROM | disk | FTP | other *** search
/ 64'er Special 13 / 64er_Magazin_Sonderheft_13_19xx_Markt__Technik_de_Side_A.d64 / cent.int.src (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  20KB  |  595 lines

  1. 1                             ;*********************************
  2. 2                             ;program: 8748_iecen_2.0
  3. 3                             ;
  4. 4                             ;buechel  april 84
  5. 5                             ;*********************************
  6. 6                             ;
  7. 7                             ;
  8. 100                           ;data transfer cbm64  -  brother
  9. 101                           ;hr-15 centronics interface
  10. 109                           ;
  11. 110                           ;
  12. 120         org   000h
  13. 122                           ;power up vektor
  14. 130         jmp   label0      ;jump to mainprogram
  15. 132                           ;
  16. 134                           ;
  17. 148                           ;
  18. 150         org   020h
  19. 152                           ;        ***comin***
  20. 154 comin  :jnt0  label60     ;if t0=0 then label60
  21. 162         jnt0  comin       ;really t0=1
  22. 164         call  receive
  23. 166         in    a,p2        ;read switch
  24. 170         cpl   a
  25. 174         anl   a,#0fh
  26. 178         mov   r6,a        ;store switch into r6
  27. 180         orl   a,#20h      ;code=switch or 20h
  28. 182         cpl   a
  29. 186         inc   a           ;accu = two's complement (switch)
  30. 188         add   a,r4        ;accu = code-switch
  31. 190         jnz   label57     ;jump if code <> (switch or 20h)
  32. 194         clr   f1
  33. 198         cpl   f1          ;listen = true
  34. 200                           ;
  35. 201 label51:jnt1  label53     ;jump if clock=high
  36. 202         jnt1  label51     ;really clock=low
  37. 203 label52:jt0   label51     ;jump if atn=low
  38. 204         jt0   label52     ;really atn=high
  39. 205         jmp   label55
  40. 206 label53:jt1   label51     ;really clock=high
  41. 207         call  receive     ;read channel#
  42. 208 label54:jt0   label54     ;jump if atn=low
  43. 209         jt0   label54     ;really atn=high
  44. 210 label55:jmp   label60
  45. 211                           ;
  46. 214 label57:mov   a,r4
  47. 216         add   a,#0c1h     ;accu = code-3fh
  48. 218         jnz   label58
  49. 220         clr   f1          ;listen = false
  50. 224 label58:orl   p1,#01      ;set dataleitung high
  51. 226 label59:jt0   label59     ;if atn=low then label59
  52. 228         jt0   label59     ;really atn=high
  53. 230 label60:ret               ;return
  54. 258                           ;
  55. 260                           ;
  56. 262                           ;
  57. 270         org   080h
  58. 272                           ;
  59. 274                           ;       ***receive***
  60. 277 receive:anl   p1,#0feh    ;set dataleitung low
  61. 278         mov   a,#0fdh     ;set timer 200us
  62. 279         mov   t,a
  63. 280         strt  t           ;start timer
  64. 281 label21:jtf   label22
  65. 282         jmp   label21     ;wait 200us
  66. 283 label22:stop  tcnt        ;stop timer
  67. 284 label23:jt1   label23     ;if t1=1 then label23
  68. 285         jt1   label23     ;really t1=0
  69. 286                           ;
  70. 287         orl   p1,#01      ;set dataleitung high
  71. 288         mov   a,#0fdh     ;set timer 200us
  72. 289         mov   t,a
  73. 290         strt  t           ;start timer
  74. 291                           ;
  75. 292 label24:clr   f0          ;clear loop-flag
  76. 293         jtf   label26     ;jump if time=true
  77. 294         jmp   label28     ;jump if time=false
  78. 295 label26:cpl   f0          ;set f0 if time=true
  79. 296         clr   a           ;indicate timer overflow
  80. 297         jmp   label30
  81. 298 label28:jnt1  label30     ;jump if clock=high
  82. 299         jnt1  label28     ;really clock=low
  83. 300         cpl   f0          ;set f0 if clock=high
  84. 301 label30:cpl   f0          ;invert f0 for test
  85. 302         jf0   label24     ;jump if time=false and clock=high
  86. 303                           ;
  87. 304         stop  tcnt        ;stop timer
  88. 305         jnz   label38     ;jump if time=false
  89. 306         anl   p1,#0feh    ;set dataleitung low
  90. 307         mov   a,#0feh     ;set timer 100us
  91. 308         mov   t,a
  92. 309         strt  t           ;start timer
  93. 310 label32:jtf   label34
  94. 311         jmp   label32     ;wait 100us
  95. 312 label34:stop  tcnt        ;stop timer
  96. 313         orl   p1,#01      ;set dataleitung high
  97. 314 label36:jnt1  label36     ;continue if clock=high
  98. 315         jnt1  label36     ;really clock=high
  99. 316                           ;
  100. 317 label38:mov   r0,#3fh     ;register address = 3fh
  101. 318         mov   r7,#08      ;i=8
  102. 319 label40:jt1   label40     ;jump if clock=low
  103. 320         jt1   label40     ;really clock=high
  104. 321         in    a,p1        ;read data
  105. 322         anl   a,#08       ;mask data bit
  106. 323         mov   @r0,a       ;store data bit
  107. 324         dec   r0          ;decrement register address
  108. 325 label42:jnt1  label42     ;jump if clock=high
  109. 326         jnt1  label42     ;really clock=low
  110. 327         djnz  r7,label40  ;next bit
  111. 328                           ;
  112. 329         anl   p1,#0feh    ;set dataleitung low
  113. 330         inc   r0          ;increment register address
  114. 331         mov   a,@r0       ;load databit 7
  115. 332         rl    a
  116. 333         inc   r0
  117. 334         orl   a,@r0       ;or databit 6 to accu
  118. 335         rl    a
  119. 336         inc   r0
  120. 337         orl   a,@r0       ;or databit 5 to accu
  121. 338         rl    a
  122. 339         inc   r0
  123. 340         orl   a,@r0       ;or databit 4 to accu
  124. 341         rl    a
  125. 342         inc   r0
  126. 343         orl   a,@r0       ;or databit 3 to accu
  127. 344         mov   r4,a
  128. 345         inc   r0
  129. 346         mov   a,@r0       ;load databit 2
  130. 347         rl    a
  131. 348         inc   r0
  132. 349         orl   a,@r0       ;or databit 1 to accu
  133. 350         rl    a
  134. 351         inc   r0
  135. 352         orl   a,@r0       ;or databit 0 to accu
  136. 353         rr    a
  137. 354         rr    a
  138. 355         rr    a
  139. 356         orl   a,r4
  140. 357         cpl   a
  141. 358         mov   r4,a        ;code in r4
  142. 360         ret               ;return
  143. 369                           ;
  144. 370                           ;
  145. 372                           ;
  146. 380         org   100h
  147. 382                           ;
  148. 384                           ;       ***transmit***
  149. 386                           ;
  150. 388 transmt:jt0   label98     ;if t0=1 then label98
  151. 390         jt0   transmt     ;really t0=0
  152. 392 label62:jt1   transmt     ;if t1=1 then label60
  153. 394         jt1   label62     ;really t1=0
  154. 396                           ;
  155. 398         orl   p1,#01      ;set dataleitung high
  156. 400         mov   a,#0fdh     ;set timer 200us
  157. 402         mov   t,a
  158. 404         strt  t           ;start timer
  159. 406                           ;
  160. 408 label64:clr   f0          ;clear loop-flag
  161. 410         jtf   label66     ;jump if time=true
  162. 412         jmp   label68     ;jump if time=false
  163. 414 label66:cpl   f0          ;set f0 if time=true
  164. 416         clr   a           ;indicate timer overflow
  165. 418         jmp   label70
  166. 420 label68:jnt1  label70     ;jump if clock=high
  167. 422         jnt1  label68     ;really clock=low
  168. 424         cpl   f0          ;set f0 if clock=high
  169. 426 label70:cpl   f0          ;invert f0 for test
  170. 428         jf0   label64     ;jump if time=false and clock=high
  171. 430                           ;
  172. 432         stop  tcnt        ;stop timer
  173. 434         jnz   label78     ;jump if time=false
  174. 436         anl   p1,#0feh    ;set dateleitung low
  175. 438         mov   a,#0feh     ;set timer 100us
  176. 440         mov   t,a
  177. 442         strt  t           ;start timer
  178. 444 label72:jtf   label74
  179. 446         jmp   label72     ;wait 100us
  180. 448 label74:stop  tcnt        ;stop timer
  181. 450         orl   p1,#01      ;set dataleitung high
  182. 452 label76:jnt1  label76     ;continue if clock=high
  183. 454         jnt1  label76     ;really clock=high
  184. 456                           ;
  185. 458 label78:mov   r0,#3fh     ;register address = 3fh
  186. 460         mov   r7,#08      ;i=8
  187. 462 label80:jt1   label80     ;jump if clock=low
  188. 464         jt1   label80     ;really clock=high
  189. 466         in    a,p1        ;read data
  190. 468         anl   a,#08       ;mask databit
  191. 470         mov   @r0,a       ;store databit
  192. 472         dec   r0          ;decrement register address
  193. 474 label82:jnt1  label82     ;jump if clock=high
  194. 476         jnt1  label82     ;really clock=low
  195. 478         djnz  r7,label80  ;next bit
  196. 480                           ;
  197. 481         inc   r0          ;increment register address
  198. 482         mov   a,@r0       ;load databit 7
  199. 483         rl    a
  200. 484         inc   r0
  201. 485         orl   a,@r0       ;or databit 6 to accu
  202. 486         rl    a
  203. 487         inc   r0
  204. 488         orl   a,@r0       ;or databit 5 to accu
  205. 489         rl    a
  206. 490         inc   r0
  207. 491         orl   a,@r0       ;or databit 4 to accu
  208. 492         rl    a
  209. 493         inc   r0
  210. 494         orl   a,@r0       ;or databit 3 to accu
  211. 495         mov   r4,a
  212. 496         inc   r0
  213. 497         mov   a,@r0       ;load databit 2
  214. 498         rl    a
  215. 499         inc   r0
  216. 500         orl   a,@r0       ;or databit 1 to accu
  217. 501         rl    a
  218. 502         inc   r0
  219. 503         orl   a,@r0       ;or databit 0 to accu
  220. 504         rr    a
  221. 505         rr    a
  222. 506         rr    a
  223. 507         orl   a,r4
  224. 508         cpl   a
  225. 509         mov   r4,a        ;code in r4
  226. 510         anl   p1,#0feh    ;set dataleitung low
  227. 511 label84:in    a,p1        ;read busy
  228. 512                           ;
  229. 514         jb6   label84     ;wait if not busy
  230. 515 label86:in    a,p1        ;read busy
  231. 516         jb6   label86     ;really busy
  232. 517         mov   a,r4        ;accu=code
  233. 518         add   a,#80h
  234. 519         jnc   label97     ;if code<128 then label97
  235. 520         mov   a,r4        ;accu=code
  236. 521         add   a,#40h
  237. 522         jnc   label87     ;if code<192 then label87
  238. 523         mov   a,r4        ;accu=code
  239. 524         add   a,#20h
  240. 525         jnc   label97     ;if code<224 then label97
  241. 526 label87:mov   a,#5fh
  242. 527         outl  bus,a       ;write "[164]" to centronics
  243. 528         nop
  244. 530         anl   p1,#7fh     ;set strobe low
  245. 532         nop
  246. 533         nop
  247. 534         orl   p1,#80h     ;set strobe high
  248. 536         mov   a,#0fbh     ;set timer 500us
  249. 537         mov   t,a
  250. 538         strt  t           ;start timer
  251. 539 label88:jtf   label89     ;
  252. 540         jmp   label88     ;wait 500us
  253. 541 label89:stop  tcnt        ;stop timer
  254. 546 label90:in    a,p1        ;read busy
  255. 548         jb6   label90     ;wait if not busy
  256. 549 label91:in    a,p1        ;read busy
  257. 550         jb6   label91     ;really busy
  258. 552         mov   a,#08       ;
  259. 554         outl  bus,a       ;write "bs" to centronics
  260. 556         nop
  261. 558         anl   p1,#7fh     ;set strobe low
  262. 559         nop
  263. 560         nop
  264. 562         orl   p1,#80h     ;set strobe high
  265. 564         mov   a,#0ffh     ;set timer 500us
  266. 565         mov   t,a
  267. 566         strt  t           ;start timer
  268. 567 label92:jtf   label93     ;
  269. 568         jmp   label92     ;wait 500us
  270. 569 label93:stop  tcnt        ;stop timer
  271. 574 label94:in    a,p1        ;read busy
  272. 576         jb6   label94     ;wait if not busy
  273. 577 label95:in    a,p1        ;read busy
  274. 578         jb6   label95     ;really busy
  275. 580                           ;
  276. 582 label97:mov   a,r4        ;accu=code
  277. 584         movp3 a,@a        ;ascii code to accu
  278. 586         outl  bus,a       ;ascii code to centronics
  279. 588         nop
  280. 590         anl   p1,#7fh     ;set strobe low
  281. 592         nop
  282. 593         nop
  283. 594         orl   p1,#80h     ;set strobe high
  284. 595         nop
  285. 596         nop
  286. 597 label98:ret               ;return
  287. 610                           ;
  288. 611                           ;
  289. 612         org   200h
  290. 613                           ;     ***main program***
  291. 614                           ;
  292. 620 label0: orl   p2,#0ffh    ;switch in 5kohm for 500ns
  293. 630         orl   p1,#0ffh    ;set ports
  294. 631         nop
  295. 632         nop
  296. 635         clr   a           ;set bus low
  297. 640         outl  bus,a
  298. 645 label2: jnt0  label8      ;if t0=0 then label8
  299. 650         jnt0  label2      ;really t0=1
  300. 655         call  comin       ;read iec command
  301. 660         jf1   label4      ;if listen=true then label4
  302. 665         jmp   label8      ;listen=false
  303. 670 label4: call  transmt     ;read data byte from iec
  304. 680                           ;write data byte to centronics
  305. 690 label6: jnt0  label4      ;if t0=0 then label4
  306. 695         jnt0  label6      ;really t0=1
  307. 700         call  comin       ;read iec command
  308. 705         jf1   label6      ;if listen=true then label6
  309. 710                           ;
  310. 715 label8: anl   p2,#7fh     ;enable power down
  311. 720         mov   a,#0feh     ;set timer 200us
  312. 725         mov   t,a
  313. 730         strt  t           ;start timer
  314. 735 label10:jtf   label12
  315. 740         jmp   label10     ;wait 200us
  316. 745 label12:stop  tcnt        ;stop timer
  317. 750         jmp   label0      ;start again
  318. 766                           ;
  319. 767                           ;
  320. 768         org   300h
  321. 780                           ;
  322. 790                           ;
  323. 800                           ;    ***ascii code tabel***
  324. 810         db    00h         ;
  325. 815         db    01h         ;
  326. 820         db    02h         ;
  327. 825         db    03h         ;
  328. 830         db    04h         ;
  329. 835         db    05h         ;
  330. 840         db    06h         ;
  331. 845         db    07h         ; bel
  332. 850         db    08h         ; bs
  333. 855         db    09h         ; ht
  334. 860         db    0ah         ; lf
  335. 865         db    0bh         ; vt
  336. 870         db    0ch         ; ff
  337. 875         db    0dh         ; cr
  338. 880         db    0eh         ;
  339. 885         db    0fh         ;
  340. 900                           ;
  341. 910         db    10h         ;
  342. 915         db    11h         ; dc1
  343. 920         db    12h         ;
  344. 925         db    13h         ; dc3
  345. 930         db    14h         ;
  346. 935         db    15h         ;
  347. 940         db    16h         ;
  348. 945         db    17h         ;
  349. 950         db    18h         ; can
  350. 955         db    17h         ;
  351. 960         db    1ah         ;
  352. 965         db    1bh         ; esc
  353. 970         db    1ch         ;
  354. 975         db    1dh         ;
  355. 980         db    1eh         ; rs
  356. 985         db    1fh         ; us
  357. 1000                           ;
  358. 1010         db    20h
  359. 1015         db    21h
  360. 1020         db    22h
  361. 1025         db    23h
  362. 1030         db    24h
  363. 1035         db    25h
  364. 1040         db    26h
  365. 1045         db    27h
  366. 1050         db    28h
  367. 1055         db    29h
  368. 1060         db    2ah
  369. 1065         db    2bh
  370. 1070         db    2ch
  371. 1075         db    2dh
  372. 1080         db    2eh
  373. 1085         db    2fh
  374. 1100                           ;
  375. 1110         db    30h         ;
  376. 1115         db    31h         ;
  377. 1120         db    32h         ;
  378. 1125         db    33h         ;
  379. 1130         db    34h         ;
  380. 1135         db    35h         ;
  381. 1140         db    36h         ;
  382. 1145         db    37h         ;
  383. 1150         db    38h         ;
  384. 1155         db    39h         ;
  385. 1160         db    3ah         ;
  386. 1165         db    3bh         ;
  387. 1170         db    3ch         ;
  388. 1175         db    3dh         ;
  389. 1180         db    3eh         ;
  390. 1185         db    3fh         ;
  391. 1200                           ;
  392. 1210         db    40h
  393. 1215         db    61h
  394. 1220         db    62h
  395. 1225         db    63h
  396. 1230         db    64h
  397. 1235         db    65h
  398. 1240         db    66h
  399. 1245         db    67h
  400. 1250         db    68h
  401. 1255         db    69h
  402. 1260         db    6ah
  403. 1265         db    6bh
  404. 1270         db    6ch
  405. 1275         db    6dh
  406. 1280         db    6eh
  407. 1285         db    6fh
  408. 1300                           ;
  409. 1310         db    70h         ;
  410. 1315         db    71h         ;
  411. 1320         db    72h         ;
  412. 1325         db    73h         ;
  413. 1330         db    74h         ;
  414. 1335         db    75h         ;
  415. 1340         db    76h         ;
  416. 1345         db    77h         ;
  417. 1350         db    78h         ;
  418. 1355         db    79h         ;
  419. 1360         db    7ah         ;
  420. 1365         db    5bh         ;
  421. 1370         db    5ch         ;
  422. 1375         db    5dh         ;
  423. 1380         db    5eh         ;
  424. 1385         db    5fh         ;
  425. 1400                           ;
  426. 1410         db    60h
  427. 1415         db    41h
  428. 1420         db    42h
  429. 1425         db    43h
  430. 1430         db    44h
  431. 1435         db    45h
  432. 1440         db    46h
  433. 1445         db    47h
  434. 1450         db    48h
  435. 1455         db    49h
  436. 1460         db    4ah
  437. 1465         db    4bh
  438. 1470         db    4ch
  439. 1475         db    4dh
  440. 1480         db    4eh
  441. 1485         db    4fh
  442. 1500                           ;
  443. 1510         db    50h         ;
  444. 1515         db    51h         ;
  445. 1520         db    52h         ;
  446. 1525         db    53h         ;
  447. 1530         db    54h         ;
  448. 1535         db    55h         ;
  449. 1540         db    56h         ;
  450. 1545         db    57h         ;
  451. 1550         db    58h         ;
  452. 1555         db    59h         ;
  453. 1560         db    5ah         ;
  454. 1565         db    7bh         ;
  455. 1570         db    7ch         ;
  456. 1575         db    7dh         ;
  457. 1580         db    7eh         ;
  458. 1585         db    7fh         ;
  459. 1600                           ;
  460. 1610         db    40h
  461. 1615         db    61h
  462. 1620         db    62h
  463. 1625         db    63h
  464. 1630         db    64h
  465. 1635         db    65h
  466. 1640         db    66h
  467. 1645         db    67h
  468. 1650         db    68h
  469. 1655         db    69h
  470. 1660         db    6ah
  471. 1665         db    6bh
  472. 1670         db    6ch
  473. 1675         db    6dh
  474. 1680         db    6eh
  475. 1685         db    6fh
  476. 1700                           ;
  477. 1710         db    70h         ;
  478. 1715         db    71h         ;
  479. 1720         db    72h         ;
  480. 1725         db    73h         ;
  481. 1730         db    74h         ;
  482. 1735         db    75h         ;
  483. 1740         db    76h         ;
  484. 1745         db    77h         ;
  485. 1750         db    78h         ;
  486. 1755         db    79h         ;
  487. 1760         db    7ah         ;
  488. 1765         db    5bh         ;
  489. 1770         db    5ch         ;
  490. 1775         db    5dh         ;
  491. 1780         db    5eh         ;
  492. 1785         db    5fh         ;
  493. 1800                           ;
  494. 1810         db    20h
  495. 1815         db    21h
  496. 1820         db    22h
  497. 1825         db    23h
  498. 1830         db    24h
  499. 1835         db    25h
  500. 1840         db    26h
  501. 1845         db    27h
  502. 1850         db    28h
  503. 1855         db    29h
  504. 1860         db    2ah
  505. 1865         db    2bh
  506. 1870         db    2ch
  507. 1875         db    2dh
  508. 1880         db    2eh
  509. 1885         db    2fh
  510. 1900                           ;
  511. 1910         db    30h         ;
  512. 1915         db    31h         ;
  513. 1920         db    32h         ;
  514. 1925         db    33h         ;
  515. 1930         db    34h         ;
  516. 1935         db    35h         ;
  517. 1940         db    36h         ;
  518. 1945         db    37h         ;
  519. 1950         db    38h         ;
  520. 1955         db    39h         ;
  521. 1960         db    3ah         ;
  522. 1965         db    3bh         ;
  523. 1970         db    3ch         ;
  524. 1975         db    3dh         ;
  525. 1980         db    3eh         ;
  526. 1985         db    3fh         ;
  527. 2000                           ;
  528. 2010         db    60h
  529. 2015         db    41h
  530. 2020         db    42h
  531. 2025         db    43h
  532. 2030         db    44h
  533. 2035         db    45h
  534. 2040         db    46h
  535. 2045         db    47h
  536. 2050         db    48h
  537. 2055         db    49h
  538. 2060         db    4ah
  539. 2065         db    4bh
  540. 2070         db    4ch
  541. 2075         db    4dh
  542. 2080         db    4eh
  543. 2085         db    4fh
  544. 2100                           ;
  545. 2110         db    50h         ;
  546. 2115         db    51h         ;
  547. 2120         db    52h         ;
  548. 2125         db    53h         ;
  549. 2130         db    54h         ;
  550. 2135         db    55h         ;
  551. 2140         db    56h         ;
  552. 2145         db    57h         ;
  553. 2150         db    58h         ;
  554. 2155         db    59h         ;
  555. 2160         db    5ah         ;
  556. 2165         db    7bh         ;
  557. 2170         db    7ch         ;
  558. 2175         db    7dh         ;
  559. 2180         db    7eh         ;
  560. 2185         db    7fh         ;
  561. 2200                           ;
  562. 2210         db    60h
  563. 2215         db    41h
  564. 2220         db    42h
  565. 2225         db    43h
  566. 2230         db    44h
  567. 2235         db    45h
  568. 2240         db    46h
  569. 2245         db    47h
  570. 2250         db    48h
  571. 2255         db    49h
  572. 2260         db    4ah
  573. 2265         db    4bh
  574. 2270         db    4ch
  575. 2275         db    4dh
  576. 2280         db    4eh
  577. 2285         db    4fh
  578. 2300                           ;
  579. 2310         db    50h         ;
  580. 2315         db    51h         ;
  581. 2320         db    52h         ;
  582. 2325         db    53h         ;
  583. 2330         db    54h         ;
  584. 2335         db    55h         ;
  585. 2340         db    56h         ;
  586. 2345         db    57h         ;
  587. 2350         db    58h         ;
  588. 2355         db    59h         ;
  589. 2360         db    5ah         ;
  590. 2365         db    7bh         ;
  591. 2370         db    7ch         ;
  592. 2375         db    7dh         ;
  593. 2380         db    7eh         ;
  594. 2385         db    7fh         ;
  595.