home *** CD-ROM | disk | FTP | other *** search
- *
- * interrupt-driver
- *
-
-
- section "text"
-
- xdef _settimeout
- TIMEOUT dc.l $4fffff
- _settimeout:
- lea TIMEOUT(pc),a0 ; 4 bytes
- move.l d0,(a0) ; 2 bytes
- rts
-
- xdef _parinit
- xdef _testbusy
- xdef _setbusy
- xdef _waitinputtoggle
- xdef _outputtoggle
- xdef _setciaoutput
- xdef _sampleinput
- xdef _testpout
- xdef _setpout
- xdef @intcode
-
- currentinput: dc.w 0
- iamclient: dc.w 0
-
- _sampleinput:
- lea currentinput(pc),a0
- moveq #0,d0
- move.w 2(a0),d0 ; iamclient
- bchg #0,d0
- btst.b d0,$bfd000
- sne.b (a0) ; currentinput
- rts
-
- _waitinputtoggle:
- lea currentinput(pc),a0
- lea $bfd000,a1 ; ciaa
- move.l TIMEOUT(pc),d1
- moveq #0,d0
- move.w 2(a0),d0 ; iamclient
- bchg #0,d0
- tst.b (a0)
- beq.s inputnotset
- itl1:
- btst.b d0,(a1)
- beq.s exa1
- subq.l #1,d1
- bpl.s itl1
- exa1:
- addq.l #1,d1
- move.l d1,d0
- beq.s rettt
- clr.b (a0) ; currentinput
- rts
-
- inputnotset:
- btst.b d0,(a1)
- bne.s exa2
- subq.l #1,d1
- bpl.s inputnotset
- exa2:
- addq.l #1,d1
- move.l d1,d0
- beq.s rettt
- move.b #42,(a0) ; currentinput
- rettt:
- rts
-
- _outputtoggle:
- moveq #0,d0
- move.w iamclient(pc),d0
- bchg.b d0,$bfd000
- rts
-
- _setciaoutput:
- move.b #$ff,$bfe301 ; data out
- rts
-
- _testbusy:
- moveq #0,d0
- btst.b #0,$bfd000
- sne d0
- rts
-
- _testpout:
- moveq #0,d0
- btst.b #1,$bfd000
- sne d0
- rts
-
- _setbusy:
- tst.l d0
- bne.s sb1
- bclr.b #0,$bfd000
- rts
- sb1:
- bset.b #0,$bfd000
- rts
-
- _setpout:
- tst.l d0
- bne.s sp1
- bclr.b #1,$bfd000
- rts
- sp1:
- bset.b #1,$bfd000
- rts
-
-
- ; Init parallel port
- ; d0==1 = client-mode
- _parinit:
- lea $bfd000,a0
- ; move.b #0,$bfe301 ; all parallel bits input
- move.b #0,$bfe301-$bfd000(a0)
- move.w d0,iamclient ; client?
- beq.s servermode
- bset.b #1,$200(a0) ; pout output
- bclr.b #0,$200(a0) ; busy input
- bclr.b #1,(a0) ; POUT low
- rts
- servermode:
- bclr.b #1,$200(a0) ; pout input
- bset.b #0,$200(a0) ; busy output
- bset.b #0,(a0) ; BUSY high (send enable)
- consetup:
- rts
-
- ; Der eigentliche Interrupt-Server
- ; a1 = data
- @intcode:
- move.w (a1),d0 ; mode-word
- btst #1,d0 ; sende?
- beq.s recmode
- return:
- rts
-
- ; Empfangs-Modus: a1 = data, d0 = modes
- recmode:
- btst #2,d0 ; schon recmode?
- bne.s return
-
- ; Prüfen, ob Arbitration richtig
- btst #0,d0
- bne.s clientrec
- btst.b #1,$bfd000 ; POUT high?
- bne.s recmodeok ; wenn nein, dann belegt
- rts
- clientrec:
- btst.b #0,$bfd000 ; busy low?
- bne.s return
- recmodeok:
- or.w #4,(a1) ; RECEIVE setzen
-
- ; load params
- movem.l 4(a1),d0/a1/a6
- ; move.l 4(a1),d0
- ; move.l 8(a1),a1
- ; move.l 4,a6
- jmp -324(a6) ; Signal (Empfangsbeginn)
-
- END
-