*************************************************************************
* PROGRAM MENCETAK KARAKTER KE PRINTER OLEH DST-51
* Karakter diinputkan dari PC Serial Port
* DELTA ELECTRONIC
* Author: Paulus Andi Nalwan
********************************

	.CODE
Serial_In	EQU	1D0H	;Special routine dari DST-51
Init_Serial	EQU	1B8H	;

	Org	2000H
	Acall   Init_Printer        ;Inisial Printer dan PPI
Loop:
    	Lcall   Serial_In            ;Ambil Data dari Serial Port
    	Acall   Send_Char        ;Kirim ke Printer
    	Ajmp    Loop

Init_Printer:
    	Mov    	A,#80H            ;Semua Port PPI sebagai output
    	Mov     DPTR,#4003H 
    	Movx    @DPTR,A     ;
    	Acall   Pulse_PB2      ;Kirim pulse ke Port B bit 2, Reset Printer
    	Ret

Send_Char:
    	Mov    	DPTR,#4000H    ;Kirim character ke Port A
    	Movx    @DPTR,A        ;
    	Acall   Pulse_PC7         ;Kirim sinyal Strobe
    	Ret

Pulse_PB2:
    	Mov     DPTR,#04001H
    	Mov     A,#0FFH     ;PB2 High
    	Movx    @Dptr,A
    	Mov     A,#0FBH     ;PB2 Low
    	Movx    @Dptr,A
    	Mov     A,#0FFH     ;PB2 High
    	Movx    @Dptr,A
    	Ret

Pulse_PC7:
    	Mov     DPTR,#04002H
    	Mov     A,#0FFH     ;PC7 High
    	Movx    @Dptr,A
    	Mov     A,#07FH     ;PC7 Low
    	Movx    @Dptr,A
    	Mov     A,#0FFH     ;PC7 High
    	Movx    @Dptr,A
    	Ret
