DOS and Interrupts
-
- Posts: 613
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
DOS and Interrupts
AS the subject says :-)
Basically I want to call interrupt 10h to change the video mode, for example
or should i do it with some inline assembly? still if it was possible I'd love to use the good ole call interrupt ;-).
Basically I want to call interrupt 10h to change the video mode, for example
or should i do it with some inline assembly? still if it was possible I'd love to use the good ole call interrupt ;-).
Here you are (haven't you read the examples yet? :P):
Code: Select all
#include "dos/dpmi.bi"
dim r as __dpmi_regs
r.x.ax = &H13
__dpmi_int(&H10, @r) ' change to VGA mode 13h
-
- Posts: 613
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
int 21h
ah=9
ds:dx=seg:off
freeBASIC not SEG,
How Get SEG and OFF??
DEMO:
.................dpmi.bi"
test$="123456"+"$"
strADD=sadd(test$)
strSEG=strADD\&h10
strOFF=strADD-srtSEG*&h10
......ax=&H900
......ds=strSEG
......dx=srtOFF
......int 21
run ......
error display
i need a example
please give me
(sorry ,I am CHINA men)
ah=9
ds:dx=seg:off
freeBASIC not SEG,
How Get SEG and OFF??
DEMO:
.................dpmi.bi"
test$="123456"+"$"
strADD=sadd(test$)
strSEG=strADD\&h10
strOFF=strADD-srtSEG*&h10
......ax=&H900
......ds=strSEG
......dx=srtOFF
......int 21
run ......
error display
i need a example
please give me
(sorry ,I am CHINA men)
To transfer data between DOS memory (real mode) and your applications memory (protected mode) is a bit more difficult.
You have two ways:
To transfer the memory between DOS and your application, I'd prefer movedata() from inc/dos/go32.bi.
To get you applications "normal" data selector, you can use _my_ds() from the same header file.
Here's an example of a procedure using the second method: http://www.freebasic.net/forum/viewtopic.php?p=2766
Regards,
Mark
You have two ways:
- For a small amount of data you can simply use the GO32 transfer buffer
See _go32_info_block in inc/dos/go32.bi. You get a linear address and a segment - Or you can allocate your own transfer buffer
inc/dos/dpmi.h
See _go32_dpmi_allocate_dos_memory or __dpmi_allocate_dos_memory.
__dpmi_allocate_dos_memory returns the selector to the DOS memory block in the second argument. The DOS segment is returned directly.
Allocating the memory using _go32_dpmi_allocate_dos_memory is almost the same.
To transfer the memory between DOS and your application, I'd prefer movedata() from inc/dos/go32.bi.
To get you applications "normal" data selector, you can use _my_ds() from the same header file.
Here's an example of a procedure using the second method: http://www.freebasic.net/forum/viewtopic.php?p=2766
Regards,
Mark
Code: Select all
''
'' example of calling DOS interrupt requiring a pointer
''
#include "dos/dpmi.bi"
#include "dos/dos.bi"
#include "dos/sys/movedata.bi"
option explicit
option escape
sub print_dos(s as string)
dim s2 as string
dim dos_seg as integer, dos_sel as integer
dim regs as __dpmi_regs
s2 = s + "$" '' this is inefficient; better to use _farpokeb to add $ in low memory
dos_seg = __dpmi_allocate_dos_memory((Len(s2) + 15) \ 16, @dos_sel)
if dos_seg = 0 then exit sub ' out of memory
dosmemput(strptr(s2), len(s2), dos_seg * 16)
regs.h.ah = &H09
regs.x.dx = 0
regs.x.ds = dos_seg
__dpmi_int(&H21, @regs)
__dpmi_free_dos_memory(dos_sel)
end sub
print_dos("Hello ")
print_dos("World\n")
thank you!! ^_^
use _farpokeb to add $ in low memory??
brief and to the point example
please use this databook!
------------------ INT 13-----------------------------
DISK - READ SECTOR(S) INTO MEMORY
AH = 02h
AL = number of sectors to read (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
Return: CF set on error
------------------------------------------------------
use _farpokeb to add $ in low memory??
brief and to the point example
please use this databook!
------------------ INT 13-----------------------------
DISK - READ SECTOR(S) INTO MEMORY
AH = 02h
AL = number of sectors to read (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
Return: CF set on error
------------------------------------------------------
Re:
Sorry for bumping this old thread. I'm definitely not a systems programmer, but ...etko wrote:Anyway isn't it possible to get PMODE video BIOS routine address by calling special INT 10h subfuncion and then use VBIOS directly from PMODE without switching to RMODE?
Since FreeBASIC for DOS uses DJGPP v2, it's all DPMI all the time, which basically guarantees that you can call any interrupt (DOS, BIOS), without the address translation (int 31h, 300h), if you're not using references to data addresses. In other words, any register-based call (int 10h, 0013h) should presumably pass through and work correctly. Whether that goes to real mode or V86 mode (and thus incurring whatever very minimal speed penalty) is up to the DPMI host and cpu.
Code: Select all
ASM
mov ah,0xE
mov al,0x48
int 0x10
mov al,0x69
int 0x10
END ASM