com1 interrupt address Where I can find com1 int address. It is on 0x40:0 ? I try to prepare com monitor application under dex4u os and I think this is a last problem.
Dex- 06-09-2006
This will get you the com address
;=========================================================;
; ComPort test 09/06/06 ;
;---------------------------------------------------------;
; By Dex. ;
; ;
; To assemble use fasm as follows ;
; c:\fasm ComPort.asm ComPort.dex ;
;=========================================================;
use32
ORG 0x200000 ; where our program is loaded to
jmp start ; jump to the start of program.
db 'DEX1' ; We check for this, to make shore it a valid Dex4u file.
msg1: db 'Press anykey to test for com address.',13,0
;----------------------------------------------------;
; Start of program. ;
;----------------------------------------------------;
start:
mov ax,18h ; set ax to nonlinear base
mov ds,ax ; add them to ds
mov es,ax ; and es.
;----------------------------------------------------;
; Get calltable address. ;
;----------------------------------------------------;
mov edi,Functions ; this is the interrupt
mov al,0 ; we use to load the DexFunction.inc
mov ah,0x0a ; with the address to dex4u functions.
int 40h
;----------------------------------------------------;
; Try print string. ;
;----------------------------------------------------;
mov esi,msg1 ; this point's to our string.
call [PrintString] ; this call the print function.
call [WaitForKeyPress] ; is the wait for keypress function.
;----------------------------------------------------;
; Get com port address. ;
;----------------------------------------------------;
push es ; save es
mov ax,8h ; set ax to linear base, we need linear address
mov es,ax ; and es.
mov eax,dword[es:400h] ; move whats at address, into eax
pop es ; restore es
call [WriteHex32] ; print out hex value
call [WaitForKeyPress] ; is the wait for keypress function.
ret ; This returns to the CLI/GUI
;----------------------------------------------------;
; Data. ;
;----------------------------------------------------;
include 'DexFunctions.inc' ; Here is where we includ our "DexFunctions.inc" file
But as for the int, you need to look into "ldt.inc"
for these:
;35 interrupt 23h <- IRQ 3
dw unhandled_irq ; COM 1,3
dw sys_code
db 0
db sys_interrupt
dw 0
;36 interrupt 24h <- IRQ 4
dw unhandled_irq ; COM 2,4
dw sys_code
db 0
db sys_interrupt
dw 0
But as you can see they are unhandle, so you would need to sort that out, if your in doubt let me know and i will set them for you.
viki- 06-09-2006
Thanks a lot.
tonyMac- 06-10-2006
Wow, I was just going to ask that question, I wanted to see where they were so I could monitor a PIC project that polls data. Awesome.
Dex- 06-10-2006
Wow, I was just going to ask that question, I wanted to see where they were so I could monitor a PIC project that polls data. Awesome.
When you have it working, do a post on your pic project, sounds very interesting 8) .
tonyMac- 06-11-2006
Will do. I plan on doing a lot more with the PIC, it merges my interest in software with my love of hardware and blinking lights. :lol:
Dex- 06-11-2006
I like Pic programing too , if Dos is bear metal programming, pic programming is bacofoil :lol:.
viki- 06-22-2006
Unfortunatelly I still have some problems with com port. I prepared small app. like below and connected 2v pc with cross cable. (I'm sure that connection is ok becouse I test it with the same pc's and hyper terminal programs.) I expected that with my application I got (when cometing comes on com1 port) U letter on top left corner from unhandled_int?
PORT1 = 3f8h
THR = 0 ;Transmitter Holding Reg
RBR = 0 ;Reciver Buffer Reg
IER = 1 ;Interrupt Enable Reg
IIR = 2 ;Interrupt Identyfication Reg
LCR = 3 ;Line Control Reg
MCR = 4 ;Modem Control Reg
LSR = 5 ;Line Status Reg
MSR = 6 ;Modem Status Reg
INT_ON_RxD = 0x01
INT_ON_TxD = 0x02
INT_ON_LINE_STATUS = 0x04
INT_ON_MODEM_STATUS = 0x08
DATA_LEN_5 = 0x00
DATA_LEN_6 = 0x01
DATA_LEN_7 = 0x02
DATA_LEN_8 = 0x03
STOP_BIT_1 = 0x00
STOP_BIT_2 = 0x04
PARITY_NO = 0x00
PARITY_ODD = 0x08
PARITY_EVEN = 0x18
PARITY_HIGH = 0x28
PARITY_LOW = 0x38
macro outb port_nr,data
{
mov dx , port_nr
mov al , data
out dx , ax
}
use32
ORG 0x200000 ; where our program is loaded to
jmp start ; jump to the start of program.
db 'DEX1' ; We check for this, to make shore it a valid Dex4u file.
msg1: db 'Press anykey to test com port.',13,0
;----------------------------------------------------;
; Start of program. ;
;----------------------------------------------------;
start:
mov ax , 18h ; set ax to nonlinear base
mov ds , ax ; add them to ds
mov es , ax ; and es.
;----------------------------------------------------;
; Get calltable address. ;
;----------------------------------------------------;
mov edi, Functions ;this is the interrupt
mov al , 0 ;we use to load the DexFunction.inc
mov ah , 0x0a ;with the address to dex4u functions.
int 40h
;----------------------------------------------------;
; Try print string. ;
;----------------------------------------------------;
mov esi, msg1 ;this point's to our string.
call [PrintString] ;this call the print function.
call [WaitForKeyPress] ;is the wait for keypress function.
;----------------------------------------------------;
; Get com port address. ;
;----------------------------------------------------;
push es ; save es
mov ax , 8h ; set ax to linear base, we need linear address
mov es , ax ; and es.
mov eax, dword[es:400h] ; move whats at address, into eax
pop es ;restore es
outb PORT1 + LCR , 0x80 ;SET DLAB ON
outb PORT1 + RBR , 0x0C ;Set Baud rate - Divisor Latch Low Byte
;Default 0x03 = 38,400 BPS
;0x01 = 115,200 BPS
;0x02 = 57,600 BPS
;0x06 = 19,200 BPS
;0x0C = 9,600 BPS
;0x18 = 4,800 BPS
;0x30 = 2,400 BPS
outb PORT1 + IER,0x00 ;Set Baud rate - Divisor Latch High Byte
outb PORT1 + LCR , DATA_LEN_8 or STOP_BIT_1 or PARITY_NO
outb PORT1 + IIR , 0xC7 ;FIFO Control Register
outb PORT1 + MCR , 0x0B ;Turn on DTR, RTS, and OUT2
in al , 0x21
and al , 0x0ef
;COM1 (IRQ4) - 0xEF
;COM2 (IRQ3) - 0xF7
;COM3 (IRQ4) - 0xEF
;COM4 (IRQ3) - 0xF7
out 21h,al ;Set Programmable Interrupt Controller
outb PORT1 + IER , INT_ON_RxD or INT_ON_LINE_STATUS or INT_ON_MODEM_STATUS;
call [WriteHex16] ; print out hex value
call [WaitForKeyPress] ; is the wait for keypress function.
ret ; This returns to the CLI/GUI
;----------------------------------------------------;
; Data. ;
;----------------------------------------------------;
include 'DexFunctions.inc' ; Here is where we includ our \"DexFunctions.inc\" file
Dex- 06-22-2006
First let me say its great your working on this sort of code, as its what Dex4u was designed to be used for, i have tested you code and it work as it should.
But if you look at the int for com1, com3 etc. it is not linked to "unhandled_int"
but is link to "unhandled_irq, which prints a 'Q' , but the print part is dehighlighted, so if you have the source for Dex4u go into 'Isr.inc' find 'unhandled_irq' and set the print letter code to work.
I have done this and your code works fine and a Q is printed, if you do not have the source or need kernel32 with this mod let me know and i will post a kernel32 or source code.
Regards Dex.
viki- 06-22-2006
Thanks a lot.Seems that I'am a little bit tired that I miss it. Please give me some time and i put the whole sources of my com monitor.
Dex- 06-22-2006
Your not aloan, i also mist it when testing your code, its was only when i put int 23h
in your code and it still did not print 'U' that i had a closer look.
I look forward to using your program, and maybe when you have it working as you want, you could convert it to a module that hooks in the com irq, this way you could make it beep and get data even when running a differant program 8).
Keep up the work and any ? just fire away.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.