Greetings,
I found on my manuals an FDC port descriptions. The third (3rd) bit on port 3F2h was "Enable DMA and interrupts". If I set it to 1 (DMA active), would it speed up my operations with real mode disk service INT 13h? Or I must read and write to the floppy only by using FDC ports to acheive the DMA result? (Does INT 13h always operate in PIO?)
I am planning on creating a GUI for my OS, in VESA. I readed somewhere that using linear framebuffer is better than banking mode. Can you please direct me to some step-by-step tutorials that will perform a simple initialization and object drawing (assembly)? Thanks.
inflater
DMA and VESA LFB
DMA and VESA LFB
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Re: DMA and VESA LFB
No, BIOS service won't be prepared for that in the worst case, and will likely overwrite the bit contents when it gets called.inflater wrote:Greetings,
I found on my manuals an FDC port descriptions. The third (3rd) bit on port 3F2h was "Enable DMA and interrupts". If I set it to 1 (DMA active), would it speed up my operations with real mode disk service INT 13h?
At least that's how I do it, and it's the way every single programming example I've seen does it (even real mode examples).inflater wrote:Or I must read and write to the floppy only by using FDC ports to acheive the DMA result? (Does INT 13h always operate in PIO?)
And anybody knows simple "draw-window" tutorials in ASM about VESA linear fbufer?... Thanks for advice.
inflater
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Here's what you need do first, LFB is only good for Pmode, i think it should be OK for unreal-mode, but not for realmode.
First in realmode you call a int 10h function to test for vesa and modes etc.
Then you call another int 10h function to fill a list of info, in this list is the address of lfb, by writing to this address you can code for vesa just like mode 13h .
Simple demo, of vesa 640x480x32bpp, fade screen (note: it goes to pmode).
vesa.inc
You need to assemble with fasm to bin file and use rawrite to put it on floppy to test.
Note: some vesas use 24bpp and it does not check for that in this code, but you will need to (eg: if you get black lines, it users 24bpp) also the vesa info list is a shottened ver.
ps: you will in most case to use full screen need to enable A20.
First in realmode you call a int 10h function to test for vesa and modes etc.
Then you call another int 10h function to fill a list of info, in this list is the address of lfb, by writing to this address you can code for vesa just like mode 13h .
Simple demo, of vesa 640x480x32bpp, fade screen (note: it goes to pmode).
Code: Select all
;************************************
; By Dex
;
; Assemble with fasm
; c:\fasm vesa.asm vesa.bin
;
;************************************
org 0x7C00
use16
;****************************
; Realmode startup code.
;****************************
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7C00
;****************************
; Fill Vesa info list.
;****************************
mov bx,4112h ;640x480x32bpp screen mod
mov ax,4f01h
mov di,Mode_Info ;info block
mov cx,bx
int 10h
;*****************************
; Switch to vesa mode.
;*****************************
mov ax,4f02h
int 10h
;*****************************
; Setting up, to enter pmode.
;*****************************
cli
lgdt [gdtr]
mov eax, cr0
or al,0x1
mov cr0,eax
jmp 0x10: protected
;*****************************
; Pmode. ;-)
;*****************************
use32
protected:
mov ax,0x8
mov ds,ax
mov es,ax
mov ss,ax
mov esp,0x7C00
;*****************************
; Turn floppy off (if space).
;*****************************
mov dx,3F2h
mov al,0
out dx,al
;*****************************
; fade background screen.
;*****************************
fade_screen:
mov edx,[ModeInfo_PhysBasePtr]
mov edi,edx
xor eax,eax
mov al,0xc5
xor ebx,ebx
mov bl,195
DoLoop:
mov cx,640*2
dec eax
rep stosd
dec ebx
jnz DoLoop
;*****************************
; Just loop.
;*****************************
jmp $
;*************************************
; GDT.
;*************************************
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:
gdtr: dw gdt_end - gdt - 1
dd gdt
;*************************************
; Make program 510 byte's + 0xaa55
;*************************************
times 510- ($-start) db 0
dw 0xaa55
;*************************************
; Put uninitialized data here.
;*************************************
include 'vesa.inc'
Code: Select all
;=========================================================;
; Vesa Information Block 11/12/03 ;
;---------------------------------------------------------;
; DOS EXTREME OS V0.01 ;
; by Craig Bamford(Dex). ;
; ;
;=========================================================;
Mode_Info:
ModeInfo_ModeAttributes rw 1
ModeInfo_WinAAttributes rb 1
ModeInfo_WinBAttributes rb 1
ModeInfo_WinGranularity rw 1
ModeInfo_WinSize rw 1
ModeInfo_WinASegment rw 1
ModeInfo_WinBSegment rw 1
ModeInfo_WinFuncPtr rd 1
ModeInfo_BytesPerScanLine rw 1
ModeInfo_XResolution rw 1
ModeInfo_YResolution rw 1
ModeInfo_XCharSize rb 1
ModeInfo_YCharSize rb 1
ModeInfo_NumberOfPlanes rb 1
ModeInfo_BitsPerPixel rb 1
ModeInfo_NumberOfBanks rb 1
ModeInfo_MemoryModel rb 1
ModeInfo_BankSize rb 1
ModeInfo_NumberOfImagePages rb 1
ModeInfo_Reserved_page rb 1
ModeInfo_RedMaskSize rb 1
ModeInfo_RedMaskPos rb 1
ModeInfo_GreenMaskSize rb 1
ModeInfo_GreenMaskPos rb 1
ModeInfo_BlueMaskSize rb 1
ModeInfo_BlueMaskPos rb 1
ModeInfo_ReservedMaskSize rb 1
ModeInfo_ReservedMaskPos rb 1
ModeInfo_DirectColorModeInfo rb 1
; VBE 2.0 extensions
ModeInfo_PhysBasePtr rd 1
ModeInfo_OffScreenMemOffset rd 1
ModeInfo_OffScreenMemSize rw 1
Note: some vesas use 24bpp and it does not check for that in this code, but you will need to (eg: if you get black lines, it users 24bpp) also the vesa info list is a shottened ver.
ps: you will in most case to use full screen need to enable A20.