This program changing video mode 1024*768 LFB (with VESA)
And filling screen area.

In nativ msdos6.22 work correct.
In DOSBOX emulator in xp work correct.
In MS VirtualPC in xp not work. Changing mode but filling first 64k and HALT.

VPC starting booting dos6.22 - univbe vbetest program  correct all bankink and linear frama buffer mode.










.386p

assume cs:x_code
assume ds:x_data
assume ss:x_stack

      .model small, stdcall
      option casemap :none



x_data segment para public 'DATA' use16

x_data ends







        GDI_SetVideoMode        PROTO  :DWORD



GDI_VESA_640x400        equ 4100h ; 640x400x256
GDI_VESA_640x480        equ 4101h ; 640x480x256
GDI_VESA_800x600        equ 4103h ; 800x600x256
GDI_VESA_1024x768      equ 4105h ; 1024x768x256
GDI_VESA_1280x1024      equ 4107h ; 1280x1024x256

ModeInfoBlock  struc

    ; Mandatory information for all VBE revisions
    ModeAttributes      dw ?      ; mode attributes
    WinAAttributes      db ?      ; window A attributes
    WinBAttributes      db ?      ; window B attributes
    WinGranularity      dw ?      ; window granularity
    WinSize            dw ?      ; window size
    WinASegment        dw ?      ; window A start segment
    WinBSegment        dw ?      ; window B start segment
    WinFuncPtr          dd ?      ; pointer to window function
    BytesPerScanLine    dw ?      ; bytes per scan line

    ; Mandatory information for VBE 1.2 and above
    XResolution        dw ?      ; horizontal resolution in pixels or chars
    YResolution        dw ?      ; vertical resolution in pixels or chars
    XCharSize          db ?      ; character cell width in pixels
    YCharSize          db ?      ; character cell height in pixels
    NumberOfPlanes      db ?      ; number of memory planes
    BitsPerPixel        db ?      ; bits per pixel
    NumberOfBanks      db ?      ; number of banks
    MemoryModel        db ?      ; memory model type
    BankSize            db ?      ; bank size in KB
    NumberOfImagePages  db ?      ; number of images
    Reserved1          db ?      ; reserved for page function

    ; Direct Color fields (required for direct/6 and YUV/7 memory models)
    RedMaskSize        db ?      ; size of direct color red mask in bits
    RedFieldPosition    db ?      ; bit position of lsb of red mask
    GreenMaskSize      db ?      ; size of direct color green mask in bits
    GreenFieldPosition  db ?      ; bit position of lsb of green mask
    BlueMaskSize        db ?      ; size of direct color blue mask in bits
    BlueFieldPosition  db ?      ; bit position of lsb of blue mask
    RsvdMaskSize        db ?      ; size of direct color reserved mask in bits
    RsvdFieldPosition  db ?      ; bit position of lsb of reserved mask
    DirectColorModeInfo db ?      ; direct color mode attributes

    ; Mandatory information for VBE 2.0 and above
    PhysBasePtr        dd ?      ; physical address for flat frame buffer
    OffScreenMemOffset  dd ?      ; pointer to start of off screen memory
    OffScreenMemSize    dw ?      ; amount of off screen memory in 1k units
    Reserved2            db 206 dup (?)  ; remainder of ModeInfoBlock
ModeInfoBlock ends




x_data segment para public 'DATA' use16
gdi_seg_id      db      'GDI'

vesabuf        db      1024 dup (0)
vesasign        db      'VESA'
db 1024 dup (0)



x_data ends

x_code segment para public 'CODE' use16
GDI_ScreenAddr  dd      0
        assume  ds:x_data

GDI_SetVideoMode        proc    mode:DWORD
        mov    es,cs:
        mov    eax,4f02h
        mov    ebx,
        int    10h
        mov    ax,4f01h
        mov    ecx,
        mov    edi,offset vesabuf
        int    10h
        mov    ebx,ModeInfoBlock.PhysBasePtr
        mov    edi,offset vesabuf
        add    edi,ebx
        mov    eax,
        mov    cs:,eax
        ret

GDI_SetVideoMode        endp



x_code ends


x_code segment para public 'CODE' use16

x_data_seg dw seg x_data
x_stack_seg dw seg x_stack
d_memory_seg    dw      seg memory
d_psp_seg dw 0



start:

        mov    cs:,ds
        mov    bx,cs:
        mov    ax,ds
        sub    bx,ax
        mov    ax,4a00h
        int    21h

mov ds,cs:

mov ax,cs:
cli
mov ss,ax
mov sp,50000
sti

invoke GDI_SetVideoMode,GDI_VESA_1024x768


xor eax,eax
mov es,ax
toci:
mov ecx,1024*768/4
        mov    ebx,cs:

xx:
mov es:,eax
add ebx,4
dec ecx
jnz xx
add eax,010101010h
jmp toci


x_code ends



x_stack segment public 'STACK' use16

dw 25000 dup (?)

stack_pointer label word

x_stack ends


memory  segment para memory 'memmory' use16
memory  ends


end start
end


Posted on 2006-11-05 12:13:07 by korte

        mov    ecx,
        mov    edi,offset vesabuf
        int    10h




        mov    ecx,
        and ecx,1ffh ; mask LFB bit
        mov    edi,offset vesabuf
        int    10h
Posted on 2006-11-05 13:43:10 by kisj
If I don't get wrong, you are trying to access LFB in Real Mode
That's not always posible, check the PhyMem address, for instance; in VMWare I have got a address 0xE0000000 !!!!
This is even out of bounds of memory but that's valid !

If I were you, I will check the address
Posted on 2006-11-05 14:18:15 by Dite
YEEEEES KISJ

and ecx,1ffh ; mask LFB bit


work.

thx.
Posted on 2006-11-05 16:11:22 by korte