x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4556
Number of posts: 16011

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how do you output a pixel on the screen ? Posted by DamianJB on 6 Apr 2004 at 6:40 AM
is there a simple way to output a single coloured pixel on the screen
and something I can use to create a larger graphic ?

any help would be greatly appreciated...
Report
Re: how do you output a pixel on the screen ? Posted by AsmGuru62 on 6 Apr 2004 at 7:23 AM
This message was edited by AsmGuru62 at 2004-4-6 7:24:12

: is there a simple way to output a single coloured pixel on the screen
: and something I can use to create a larger graphic ?
:
: any help would be greatly appreciated...
:
DOS?.. WINDOWS?..


Report
Re: how do you output a pixel on the screen ? Posted by DamianJB on 6 Apr 2004 at 7:39 AM
: This message was edited by AsmGuru62 at 2004-4-6 7:24:12

: : is there a simple way to output a single coloured pixel on the screen
: : and something I can use to create a larger graphic ?
: :
: : any help would be greatly appreciated...
: :
: DOS?.. WINDOWS?..
:
:
:
DOS please, but I am also interested in creating my own Operating System
independent of DOS !
but through DOS will do for now, if you have the answer, Thanks in advance

Report
Re: how do you output a pixel on the screen ? Posted by shaolin007 on 6 Apr 2004 at 9:55 AM
: : This message was edited by AsmGuru62 at 2004-4-6 7:24:12

: : : is there a simple way to output a single coloured pixel on the screen
: : : and something I can use to create a larger graphic ?
: : :
: : : any help would be greatly appreciated...
: : :
: : DOS?.. WINDOWS?..
: :
: :
: :
: DOS please, but I am also interested in creating my own Operating System
: independent of DOS !
: but through DOS will do for now, if you have the answer, Thanks in advance
:
:

Use BIOS video service int 10h to set the mode and to plot a pixel. Look at Ralph Browns interrupt list for details on that interrupt.
Report
Re: how do you output a pixel on the screen ? Posted by AsmGuru62 on 6 Apr 2004 at 10:48 AM
This message was edited by AsmGuru62 at 2004-4-6 10:51:12

: : : This message was edited by AsmGuru62 at 2004-4-6 7:24:12

: : : : is there a simple way to output a single coloured pixel on the screen
: : : : and something I can use to create a larger graphic ?
: : : :
: : : : any help would be greatly appreciated...
: : : :
: : : DOS?.. WINDOWS?..
: : :
: : :
: : :
: : DOS please, but I am also interested in creating my own Operating System
: : independent of DOS !
: : but through DOS will do for now, if you have the answer, Thanks in advance
: :
: :
:
: Use BIOS video service int 10h to set the mode and to plot a pixel. Look at Ralph Browns interrupt list for details on that interrupt.
:
Also, you can look into direct access of video RAM - the methods of access depends on the graphics mode you are in. Search for the topics like: "Mode 13H" or "VESA Programming" or "VGA Programming"

In case of creating your OS - that will be harder, because you will need to work with the hardware directly through ports and a there is a lot of diff. hardware, so you will have to code the separate for every type of graphics card - not a thing to do for one person!



Report
Re: how do you output a pixel on the screen ? Posted by ASHLEY4 on 6 Apr 2004 at 12:49 PM
There are fast ways and slow ways, bios is to slow,This will put a pic on screen.
org 100h
mov  ax,0013h               ; get into graphic mode
int  10h

push 0xA000                 ; push address of screen
pop  es                           ; put it in es

xor  di,di                         ; zerow di (top left and corner of screen)
mov  al,03h                   ; put the color of pic in al
stosb                             ; put the whats in al at the addess [es:di] ,al

xor  ax,ax                       ; wait for key press
int  16h

mov  ax,0x0003            ; go back to text mode
int  10h

int  20h


Im making a os thats like a32bit pmode dos, call "Dos Extreme" let me know if you would like to no more.

ASHLEY4.
Report
Re: how do you output a pixel on the screen ? Posted by DamianJB on 6 Apr 2004 at 6:19 PM
Thank You Ashley4,

I get an error with the push statement
operation size not specified
I am using NASM
It also happened with some other code I tried

about the Operating System
these calls to BIOS have got me thinking that it is easier than I thought
I interviewed someone today who is developing his own OS
and so we are going to get our heads together on the project
I would like to start it from scratch, so I know exactly how it works
I will be creating also a GUI
my interviewee thought it would take about 20 programmers to create
an OS, but we could start with just the 3 of us
my plan, way back 10 years ago was to do it via volunteers over the
internet, so that may happen

I really need to know why I get an error with the push statement
because as soon as I get a pixel on screen I will be up and running
and feeling very enthusiastic


: There are fast ways and slow ways, bios is to slow,This will put a pic on screen.
:
: org 100h
: mov  ax,0013h               ; get into graphic mode
: int  10h
: 
: push 0xA000                 ; push address of screen
: pop  es                           ; put it in es
: 
: xor  di,di                         ; zerow di (top left and corner of screen)
: mov  al,03h                   ; put the color of pic in al
: stosb                             ; put the whats in al at the addess [es:di] ,al
: 
: xor  ax,ax                       ; wait for key press
: int  16h
: 
: mov  ax,0x0003            ; go back to text mode
: int  10h
: 
: int  20h
: 

:
: Im making a os thats like a32bit pmode dos, call "Dos Extreme" let me know if you would like to no more.
:
: ASHLEY4.
:

Report
Re: how do you output a pixel on the screen ? Posted by ASHLEY4 on 6 Apr 2004 at 9:16 PM
Try this
mov  ax,0xA000
mov  es,ax


Let me know if you need more help.

PS. The error means you need to tell the assembler the size,eg: word
But use the above code instead.
ASHLEY4.
Report
Re: how do you output a pixel on the screen ? Posted by ASHLEY4 on 6 Apr 2004 at 9:32 PM
Also try this to get in vesa 640x480x256 ,if you have vesa on your pc.

mov ax,4f02h ;set vesa 1.0 screen mode
mov bx,101h ;640*480*256
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
je rain
inc dx
mov ah,01h
int 16h
jz mouse

mov ax,0003h
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.
Report
Re: how do you output a pixel on the screen ? Posted by DamianJB on 7 Apr 2004 at 3:26 AM
Thanks Ashley4,

it works now with code below and also push word
I would be interested in knowing about the OS you are writing

Regards,
Damian

: Try this
:
: mov  ax,0xA000
: mov  es,ax
: 

:
: Let me know if you need more help.
:
: PS. The error means you need to tell the assembler the size,eg: word
: But use the above code instead.
: ASHLEY4.
:

Report
Re: how do you output a pixel on the screen ? Posted by ASHLEY4 on 7 Apr 2004 at 12:10 PM
Hi
Its a 32bit pmode dos call "Dos Extreme" it has no protection,is multi-threeding (not multi-tasking) it use's a flat memory model (eg: up to 4GB),It use's call instead of int's. It will come with a menu that as 4 links CDplayer, MP3player, DVDplayer,RUN program.
It come with built in libs for most things.
To get into graphic 800x600x16m,will be has easy has geting mode 13h in dos
It has bulit in bmp viewer, Also things like the keyboard has built in swich (eg: var = 0 the it is a normal keyboard, if var = 1 then its a game keyboard for mult keypress at the same time etc).
It can run from floppy and/or cd/dvd etc.

And is 100% asm (fasm), the os is about half way done.

When its done people can write games,demo,control elec etc.
And any one can run them, it does not matter if they have, xp, win98, win95 ,linux or no OS .

ASHLEY4.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.