Thanks tonyMac.
Yes that right, but i wanted to check the address in BIOS, i also think windows only emulates them on a com port ?, On some compaq BIOS theres apart that goes on the harddrive, this gets cleared off when you format, to fix it you need to flash you BIOS, I do not want to do that.
I could get round it, but have no time right now.
Here is the code for you to see what you can come up with, it some old code i had on a disk for dos, that i converted to run on Dex4u.
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.
WaitMessage: DB 'Waiting for IR input',13,0
IRMessage: DB 'Got IR input',13,0
OFMessage: DB 'Overflow....',13,0
OneMessage: DB '1',0
ZeroMessage: DB '0',0
CRMessage: DB ' ',13,0
KeyMessage: DB 'Press a key',13,0
NrmMessage: DB 'Normal exit',13,0
PCount: DB ' pulses ',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
;----------------------------------------------------;
; print string. ;
;----------------------------------------------------;
mov esi,WaitMessage
call [PrintString] ; this call the print function.
;----------------------------------------------------;
; start the IR stuff. ;
;----------------------------------------------------;
mov ebx,Buffer ; for integer counts to go in
mov dx,0e301h ; system control reg address
in al,dx ; get contents of control reg
or al,04h ; turn on I/O (UART & IR)
out dx,al ; write it back
; wait for first input
inp1:
mov dx,0e30bh ; IR xmit/rcv reg
wait1:
in al,dx
test al,80h ; high-order bit is raw IR data in
jz wait1 ; nothing in yet
cli ; replaced nop with cli
; wait for input to go off
off1:
xor cx,cx ; put zeros in cx
wait2:
in al,dx
test al,80h
loopnz wait2 ; still on
jcxz toomuch ; somehow overflowed...
neg cx
mov word[ds:ebx],cx
inc ebx
inc ebx
; there were lots of nops here to even out time
xor ecx,ecx
wait3:
in al,dx
test al,80h
loopz wait3 ; still off
jcxz done
neg cx
mov word[ds:ebx],cx
inc ebx
inc ebx
mov cx,0000h
; lots of nops were here too
jmp wait2
toomuch:
mov esi,OFMessage
call [PrintString] ; this call the print function.
jmp booboo
done:
sti
; now let's print out what it looks like
; bx points to first empty byte in Buffer
mov ecx,Buffer
mov esi,ecx
mov edx,PBuffer
mov edi,edx
top:
mov ax,word[ds:esi] ; get first hex char from Buffer
mov cx,ax
mov al,ah ; save copy for later
shr al,1
shr al,1
shr al,1
shr al,1
and al,0fh
or al,30h
cmp al,3ah
jl ok1
add al,07h
ok1:
mov byte[ds:edi],al
inc di
mov al,ah
and al,0fh
or al,30h
cmp al,3ah
jl ok2
add al,07h
ok2:
mov byte[ds:edi],al
inc di
mov ax,cx
mov ah,al ; save copy for later
shr al,1
shr al,1
shr al,1
shr al,1
and al,0fh
or al,30h
cmp al,3ah
jl ok3
add al,07h
ok3:
mov byte[ds:edi],al
inc di
mov al,ah
and al,0fh
or al,30h
cmp al,3ah
jl ok4
add al,07h
ok4:
mov byte[ds:edi],al
inc edi
inc esi
inc esi
mov al,','
mov byte[ds:edi],al
inc di
cmp ebx,esi
jg top
mov ch,'?'
mov byte[ds:edi],ch
inc di
mov cx,0d0ah
mov word[ds:edi],cx
inc di
inc di
mov ch,'0'
mov byte[ds:edi],ch
mov esi,PBuffer
call [PrintString] ; this call the print function.
mov esi,NrmMessage
call [PrintString] ; this call the print function.
mov esi,ebx ; save bx (Buffer ptr) for later
mov edx,Buffer ; lets see how many pulses
sub ebx,edx
shr ebx,1
mov edx,PCount
mov edi,edx
mov al,bl ; get first hex char from Buffer
mov ah,al ; save copy for later
shr al,1
shr al,1
shr al,1
shr al,1
and al,0fh
or al,30h
cmp al,3ah
jl ok5
add al,07h
ok5:
mov byte[ds:edi],al
inc edi
mov al,ah
and al,0fh
or al,30h
cmp al,3ah
jl ok6
add al,07h
ok6:
mov byte[ds:edi],al
inc edi
mov esi,PCount
call [PrintString] ; this call the print function.
cleanup:
sti
; uncomment the following code if you want to bypass the IR playback
; turn off the I/O
; mov dx,0e301h ; system control reg
; in al,dx
; and al,11011111b ; turn off I/O
; out dx,al
; jmp byebye ; dont play back yet
; now time to play it back
; si now points to first empty byte in Buffer
mov ebx,esi
mov esi,KeyMessage
call [PrintString] ; this call the print function.
call [WaitForKeyPress]
mov dx,0e301h ; system control reg
in al,dx
or al,04h
out dx,al ; turn on I/O again just to be sure
mov dx,03fbh
mov al,80h
out dx,al ; enable baud rate change
mov dx,03f8h ; baud rate divisor low
mov al,02eh ; 2500 baud
out dx,al ; the IR LED is modulated at 16x the baud
mov dx,03f9h ; rate, so 2500 baud gives 40KHz
mov al,00h ; 2500 baud
out dx,al
; set up IR format to use 16x baud rate to modulate output LED
mov dx,0e30ah ; IRFMAT register address
mov al,00001010b ; MDSEL=1 (UART), MDLTE=1
out dx,al ; enable
mov edx,Buffer
mov edi,edx
mov cx,word[ds:edi] ; get first ones count
and ch,01fh ; don't leave it on too long
inc edi
inc edi
cli ; turn off interrupts
mov dx,0e30bh
mov al,04h ; gate modulated output
out dx,al
test al,04h
jz booboo
cli
mov ax,0004h
mod_one:
out dx,al
test al,04h
loopnz mod_one ; still on
new_zero:
mov al,00h
out dx,al
mov cx,word[ds:edi]
inc di
inc di
cmp ebx,edi ; bx, si jg top
jl byebye
mod_zero:
out dx,al
test al,80h
loopz mod_zero ; still off
next_one:
mov al,04h
out dx,al
mov cx,word[ds:edi]
inc edi
inc edi
cmp ebx,edi
jge mod_one
; all done, go back to DOS
byebye:
sti
mov al,00h
mov dx,0e30bh
out dx,al ; make doubly sure LED is off
; turn off the LEDs, leave I/O on
mov dx,0e30ah ; IRFMAT
in al,dx
and al,00000000b ; turn off all IR formats
out dx,al
booboo:
; turn off thC I/O
mov al,00h
mov dx,0e30bh
out dx,al ; make doubly sure LED is off
sti
; mov dx,0e301h ; system control reg
; in al,dx
; xor al,20h ; turn off I/O
; out dx,al
; all done, go back to Dex4u
ret
; END
;--------------------
Buffer rb 511
PBuffer rb 1028
include 'DexFunctions.inc'
It just waits at the "Waiting for IR input', so you need to reboot to get back to Dex4u.
If you come up with any thing or good info, let me know as it a intersting project for Dex4u 8).
Good luck.
<EDIT> I have run a test program that works on (com 4 ) in win98, but not in Dos, eg: you can hear it and another IR win98 laptop reports IR device near.
But i have tryed com 1,2,3,4 in Dos and nothing, so this means window uses Virtual com 4, so i need to set it up in BIOS :cry: .
I may make a simple IR device with electronics, so it will work with pc with out IR.