;SEROUT.ASM ;use bit 0 of the Parallel port (pin2) of the Portfolio=20 ;as serial output port up to 19200 baud!! ;reads a char from the keyboard and sends it ;ESC ends the program. ;NOTE the output level is TTL, but most PC's handle this OK! ;assemble with A86. ;Gerard Rutten, Boekel, Netherlands, september 97. ;fullbit =3D 54 for 4800 bd, 109 for 2400, 24 for 9600, 11 for 9200 fullbit equ 54 =20 halfbit equ fullbit / 2 portin equ 8078h portout equ 8078h sendtst: mov dx,portout ;set the port mov ax,0 ;set bit0 to low out dx,al ;do it mov ah,09 ;send string function mov dx,welcome ;refer to welcome string int 021h ;do it send1: mov ah,07 ;get a key from keyboard in al int 021h ;do it cmp al,27 ;is it esc? je stop ;if yes then return to dos send2: mov ah,02 ;display char in dl mov dl,al ;move from al to dl int 021h ;do it call sendbyt ;send it serial too jmp send1 ;keep on going stop: ret ;end program and return to dos sendbyt: ;first add start and stop bits to al into ax and then send all bits in = ax ;to bit 0 of port defined in portout push ax ;save ax push cx ;save cx push dx ;save dx mov ah,3 ;2 stop bits high shl ax,1 ;1 start bit low not ax mov dx,portout mov cx,11 ;11 bits to send l1: out dx,al shr ax,1 push cx mov cx, fullbit ;wait a bittime sendb2: loop sendb2 pop cx loop l1 ;loop till cx =3D0 pop dx ;restore dx pop cx ;restore cx pop ax ;restore ax ret ;return welcome:db 'Serial (c) G.w.Rutten',0a,0d, db 'Sends typed chars serial (4800 bps) via bit 0 of = Portfolio PI',0a,0d db 'press ESC to stop',0a,0d,'$'