flat assembler
Message board for the users of flat assembler.

Index > Main > Output ONLY via ports

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Grr, code which works for setting 80x25 mode under DOS doesn't work in windows driver. Display remains as-is, without any change.

Don't you happen to know what more could i have to do?
Code:
enable_text_mode:
        push    rsi
        cli

        ;---------------------------------------------
        ; Set MISC regs
        mov     dx, 0x3C2  ;VGA_MISC_ADDR
        mov     al, 0x67
        out     dx, al
        iodelay

        mov     dx, 0x3DA  ;VGA_STATUS_ADDR
        mov     al, 0
        out     dx, al
        iodelay

        ;---------------------------------------------
        ; Send SEQ regs
        cld
        mov     cl, 0
        mov     rsi, .seq_regs
.seq_regs_loop:

        ;send register number to 3C4
        mov     dx, 0x3C4  ;VGA_SEQ_ADDR
        mov     al, cl
        out     dx, al
        iodelay

        ;send register value to 3C5
        inc     dx
        lodsb
        out     dx, al
        iodelay

        ;continue loop
        inc     cl
        cmp     cl, 5
        jne     .seq_regs_loop

        ;clear protection bits
        mov     ax, 0x0E11
        mov     dx, 0x3D4  ;VGA_CRTC_ADDR
        out     dx, ax
        iodelay

        ;---------------------------------------------
        ;send CRTC regs
        mov     cl, 0
        mov     rsi, .crtc_regs
.crtc_regs_loop:

        ;send register number to 3D4
        mov     dx, 0x3D4  ;VGA_CRTC_ADDR
        mov     al, cl
        out     dx, al
        iodelay

        ;send register value to 3D5
        lodsb
        inc     dx
        out     dx, al
        iodelay

        ;continue CRTC regs loop
        inc     cl
        cmp     cl, 25
        jb      .crtc_regs_loop

        ;---------------------------------------------
        ;send GRAPHICS regs
        mov     cl, 0
        mov     rsi, .graphics_regs
.graphics_regs_loop:

        ;send register number to 3CE
        mov     dx, 0x3CE ;VGA_GRAPHICS_CONTROLLER_ADDR
        mov     al, cl
        out     dx, al
        iodelay

        ;send register value to 3CF
        lodsb
        inc     dx
        out     dx, al
        iodelay

        ;continue GRAPHICS loop
        inc     cl
        cmp     cl, 9
        jb      .graphics_regs_loop

        ;---------------------------------------------
        ;send ATTRCON regs
        mov     cl, 0
        mov     rsi, .attrcon_regs
.attrcon_regs_loop:
        ;??? read from 3C0
        mov     dx, 0x3C0 ;VGA_ATTRCON_ADDR
        in      ax, dx

        ;send register number to 3C0
        mov     al, cl
        out     dx, al
        iodelay

        ;send register value to 3C0
        lodsb
        out     dx, al
        iodelay

        ;continue ATTRCON loop
        inc     cl
        cmp     cl, 21
        jb      .attrcon_regs_loop

        ;send 20h to 3C0
        mov     al, 20h
        out     dx, al
        iodelay

.done:  sti
        pop     rsi
        retn


.seq_regs          db 03H,00H,03H,00H,02H

.crtc_regs         db 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,4FH
                   db 0DH,0EH,00H,00H,00H,50h,9CH,0EH,8FH,28H
                   db 1FH,96H,0B9H,0A3H,0FFH

.graphics_regs     db 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH

.attrcon_regs      db 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H
                   db 3AH,3BH,3CH,3DH,3EH,3FH,0CH,00H,0FH,08H
                   db 00H
    
Post 17 Jul 2007, 15:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Hello Very Happy
Note that this code is valid only for change vga mode ,but if you are under high resolution video mode like vesa you must program other register, not belong to vga ,debug your vesa function for this Wink
Post 17 Jul 2007, 16:32
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I am not under VESA, i am under Windows booted into VGA mode (switch /basevideo in boot.ini). But resolution is 640x480 (minimal for windows), so it probably isn't just plain VGA...
Post 17 Jul 2007, 17:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
windows on 640*480 4bit ? Laughing
no it's vesa 640*480 256 color Wink
Post 17 Jul 2007, 17:27
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
*singing* ("In N' Out" by Van Halen)

"got you goin' in, they got you comin' out
Same amount, in 'n' out"

Laughing Sorry, that's all this reminds me of. Wink
Post 17 Jul 2007, 19:20
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
DJ Mauretto: personally i doubt windows uses VESA. Maybe it has it's VESA-like driver, improperly called VGA. And anyway, i can't use VESA, or BIOS, or alikes, i have to access ports on my own Sad
Post 17 Jul 2007, 20:57
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
vid wrote:
DJ Mauretto: personally i doubt windows uses VESA. Maybe it has it's VESA-like driver, improperly called VGA. And anyway, i can't use VESA, or BIOS, or alikes, i have to access ports on my own Sad


