flat assembler
Message board for the users of flat assembler.

Index > Main > Universal Graphic Interface

Author
Thread Post new topic Reply to topic
batment



Joined: 12 Nov 2006
Posts: 3
Location: Kriviy Rih, Ukraine
batment 04 Apr 2009, 13:37
I need to work in 320*200, 256 colors video mode both on windows, linux and dos, diserably without any ready library such as OpenGL or SDL. In what direction I have to search?
Post 04 Apr 2009, 13:37
View user's profile Send private message ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 04 Apr 2009, 13:59
For Dos it's a VGA standard mode (13h)
For windows without API you cannot control directly the video
For Linux i don't know Razz
anyway for dos you must set the video mode in this way:
Code:
mov ax,0013h
int 6dh    

then you can write pixel at base address A000h in this way:
Code:
mov bx,0a000h
mov al,09h   ; blu
mov cx,320*200
mov es,bx
xor di,di
cld
rep  stosb       ; fill the screen with blu    

_________________
Nil Volentibus Arduum Razz
Post 04 Apr 2009, 13:59
View user's profile Send private message Reply with quote
batment



Joined: 12 Nov 2006
Posts: 3
Location: Kriviy Rih, Ukraine
batment 04 Apr 2009, 14:25
In windows you mean Win API?
Post 04 Apr 2009, 14:25
View user's profile Send private message ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 04 Apr 2009, 14:28
Yes, if you don't want use any library and make low level
video programming ,it's possible only under dos or real mode with VGA standard ( your 320*200 256 is vga standard mode)

_________________
Nil Volentibus Arduum Razz
Post 04 Apr 2009, 14:28
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 04 Apr 2009, 16:57
DJ Mauretto wrote:

anyway for dos you must set the video mode in this way:
Code:
mov ax,0013h
int 6dh    
int 10h is the standard. I don't think all video BIOSes handle int 6dh.
Post 04 Apr 2009, 16:57
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 04 Apr 2009, 17:45
OOPS Embarassed
Sorry i'm a beginner

_________________
Nil Volentibus Arduum Razz
Post 04 Apr 2009, 17:45
View user's profile Send private message Reply with quote
buzzkill



Joined: 15 Mar 2009
Posts: 111
Location: the nether lands
buzzkill 04 Apr 2009, 19:37
AFAIK for linux it's the same as for windows: you can't access video memory directly. I think all modern (ie multi-user, multi-tasking) OSes are the same in that respect: one single process can't (and won't) be allowed to directly manipulate the video memory.
Post 04 Apr 2009, 19:37
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 05 Apr 2009, 03:14
Mode 0x13 (320x200x256) can be tweaked into mode X (320x240x256) by unchaining the video memory array and setting up some vga registers.

Advantages of mode 0x13:

Memory is aligned by 'byte' boundary hence 256 colors. 1 byte per pixel.
This makes for easy scan line rendering, but only one pixel at a time.
Because of this we can easily convert xy to linear address.

Code:
   index = y * 320 + x
   or...
   index = (y << 6) + (y << 8) + x
    


Disadvantages of mode 0x13:

Only one page of 64k video memory is used, the rest is wasted.
The aspect ratio does not make for square pixels.

Advantages of mode X:

Four planes of unchained video memory can be used, with little wasted.
The aspect ration is 1:1 which gives us perfectly square pixels.
Horizontal pixel operations can be done by writing 4 pixels at a time.
Thus scanline rendering can be done extremely fast.

Disavantages of mode X:

By unchaining the array it makes for slow single pixel operations.
Index is a bit harder to calculate when we have 4 planes of memory.

If you are just learning, go ahead and get used to mode 0x13.
When you feel you are ready then do some research on mode X.
I warn you, mode X is no easy task to setup, but well worth it later when you start to fill polygons and such.
Code:
    
Post 05 Apr 2009, 03:14
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 05 Apr 2009, 03:20
Quote:
I need to work in 320*200, 256 colors video mode both on windows, linux and dos, diserably without any ready library such as OpenGL or SDL. In what direction I have to search?


DOS : INT $10 AX=$13 http://www.ctyme.com/intr/rb-0069.htm http://board.flatassembler.net/topic.php?t=9147

Win32: http://board.flatassembler.net/topic.php?t=9174

You can brew a dual-mode EXE for DOS + Win32, but not (reasonably) for DOS + Lniux.
Post 05 Apr 2009, 03:20
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 14 Apr 2009, 20:11
DOS386 wrote:

You can brew a dual-mode EXE for DOS + Win32, but not (reasonably) for DOS + Lniux.


The closest I've ever seen was Josh Vanderhoof's Cross ELF linker tool (DOS, Win32, Linux) w/ 3D raytracing example.
Post 14 Apr 2009, 20:11
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 14 Apr 2009, 20:31
Can you explain why you don't want to use libraries? I think that for almost any scenario, SDL would be perfect match, extremely simple to use, and very lightweight.
Post 14 Apr 2009, 20:31
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:  


< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.