#make_COM#

; COM file is loaded at CS:0100h
; (the value of CS is set by Operating System)
ORG 100h

	mov al,0ffh	;set Parallel Port D0-D7 high
	mov dx,0378h	;to power card reader
	out dx,al

	mov dx,0ffffh ;long pause to allow time for device
P1:	mov cx,0100h  ;to power up
P2:	dec cx
	jnz P2
	dec dx	
	jnz P1


l1:	mov dx,0379h
	in al,dx	;get new input
	mov new,al	
	and al,20h	;check clock bit is low
	jnz l1		;if not loop to l1
	
	mov al,new	;get last input
	and al,10h	;check data bit
	
	jz  one

zero:	mov ah,0eh
	mov al,'0'
	int 10h
	
	jmp l5
	
one:	mov ah,0eh
	mov al,'1'
	int 10h
	
l5:	mov dx,0379h ;wait for clock to go high
	in al,dx
	and al,20h
	jz l5
	
	jmp l1
	
new	db 	0

table1  db  00001b  ;0
        db  10000b  ;1
        db  01000b  ;2
        db  11001b  ;3
        db  00100b  ;4
        db  10101b  ;5
        db  01101b  ;6
        db  11100b  ;7
        db  00010b  ;8
        db  10011b  ;9
        db  01011b  ;: control
_ss     db  11010b  ;; start sentinal
        db  00111b  ;< control
        db  10110b  ;= Field Separator
        db  01110b  ;> Control
_es     db  11111b  ;? End Sentinel
        
table2  db  "0"
        db  "1"
        db  "2"
        db  "3"
        db  "4"
        db  "5"
        db  "6"
        db  "7"
        db  "8"
        db  "9"
        db  ":"
        db  ";"
        db  "<"
        db  "="
        db  ">"
        db  "?"