Bah, if you're in driver code, set up a v86 context and call BIOS from that Wink

...or perhaps use a kernel API to change video mode?

_________________
Image - carpe noctem
Post 17 Jul 2007, 23:53
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
@vid, As well as your above code, do you not need to also reprogram fonts ?, as bubach use to use this meford for mode changing in BOS (but he later changed to switching to and from pmode to real mode for mode change )

PS: Here some code on his site:
http://bos.asmhackers.net/docs/vga_without_bios/snippet_3/tauron30/ASM_SRC/
Post 18 Jul 2007, 01:28
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Vesa or not Vesa , certainly it's no VGA...
My pc with Xp pro booted in vga mode give me a 640x480 8bit (256 color)..
I don't recognize no one Vga Mode or Mode x with this resolution.
Maybe it's another M$ secret ?
Post 18 Jul 2007, 07:30
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Bah, if you're in driver code, set up a v86 context and call BIOS from that

i was considering that, unfortunately it's outside my abilities right now Sad got any examples?

Quote:
...or perhaps use a kernel API to change video mode?

Any idea which one it might be? Wink

Quote:
@vid, As well as your above code, do you not need to also reprogram fonts ?

Yes, but this code alone should be enough to see that display has changed. And it doesn't
Post 18 Jul 2007, 07:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Have you tried this code ?
Code:
      mov     esi, mode0x03         call    set_regs;somemore code here;---------------------------------;;  Set VGA regs to choosen mode   ;;           internal use.         ;;---------------------------------;set_regs:    cli   mov     dx, 0x3C2     lodsb         out     dx, al      mov     dx, 0x3DA     lodsb         out     dx, al      xor     ecx, ecx      mov     dx, 0x3C4     .l1:      lodsb         xchg    al, ah        mov     al, cl        out     dx, ax        inc     ecx   cmp     cl, 4         jbe     .l1         mov     dx, 0x3D4     mov     ax, 0x0E11    out     dx, ax      xor     ecx, ecx      mov     dx, 0x3D4     .l2:      lodsb         xchg    al, ah        mov     al, cl        out     dx, ax        inc     ecx   cmp     cl, 0x18      jbe     .l2         xor     ecx, ecx      mov     dx, 0x3CE     .l3:      lodsb         xchg    al, ah        mov     al, cl        out     dx, ax        inc     ecx   cmp     cl, 8         jbe     .l3         mov     dx, 0x3DA     in      al, dx      xor     ecx, ecx      mov     dx, 0x3C0     .l4:      in      ax, dx        mov     al, cl        out     dx, al        lodsb         out     dx, al        inc     ecx   cmp     cl, 0x14      jbe     .l4         mov     al, 0x20      out     dx, al      sti   ret     ;---------------------;     ;  VGA mode values.   ;     ;---------------------;       mode0x03        db   0x67, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x5F, 0x4F                     db   0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x4F, 0x0E                     db   0x0F, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x0E, 0x8F, 0x28                     db   0x01, 0x96, 0xB9, 0xA3, 0xFF, 0x00, 0x00, 0x00, 0x00                     db   0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x01, 0x02, 0x03                     db   0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C                     db   0x3D, 0x3E, 0x3F, 0x0C, 0x00, 0x0F, 0x08, 0x00    
Post 18 Jul 2007, 15:49
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
basically, yes. I just didn't write word at a time, i wrote first index of register, and then value to port higher by one.

also, i don't have reading from 3DA before last loop.

I would try this, but i am busy right now. I'll give it a try later
Post 18 Jul 2007, 16:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Hello Very Happy
i have found a extended bios mode in my doc,perhaps it is useful for you to know this..
this mode is 640x480 256 color , it seems just that used from windows.

mov ax,0030h
int 10h

Wink
Post 18 Jul 2007, 18:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
DJ Mauretto: Again, I can't use BIOS. Also, I strongly doubt windows uses BIOS
Post 18 Jul 2007, 19:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
ok thinks to windows at first installation without no video driver , it has need
to set video mode... if you try to uninstall video driver and boot to vga mode
it use bios to set video , probably extended video mode 30H...
I know that you cannot use the bios , but you can debug int 10h mode 30h
to try which registries uses Idea
it is only a idea ,I would make in this way...
but don't worry I will not reply more to this post Wink
Post 18 Jul 2007, 19:28
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
ok thinks to windows at first installation without no video driver
Why do you thing it's without driver? AFAIK there is VGA.SYS
Post 18 Jul 2007, 20:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.