Hola candia.
Si lo que quieres es ver como se ve un programita Delphi en asm para el puerto serie, aqui te dejo esto:
Código Delphi
[-]
var
Form1: TForm1;
data,status:byte;
const
base = $3f8;
lcr = 3;
dll = 0;
dlh = 1;
lsr = 5;
Procedure Initserial;
begin
asm
mov dx,base+lcr; {address line control register}
mov al,$80 ; {10000000b = access bit divisor lacht}
out dx,al
;
mov dx,base+dll; {address divisor lacht low byte}
mov al,$30 ; {DLLB = 30h}
out dx,al
;
mov dx,base+dlh; {address divisor lacht high byte}
mov al,$00 ; {DLLH = 00h}
out dx,al
; {In this case Port Serial have}
; { baud rate = 2400 bps}
mov dx,base+lcr;{address line control register}
mov al,$03 ; {00000011b =}
out dx,al ; {bit 7=0, access to Rx buffer & Tx
; {bit 6=0, set break disable
; {bit 5-4-3=000, no parity
; {bit 2=0, one stop bit
; {bit 1-0=11,data lenght 8 bit}
end;
end;
Procedure Send_Data_Serial;
begin
asm
mov dx,base
mov al,data
out dx,al
end
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Initserial;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
repeat
asm
mov dx,base+lsr ; {address line status register }
in al,dx
and al,$20 ; {00100000b =not masking bit 5}
mov status,al ; {bit5=Empty Transmitting holding reg}
end;
until status = $20;
data:=0;
Send_Data_Serial;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
repeat
asm
mov dx,base+lsr; {address line status register }
in al,dx
and al,$20 ; {00100000b =not masking bit 5}
mov status,al ; {bit5=Empty Transmitting holding reg}
end;
until status = $20;
data:=1;
Send_Data_Serial;
end;
Yo prefiero usar ComPort por muchas razones y una es que en asm, algunas PC ya no quieren rodar bien.Por ejemplo Win XP da problemas cuando se crea un asm para controlar el puerto serie.
Con los PICs no te puedo ayudar. Pero aqui hay algunos colegas que si conocen bastante estos chips.
Un Saludo.