flat assembler
Message board for the users of flat assembler.

Index > DOS > Output Pixel!

Author
Thread Post new topic Reply to topic
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_ 24 Dec 2004, 12:39
Hello!
How can I output a pixel in DOS with DOES interrupts!?
I only know how to do it with BIOS interrupts!
How can I set resolution and output a pixel? And is it possible to set screen resolution from DOS to 1024x768? And can soeone please give me an example how to output a pixel in realmode with direct writing to memory? Thank you!
Post 24 Dec 2004, 12:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 Dec 2004, 14:21
no DOS doesn't handle graphics, it is done (under DOS) by VESA, look for some VESA reference and tutorial (otherwise you have to code your "own VESA", eg. detect card and call proper routines for that particular card).
Post 24 Dec 2004, 14:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_ 24 Dec 2004, 15:21
Thank you!
But how can I output pixel direct writing to memory! All I know is that Video memory starts from 0xb800! Can you please give me an example!?
Post 24 Dec 2004, 15:21
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 24 Dec 2004, 16:01
Here is a simple game demo to get you started:
Code:
; small game demo, compile with fasm.; c:\fasm game.asm game.comorg 0x100use16start:        mov   al,0x13        int   0x10LetsGo:        push  word 0x8000        pop   es        push  cs        pop   ds        mov   cx,0xffff        mov   al,20        rep   stosb        call  PutLine        mov   si,BallY2        mov   bx,[si-6]        mov   dx,[si-4]        cmp   dx,195        jb    CmpY        jmp   NegYCmpY:        cmp   dx,1        jg    AddYNegY:        neg   word [si]AddY:        add   dx,[si]        sub   si,2        cmp   bx,310        jb    CmpX        jmp   NegXCmpX:        cmp   bx,6        jg    AddXNegX:            neg   word [si]AddX:        add   bx,[si]        sub   si,8        mov   di,dx        imul  di,320        add   di,bx        mov   cl,4BALL:        mov   [es:di], dword 0x5C5C5C5C        add   di,320        loop  BALL        mov   [si+4],bx        mov   [si+6],dx        push  es        pop   ds        push  word 0xA000        pop   es        mov   cx,32000        xor   si,si        mov   di,si        rep   movsw        mov   ah,0x11        int   0x16        jz    LetsGo        mov   ax,0x0003        int   0x10        retPutLine:        mov   al,15       mov   di,158                                        mov   cl,198Dog:    add   di,319                        stosb                        loop  Dog        xor   di,di                                 call  Hline        xor   dx,dx                      xor   di,di        mov   cl,199                Gridlp3:        stosb                        add   di,318        stosb                   loop  Gridlp3        call  Hline        ret               Hline:        mov   al,15        mov   cx,319        rep   stosb                        retBallX1   dw      160BallY1   dw      100BallX2   dw      -1BallY2   dw      -1    

The above code will give you a pong game with built in AI, study and let me know if you need more help.

PS: do not use dos or bios int's for put pixel too slowwwwwww!.

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 24 Dec 2004, 16:01
View user's profile Send private message Reply with quote
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_ 24 Dec 2004, 22:59
Thank you!
The game is interesting. I like that ball "tail" effect. Can you please show me how to output only one pixel by direct writing to memory! For me its hard to understand how to do that from your code, its long and I'm a n00b! Sad
Post 24 Dec 2004, 22:59
View user's profile Send private message Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 25 Dec 2004, 03:26
Here try this:
Code:
;******************************; puts a pixel on screen; using direct memory;; \\|//; (@ @); ASHLEY4.; c:\fasm pixel.asm pixel.com;******************************org 0x100use16start:        mov     al,0x13       ; this is for seting graphic mode (32x200 256 color)        int     0x10        push    word 0xA000   ; set the address up        pop     es        push    cs        pop     ds        mov     di,0          ; when this is 0 we are at the top left hand corner                              ; eg replace the 0 with 320*100 will put the pixel                              ; 1/2 way down the screen.        mov     al,0xf        ; this is the color of pixel        stosb                 ; this mov a byte from al to [es:di]        xor     ax,ax         ; wait for a a keypress        int     0x16        mov     ax,0x0003     ; back to text mode        int     0x10        ret                   ; exit.    

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 25 Dec 2004, 03:26
View user's profile Send private message Reply with quote
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_ 25 Dec 2004, 14:57
Thank you very much!!!
And one more thing! Can you please show me how to output a character by writing directly to memory? And how can I setup resolution 1024x768? Thank you!!
Post 25 Dec 2004, 14:57
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 25 Dec 2004, 15:37
this link should provide much information

http://www3.telus.net/alexander_russell/
Post 25 Dec 2004, 15:37
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 25 Dec 2004, 20:30
When you say "character" do you mean in text or graphic mode.
Also you will need vesa, for that size graphic mode, here how, to do that from dos
(you need a vesa complant graphic card).

Code:
 mov ax,4f02h  ;set vesa 1.0 screen mode mov bx,101h  ;640*480*256 ;look for the vesa number for graphic size int 10h  mov dx,0xa000 mov ds,dx              ;sets up registers call window rain: xor dx,dx      ;(pages-1)  mouse: push dx call window xor bx,bx mov al, 0cch call dog pop dx cmp dx,4                ; devide the screen size by 64k, -1 and replace the 4 with the number. je rain inc dx mov ah,01h int 16h                   ; have we pressed a key,if no then loop jz mouse  mov ax,0003h       ;back to text mode. int 10h  mov ax,4c00h      ; This is just  int 21h                ; for test ,take it out in your OS   window: mov ax,4f05h    ;vesa 1 window select mov bx,0 int 10h        ;dx is  the reqired window xor bx,bx ret  dog:        ;(4*2^16)+45056 pixels mov [bx],al inc bx cmp bx,$00000 jne dog ret      

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
Post 25 Dec 2004, 20:30
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Dec 2004, 22:54
get "pcgpe" (i hope), i think it i games programing encyclopedia or something like that.
Post 25 Dec 2004, 22:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 24 Jan 2005, 17:32
XOR AH,AH
MOV AL,92 ; or 95 decimal, not hex (99?) Non Vesa
INT 10h ; set video mode

Use bank switching.
0xA000 is the video memory address to write pixels to.
Doesn't work with ATI? video cards?
640x480 or 800x600 or 1024x768? resolution (Redneck Rampage stuff)
I would have to do some homework to get my above facts straight,
but you can expierment with the info and maybe get somewhere?
Post 24 Jan 2005, 17:32
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 16 Feb 2005, 18:33
heres pcgpe(its in my favorites) http://www.qzx.com/pc-gpe/
Post 16 Feb 2005, 18:33
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.