How to create simple graphics using ASM - Help !

  • Follow


I'm relatively new to assembly. I want to create graphics using the
video memory(B8000) directly. i've been able to create graphics using a
blank character with a coloured background in 80x25 mode.
1)  Whats the memory scheme if I increase trhe resolution ?
2) Will I be able to print text(at same size) if I choose a higher
resolution mode (say, using  int2h)?
3)Any good sites where i can find more resources on this subject

0
Reply spamtrap2 (1628) 1/28/2006 1:35:25 AM

Hello ....?

spamtrap@crayne.org schrieb:
> I'm relatively new to assembly. I want to create graphics using the
> video memory(B8000) directly. i've been able to create graphics using a
> blank character with a coloured background in 80x25 mode.

Do you want graphics on a text mode, by modifying the chars of the ASCIIs?

> 1)  Whats the memory scheme if I increase trhe resolution ?

The memory adress of graphicmodi is a 64K-bank in A0000
and for linear vesamodi(vesa.org) the adress vary in the 4th GB.

The scheme of the memory, vary by mode of 8/16/24/32-bit color.
For 8 bit-color(256) every byte represents a pixel.

> 2) Will I be able to print text(at same size) if I choose a higher
> resolution mode (say, using  int2h)?

DOS-int 21h?

Many graphic cards also provide text stdout to some graphicmodi.

Dirk

0
Reply Dirk 1/28/2006 6:15:08 AM


hi,
spamtrap@crayne.org wrote:
> I'm relatively new to assembly. I want to create graphics using the
> video memory(B8000) directly. i've been able to create graphics using a
> blank character with a coloured background in 80x25 mode.
> 1)  Whats the memory scheme if I increase trhe resolution ?
> 2) Will I be able to print text(at same size) if I choose a higher
> resolution mode (say, using  int2h)?
> 3)Any good sites where i can find more resources on this subject

search for michel abrash. zen of graphics programming.

0
Reply Das 1/28/2006 3:47:38 PM

spamtrap@crayne.org wrote:
>
>I'm relatively new to assembly. I want to create graphics using the
>video memory(B8000) directly. i've been able to create graphics using a
>blank character with a coloured background in 80x25 mode.
>1)  Whats the memory scheme if I increase trhe resolution ?

There are only a few valid text modes.  To the best of my knowledge, a text
mode can either be 80 wide or 132 wide.  In either case, characters in a
VGA text mode are stored linearly.  The character and attribute for the
first character in row N immediately followed the last character in row
N-1.  So, if you have a 132x40 text mode, the first character of the second
row will be at offset 264 (decimal -- remember 2 bytes per character).

>2) Will I be able to print text(at same size) if I choose a higher
>resolution mode (say, using  int2h)?

I'm not sure what you are trying to say.  The benefit of using a higher
resolution is that you can use smaller characters, and hence fit more of
them on the screen.
-- 
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.

0
Reply Tim 1/30/2006 2:48:28 AM

On Mon, 30 Jan 2006 02:48:28 GMT, Tim Roberts  <spamtrap@crayne.org>
wrote:

<snip>
>There are only a few valid text modes.  To the best of my knowledge, a text
>mode can either be 80 wide or 132 wide.  
Usual standard modes, normally, yes.  But, there is no reason that one
could not just reprogram the vga card to get whatever size you want.
You do have to know how to do that, which I don't.  There are times
where a 90x25 or 100x30 would be useful.

<snip>

-- 
ArarghMail601 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.

0
Reply spamtrap 1/30/2006 4:39:17 AM

spamtrap@crayne.org wrote:
> On Mon, 30 Jan 2006 02:48:28 GMT, Tim Roberts  <spamtrap@crayne.org>
> wrote:
>
> <snip>
> >There are only a few valid text modes.  To the best of my knowledge, a text
> >mode can either be 80 wide or 132 wide.
> Usual standard modes, normally, yes.  But, there is no reason that one
> could not just reprogram the vga card to get whatever size you want.
> You do have to know how to do that, which I don't.  There are times
> where a 90x25 or 100x30 would be useful.
>
> <snip>
>
> --
> ArarghMail601 at [drop the 'http://www.' from ->] http://www.arargh.com
> BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
>
> To reply by email, remove the garbage from the reply address.

You could write all your own stuff in a graphics mode?

[BITS 16]
[ORG 0x0100]

[SEGMENT .data]
coords	times 480 dw 0
window	times 480 db 0
task	db    10
vinfo	times 255 db 0

[SEGMENT .text]
main:
;set up LUT tables and initialize vesa
    call define_coords
    call define_window
    call initvesa
    mov ax,0        ; color
next_color:
    push ax         ; save current color
    mov dx,0        ; y coord
y_loop:
    mov bx,0        ; x coord
x_loop:
    call putpixel
    inc bx
    cmp bx,640
    jnz x_loop
    inc dx
    cmp dx,480
    jnz y_loop

    mov ah,07h         ;wait keypress
    int 21h

    pop ax            ;get color
    inc ax            ;next color
    cmp ax,16         ;all done?
    jnz next_color

    mov ax,0003h
    int 10h
    mov ax,4c00h
    int 21h
;==== END OF MAIN PROGRAM =======  ; main  endp

initvesa:
;************************************
    push ds
    pop es
    lea di,[vinfo]
    mov cx,0101h
    mov ax,4f01h
    int 10h
;***************************************
    mov ax,4f02h
    mov bx,101h
    int 10h
    mov ax,0a000h
    mov es,ax
    ret
;end initvesa

define_coords:
    xor cx,cx
    xor si,si
again_def_c:
    mov ax,640
    xor dx,dx
    mul cx
    mov [coords+si],ax
    inc si
    inc si
    inc cx
    cmp cx,480
    jb again_def_c
    ret
;end of define_coords

define_window:
    xor si,si
    xor ax,ax
def_w1:
    mov [window+si],al
    inc si
    cmp si,102
    jbe def_w1
    mov al,1
def_w2:
    mov [window+si],al
    inc si
    cmp si,204
    jbe def_w2
    mov al,2
def_w3:
    mov [window+si],al
    inc si
    cmp si,307
    jbe def_w3
    mov al,3
def_w4:
    mov [window+si],al
    inc si
    cmp si,409
    jbe def_w4
    mov al,4
def_w5:
    mov [window+si],al
    inc si
    cmp si,480
    jb def_w5
fine:
    ret
;end of define window

putpixel:
;bx=x dx=y al=col
    push dx
    push bx
    push ax
    mov si,dx
    mov dl,[window+si]
    add si,si
    mov di,[coords+si]
    add di,bx
    adc dl,0
avanti1:
    cmp dl,[task]
    je avanti2
    mov [task],dl
    push ax
    xor bx,bx
;***************************************************
    call far [vinfo+0ch]
;****************************************************
    pop ax
avanti2:
    mov [es:di],al
    pop ax
    pop bx
    pop dx
    ret
;end of putpixel

;end of main

0
Reply JGCASEY 1/31/2006 10:35:41 PM

5 Replies
116 Views

(page loaded in 0.085 seconds)

Similiar Articles:













7/16/2012 6:59:45 AM


Reply: