;------------------------------------------------------------------------------ ; transmit.asm ; Transmission de données sur le port parallèle en mode ECP ;------------------------------------------------------------------------------ hpcr equ $ffffc4 ;Host Port Control Register Address hddr equ $ffffc8 ;Host Data Direction Register address hdr equ $ffffc9 ;Host Data Register address HOSTCLK EQU 8 ;The next 6 equates are used for PERIPHCLK EQU 9 ;;addressing the handshaking lines in PERIPHACK EQU 10 ;;Host Data Register nACKREVERSE EQU 11 HOSTACK EQU 12 nREVERSEREQUEST EQU 13 data EQU 7 ; org X:0 ;tab ds 20000 ; declaration d1 tableau de 20000 valeurs cpt ds 1 org P:0 jmp begin org p:$100 begin jsr init_ecp ; move cpt,R0 clr B boucle jsr line_in jsr read move a0,b0 jsr line_out inc b inc b inc b move b0,a0 ; add #10,a jsr write jmp boucle ; jmp fin ;---------------------------------------------------------- ; Routine d'initialisation du mode ECP ;---------------------------------------------------------- init_ecp bset #0,x:hpcr bclr #HOSTCLK,x:hddr bset #PERIPHCLK,x:hddr bset #PERIPHCLK,x:hdr bset #PERIPHACK,x:hddr bclr #PERIPHACK,x:hdr bset #nACKREVERSE,x:hddr bset #nACKREVERSE,x:hdr bclr #HOSTACK,x:hddr bclr #nREVERSEREQUEST,x:hddr rts line_in ;Configures the 8 data lines as inputs move x:hddr,a and #$ff00,a move a,x:hddr rts line_out ;Configures the 8 data lines as outputs move x:hddr,a or #$00ff,a move a,x:hddr rts ;--------------------------------------------- ; routine d'ecriture sur le port parallele ;--------------------------------------------- write ; jset #nREVERSEREQUEST,x:hdr,write_end ; bclr #nACKREVERSE,x:hdr bsr data_out ;output the data on data lines. bset #PERIPHACK,x:hdr ;assert PeriphAck bclr #PERIPHCLK,x:hdr ;reset PeriphClk. wr1 ; jset #nREVERSEREQUEST,x:hdr,time_out_wr jclr #HOSTACK,x:hdr,wr1 bset #PERIPHCLK,x:hdr wr2 ; jset #nREVERSEREQUEST,x:hdr,time_out_wr jset #HOSTACK,x:hdr,wr2 time_out_wr bclr #PERIPHACK,x:hdr ;reset PeriphAck ; bset #nACKREVERSE,x:hdr write_end rts data_out move a0,x0 ;Take the least significant byte from move x:hdr,a0 ;;aO and send it, insert #$8000,x0,a ;;without modifying move a0,x:hdr ;;the most significant move x:hddr,a1 ;;byte from Host Data Register or #$ff,a move a1,x:hddr rts ;---------------------------------------------- ; routine de lecture sur le port parallele ;---------------------------------------------- read ; jclr #nREVERSEREQUEST,x:hdr,* bset #PERIPHCLK,x:hdr ;assert PeriphAck. rd1 ; jclr #nREVERSEREQUEST,x:hdr,time_out_rd jset #HOSTCLK,x:hdr,rd1 bset #PERIPHACK,x:hdr ; jsr delai rd2 ; jclr #nREVERSEREQUEST,x:hdr,read_end jclr #HOSTCLK,x:hdr,rd2 bsr data_in time_out_rd bclr #PERIPHACK,x:hdr ;reset PeriphAck read_end rts data_in move x:hdr,a0 extractu #$8000,a,a rts ;delai move #$ff,B0 ;del nop ; dec B ; bne del ; rts ;------------------------------------------------- fin jmp fin end