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 >
Wrap
Commodore BASIC
|
2022-10-26
|
20KB
|
595 lines
1 ;*********************************
2 ;program: 8748_iecen_2.0
3 ;
4 ;buechel april 84
5 ;*********************************
6 ;
7 ;
100 ;data transfer cbm64 - brother
101 ;hr-15 centronics interface
109 ;
110 ;
120 org 000h
122 ;power up vektor
130 jmp label0 ;jump to mainprogram
132 ;
134 ;
148 ;
150 org 020h
152 ; ***comin***
154 comin :jnt0 label60 ;if t0=0 then label60
162 jnt0 comin ;really t0=1
164 call receive
166 in a,p2 ;read switch
170 cpl a
174 anl a,#0fh
178 mov r6,a ;store switch into r6
180 orl a,#20h ;code=switch or 20h
182 cpl a
186 inc a ;accu = two's complement (switch)
188 add a,r4 ;accu = code-switch
190 jnz label57 ;jump if code <> (switch or 20h)
194 clr f1
198 cpl f1 ;listen = true
200 ;
201 label51:jnt1 label53 ;jump if clock=high
202 jnt1 label51 ;really clock=low
203 label52:jt0 label51 ;jump if atn=low
204 jt0 label52 ;really atn=high
205 jmp label55
206 label53:jt1 label51 ;really clock=high
207 call receive ;read channel#
208 label54:jt0 label54 ;jump if atn=low
209 jt0 label54 ;really atn=high
210 label55:jmp label60
211 ;
214 label57:mov a,r4
216 add a,#0c1h ;accu = code-3fh
218 jnz label58
220 clr f1 ;listen = false
224 label58:orl p1,#01 ;set dataleitung high
226 label59:jt0 label59 ;if atn=low then label59
228 jt0 label59 ;really atn=high
230 label60:ret ;return
258 ;
260 ;
262 ;
270 org 080h
272 ;
274 ; ***receive***
277 receive:anl p1,#0feh ;set dataleitung low
278 mov a,#0fdh ;set timer 200us
279 mov t,a
280 strt t ;start timer
281 label21:jtf label22
282 jmp label21 ;wait 200us
283 label22:stop tcnt ;stop timer
284 label23:jt1 label23 ;if t1=1 then label23
285 jt1 label23 ;really t1=0
286 ;
287 orl p1,#01 ;set dataleitung high
288 mov a,#0fdh ;set timer 200us
289 mov t,a
290 strt t ;start timer
291 ;
292 label24:clr f0 ;clear loop-flag
293 jtf label26 ;jump if time=true
294 jmp label28 ;jump if time=false
295 label26:cpl f0 ;set f0 if time=true
296 clr a ;indicate timer overflow
297 jmp label30
298 label28:jnt1 label30 ;jump if clock=high
299 jnt1 label28 ;really clock=low
300 cpl f0 ;set f0 if clock=high
301 label30:cpl f0 ;invert f0 for test
302 jf0 label24 ;jump if time=false and clock=high
303 ;
304 stop tcnt ;stop timer
305 jnz label38 ;jump if time=false
306 anl p1,#0feh ;set dataleitung low
307 mov a,#0feh ;set timer 100us
308 mov t,a
309 strt t ;start timer
310 label32:jtf label34
311 jmp label32 ;wait 100us
312 label34:stop tcnt ;stop timer
313 orl p1,#01 ;set dataleitung high
314 label36:jnt1 label36 ;continue if clock=high
315 jnt1 label36 ;really clock=high
316 ;
317 label38:mov r0,#3fh ;register address = 3fh
318 mov r7,#08 ;i=8
319 label40:jt1 label40 ;jump if clock=low
320 jt1 label40 ;really clock=high
321 in a,p1 ;read data
322 anl a,#08 ;mask data bit
323 mov @r0,a ;store data bit
324 dec r0 ;decrement register address
325 label42:jnt1 label42 ;jump if clock=high
326 jnt1 label42 ;really clock=low
327 djnz r7,label40 ;next bit
328 ;
329 anl p1,#0feh ;set dataleitung low
330 inc r0 ;increment register address
331 mov a,@r0 ;load databit 7
332 rl a
333 inc r0
334 orl a,@r0 ;or databit 6 to accu
335 rl a
336 inc r0
337 orl a,@r0 ;or databit 5 to accu
338 rl a
339 inc r0
340 orl a,@r0 ;or databit 4 to accu
341 rl a
342 inc r0
343 orl a,@r0 ;or databit 3 to accu
344 mov r4,a
345 inc r0
346 mov a,@r0 ;load databit 2
347 rl a
348 inc r0
349 orl a,@r0 ;or databit 1 to accu
350 rl a
351 inc r0
352 orl a,@r0 ;or databit 0 to accu
353 rr a
354 rr a
355 rr a
356 orl a,r4
357 cpl a
358 mov r4,a ;code in r4
360 ret ;return
369 ;
370 ;
372 ;
380 org 100h
382 ;
384 ; ***transmit***
386 ;
388 transmt:jt0 label98 ;if t0=1 then label98
390 jt0 transmt ;really t0=0
392 label62:jt1 transmt ;if t1=1 then label60
394 jt1 label62 ;really t1=0
396 ;
398 orl p1,#01 ;set dataleitung high
400 mov a,#0fdh ;set timer 200us
402 mov t,a
404 strt t ;start timer
406 ;
408 label64:clr f0 ;clear loop-flag
410 jtf label66 ;jump if time=true
412 jmp label68 ;jump if time=false
414 label66:cpl f0 ;set f0 if time=true
416 clr a ;indicate timer overflow
418 jmp label70
420 label68:jnt1 label70 ;jump if clock=high
422 jnt1 label68 ;really clock=low
424 cpl f0 ;set f0 if clock=high
426 label70:cpl f0 ;invert f0 for test
428 jf0 label64 ;jump if time=false and clock=high
430 ;
432 stop tcnt ;stop timer
434 jnz label78 ;jump if time=false
436 anl p1,#0feh ;set dateleitung low
438 mov a,#0feh ;set timer 100us
440 mov t,a
442 strt t ;start timer
444 label72:jtf label74
446 jmp label72 ;wait 100us
448 label74:stop tcnt ;stop timer
450 orl p1,#01 ;set dataleitung high
452 label76:jnt1 label76 ;continue if clock=high
454 jnt1 label76 ;really clock=high
456 ;
458 label78:mov r0,#3fh ;register address = 3fh
460 mov r7,#08 ;i=8
462 label80:jt1 label80 ;jump if clock=low
464 jt1 label80 ;really clock=high
466 in a,p1 ;read data
468 anl a,#08 ;mask databit
470 mov @r0,a ;store databit
472 dec r0 ;decrement register address
474 label82:jnt1 label82 ;jump if clock=high
476 jnt1 label82 ;really clock=low
478 djnz r7,label80 ;next bit
480 ;
481 inc r0 ;increment register address
482 mov a,@r0 ;load databit 7
483 rl a
484 inc r0
485 orl a,@r0 ;or databit 6 to accu
486 rl a
487 inc r0
488 orl a,@r0 ;or databit 5 to accu
489 rl a
490 inc r0
491 orl a,@r0 ;or databit 4 to accu
492 rl a
493 inc r0
494 orl a,@r0 ;or databit 3 to accu
495 mov r4,a
496 inc r0
497 mov a,@r0 ;load databit 2
498 rl a
499 inc r0
500 orl a,@r0 ;or databit 1 to accu
501 rl a
502 inc r0
503 orl a,@r0 ;or databit 0 to accu
504 rr a
505 rr a
506 rr a
507 orl a,r4
508 cpl a
509 mov r4,a ;code in r4
510 anl p1,#0feh ;set dataleitung low
511 label84:in a,p1 ;read busy
512 ;
514 jb6 label84 ;wait if not busy
515 label86:in a,p1 ;read busy
516 jb6 label86 ;really busy
517 mov a,r4 ;accu=code
518 add a,#80h
519 jnc label97 ;if code<128 then label97
520 mov a,r4 ;accu=code
521 add a,#40h
522 jnc label87 ;if code<192 then label87
523 mov a,r4 ;accu=code
524 add a,#20h
525 jnc label97 ;if code<224 then label97
526 label87:mov a,#5fh
527 outl bus,a ;write "[164]" to centronics
528 nop
530 anl p1,#7fh ;set strobe low
532 nop
533 nop
534 orl p1,#80h ;set strobe high
536 mov a,#0fbh ;set timer 500us
537 mov t,a
538 strt t ;start timer
539 label88:jtf label89 ;
540 jmp label88 ;wait 500us
541 label89:stop tcnt ;stop timer
546 label90:in a,p1 ;read busy
548 jb6 label90 ;wait if not busy
549 label91:in a,p1 ;read busy
550 jb6 label91 ;really busy
552 mov a,#08 ;
554 outl bus,a ;write "bs" to centronics
556 nop
558 anl p1,#7fh ;set strobe low
559 nop
560 nop
562 orl p1,#80h ;set strobe high
564 mov a,#0ffh ;set timer 500us
565 mov t,a
566 strt t ;start timer
567 label92:jtf label93 ;
568 jmp label92 ;wait 500us
569 label93:stop tcnt ;stop timer
574 label94:in a,p1 ;read busy
576 jb6 label94 ;wait if not busy
577 label95:in a,p1 ;read busy
578 jb6 label95 ;really busy
580 ;
582 label97:mov a,r4 ;accu=code
584 movp3 a,@a ;ascii code to accu
586 outl bus,a ;ascii code to centronics
588 nop
590 anl p1,#7fh ;set strobe low
592 nop
593 nop
594 orl p1,#80h ;set strobe high
595 nop
596 nop
597 label98:ret ;return
610 ;
611 ;
612 org 200h
613 ; ***main program***
614 ;
620 label0: orl p2,#0ffh ;switch in 5kohm for 500ns
630 orl p1,#0ffh ;set ports
631 nop
632 nop
635 clr a ;set bus low
640 outl bus,a
645 label2: jnt0 label8 ;if t0=0 then label8
650 jnt0 label2 ;really t0=1
655 call comin ;read iec command
660 jf1 label4 ;if listen=true then label4
665 jmp label8 ;listen=false
670 label4: call transmt ;read data byte from iec
680 ;write data byte to centronics
690 label6: jnt0 label4 ;if t0=0 then label4
695 jnt0 label6 ;really t0=1
700 call comin ;read iec command
705 jf1 label6 ;if listen=true then label6
710 ;
715 label8: anl p2,#7fh ;enable power down
720 mov a,#0feh ;set timer 200us
725 mov t,a
730 strt t ;start timer
735 label10:jtf label12
740 jmp label10 ;wait 200us
745 label12:stop tcnt ;stop timer
750 jmp label0 ;start again
766 ;
767 ;
768 org 300h
780 ;
790 ;
800 ; ***ascii code tabel***
810 db 00h ;
815 db 01h ;
820 db 02h ;
825 db 03h ;
830 db 04h ;
835 db 05h ;
840 db 06h ;
845 db 07h ; bel
850 db 08h ; bs
855 db 09h ; ht
860 db 0ah ; lf
865 db 0bh ; vt
870 db 0ch ; ff
875 db 0dh ; cr
880 db 0eh ;
885 db 0fh ;
900 ;
910 db 10h ;
915 db 11h ; dc1
920 db 12h ;
925 db 13h ; dc3
930 db 14h ;
935 db 15h ;
940 db 16h ;
945 db 17h ;
950 db 18h ; can
955 db 17h ;
960 db 1ah ;
965 db 1bh ; esc
970 db 1ch ;
975 db 1dh ;
980 db 1eh ; rs
985 db 1fh ; us
1000 ;
1010 db 20h
1015 db 21h
1020 db 22h
1025 db 23h
1030 db 24h
1035 db 25h
1040 db 26h
1045 db 27h
1050 db 28h
1055 db 29h
1060 db 2ah
1065 db 2bh
1070 db 2ch
1075 db 2dh
1080 db 2eh
1085 db 2fh
1100 ;
1110 db 30h ;
1115 db 31h ;
1120 db 32h ;
1125 db 33h ;
1130 db 34h ;
1135 db 35h ;
1140 db 36h ;
1145 db 37h ;
1150 db 38h ;
1155 db 39h ;
1160 db 3ah ;
1165 db 3bh ;
1170 db 3ch ;
1175 db 3dh ;
1180 db 3eh ;
1185 db 3fh ;
1200 ;
1210 db 40h
1215 db 61h
1220 db 62h
1225 db 63h
1230 db 64h
1235 db 65h
1240 db 66h
1245 db 67h
1250 db 68h
1255 db 69h
1260 db 6ah
1265 db 6bh
1270 db 6ch
1275 db 6dh
1280 db 6eh
1285 db 6fh
1300 ;
1310 db 70h ;
1315 db 71h ;
1320 db 72h ;
1325 db 73h ;
1330 db 74h ;
1335 db 75h ;
1340 db 76h ;
1345 db 77h ;
1350 db 78h ;
1355 db 79h ;
1360 db 7ah ;
1365 db 5bh ;
1370 db 5ch ;
1375 db 5dh ;
1380 db 5eh ;
1385 db 5fh ;
1400 ;
1410 db 60h
1415 db 41h
1420 db 42h
1425 db 43h
1430 db 44h
1435 db 45h
1440 db 46h
1445 db 47h
1450 db 48h
1455 db 49h
1460 db 4ah
1465 db 4bh
1470 db 4ch
1475 db 4dh
1480 db 4eh
1485 db 4fh
1500 ;
1510 db 50h ;
1515 db 51h ;
1520 db 52h ;
1525 db 53h ;
1530 db 54h ;
1535 db 55h ;
1540 db 56h ;
1545 db 57h ;
1550 db 58h ;
1555 db 59h ;
1560 db 5ah ;
1565 db 7bh ;
1570 db 7ch ;
1575 db 7dh ;
1580 db 7eh ;
1585 db 7fh ;
1600 ;
1610 db 40h
1615 db 61h
1620 db 62h
1625 db 63h
1630 db 64h
1635 db 65h
1640 db 66h
1645 db 67h
1650 db 68h
1655 db 69h
1660 db 6ah
1665 db 6bh
1670 db 6ch
1675 db 6dh
1680 db 6eh
1685 db 6fh
1700 ;
1710 db 70h ;
1715 db 71h ;
1720 db 72h ;
1725 db 73h ;
1730 db 74h ;
1735 db 75h ;
1740 db 76h ;
1745 db 77h ;
1750 db 78h ;
1755 db 79h ;
1760 db 7ah ;
1765 db 5bh ;
1770 db 5ch ;
1775 db 5dh ;
1780 db 5eh ;
1785 db 5fh ;
1800 ;
1810 db 20h
1815 db 21h
1820 db 22h
1825 db 23h
1830 db 24h
1835 db 25h
1840 db 26h
1845 db 27h
1850 db 28h
1855 db 29h
1860 db 2ah
1865 db 2bh
1870 db 2ch
1875 db 2dh
1880 db 2eh
1885 db 2fh
1900 ;
1910 db 30h ;
1915 db 31h ;
1920 db 32h ;
1925 db 33h ;
1930 db 34h ;
1935 db 35h ;
1940 db 36h ;
1945 db 37h ;
1950 db 38h ;
1955 db 39h ;
1960 db 3ah ;
1965 db 3bh ;
1970 db 3ch ;
1975 db 3dh ;
1980 db 3eh ;
1985 db 3fh ;
2000 ;
2010 db 60h
2015 db 41h
2020 db 42h
2025 db 43h
2030 db 44h
2035 db 45h
2040 db 46h
2045 db 47h
2050 db 48h
2055 db 49h
2060 db 4ah
2065 db 4bh
2070 db 4ch
2075 db 4dh
2080 db 4eh
2085 db 4fh
2100 ;
2110 db 50h ;
2115 db 51h ;
2120 db 52h ;
2125 db 53h ;
2130 db 54h ;
2135 db 55h ;
2140 db 56h ;
2145 db 57h ;
2150 db 58h ;
2155 db 59h ;
2160 db 5ah ;
2165 db 7bh ;
2170 db 7ch ;
2175 db 7dh ;
2180 db 7eh ;
2185 db 7fh ;
2200 ;
2210 db 60h
2215 db 41h
2220 db 42h
2225 db 43h
2230 db 44h
2235 db 45h
2240 db 46h
2245 db 47h
2250 db 48h
2255 db 49h
2260 db 4ah
2265 db 4bh
2270 db 4ch
2275 db 4dh
2280 db 4eh
2285 db 4fh
2300 ;
2310 db 50h ;
2315 db 51h ;
2320 db 52h ;
2325 db 53h ;
2330 db 54h ;
2335 db 55h ;
2340 db 56h ;
2345 db 57h ;
2350 db 58h ;
2355 db 59h ;
2360 db 5ah ;
2365 db 7bh ;
2370 db 7ch ;
2375 db 7dh ;
2380 db 7eh ;
2385 db 7fh ;