flat assembler
Message board for the users of flat assembler.
Index
> DOS > Output Pixel! |
Author |
|
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).
|
|||
24 Dec 2004, 14:21 |
|
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!? |
|||
24 Dec 2004, 15:21 |
|
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. |
|||
24 Dec 2004, 16:01 |
|
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! |
|||
24 Dec 2004, 22:59 |
|
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. |
|||
25 Dec 2004, 03:26 |
|
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!! |
|||
25 Dec 2004, 14:57 |
|
vbVeryBeginner 25 Dec 2004, 15:37
|
|||
25 Dec 2004, 15:37 |
|
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. |
|||
25 Dec 2004, 20:30 |
|
vid 25 Dec 2004, 22:54
get "pcgpe" (i hope), i think it i games programing encyclopedia or something like that.
|
|||
25 Dec 2004, 22:54 |
|
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? |
|||
24 Jan 2005, 17:32 |
|
windwakr 16 Feb 2005, 18:33
heres pcgpe(its in my favorites) http://www.qzx.com/pc-gpe/
|
|||
16 Feb 2005, 18:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.