;SERIN.ASM ;get 256 serial bytes through pin 12 of the Pofo Parallel Interface ;and display them on the screen. ;NOTE TTL signals only, normal RS232 signal may damage your Portfolio ;assemble with A86 ;Gerard Rutten, Boekel, The Netherlands, semptember 97 ;fullbit = 54 for 4800 bd, 109 for 2400, 24 for 9600, 11 for 19200 fullbit equ 54 halfbit equ fullbit / 2 portin equ 807ah portout equ 8078h r0: mov si,0 mov cx,256 r: push cx call recvbyt pop cx mov buf[si],al mov dl,buf[si] mov ah,2 ; int 21h inc si loop r ;print the buffer mov si,0 mov ah,2 mov cx,256 mov dl,0ah int 21h mov dl,0dh int 21h mov dl,'=' int 21h int 21h int 21h p: mov dl,buf[si] inc si push si cmp dl,0ah jne p2 int 21h mov dl,0dh p2: int 21h pop si loop p jmp r0 ;repeat forever recvbyt equ $ r1: mov dx,portin in al,dx ;wait for a start bit test al,1 jz r1 ;if 0 then continue wait mov cx,halfbit r2: loop r2 ;wait for half a bit in al,dx ;start bit ? test al,1 jz r1 ;false alarm, is no start bit ;now get 8 bits mov cx,8 r3: push cx mov cx,fullbit r4: loop r4 pop cx in al,dx and al,1 or bh,al shr bx,1 loop r3 ;stop bits will follow but are ingnored here mov al,bl not al ret ;return with byte in al welcome:db 'Serial IN (c) G.w.Rutten',0a,0d,0a,0d,'$' buf: db 256 dup 0