section .data ;section declaration
msg db "O_o",0xa ;our dear string
len equ $ - msg ;length of our dear string
section .text ;section declaration
;we must export the entry point to the ELF linker or
global _start ;loader. They conventionally recognize _start as their
;entry point. Use ld -e foo to override the default.
_start:
;write our string to stdout
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle (stdout)
mov eax,edx ;system call number (sys_write)
int 0x80 ;call kernel
xor ah,ah
mov ax,13h
int 10h
;and exit
mov eax,1 ;system call number (sys_exit)
xor ebx,ebx ;first syscall argument: exit code
int 0x80 ;call kernel
Linux Assembler int 10h
I want to get easy Pixel acces under linux, so I tried to use int 10h with
xor ah,ah ;just to get shure
mov ax,13h;setting graficsmode 13, 256 colors 320x200
int 10h ;bios video int
I get a memory acces error. (even when running from one of the real terminals)
Does someone know whats wrong about it? the whole code is:
Linux is an operating system working in the protected mode of x86 processors. This way it can ensure that each process is separated from another and may not harm the system (i.e. by directly writing to the hardware). As a result of this, direct calls to the bios are not allowed in the form they are in real mode.
To directly access graphics memory you can try to access the frame buffer device. A much easier alternative is to use a library, such as SDL.
To directly access graphics memory you can try to access the frame buffer device. A much easier alternative is to use a library, such as SDL.
10h is a DOS specific interrupt doesn't work on pretty much anything other than DOS. If you want to do graphics programming in linux you either have to interface directly with the hardware through the kernel using the correct mechanism or use svgalib or X11. If you're running X11, there's a good chance that's what you want; I'm not sure if you can use svgalib (or do it manually) while X11 is running.
Quote:Original post by nmi
To directly access graphics memory you can try to access the frame buffer device. A much easier alternative is to use a library, such as SDL.
thanks for the information, but I SDL really avaible through assembler? I have used it with C/C++ but didnt knew it works with assembler...
In principle everything is available from assembly. It's not too difficult to call a function from asm that is implemented in some other language. As long as you know the calling convention it uses, that is.
Why does it have to be in asm though?
Why does it have to be in asm though?
Quote:Original post by philipptr
thanks for the information, but I SDL really avaible through assembler? I have used it with C/C++ but didnt knew it works with assembler...
I you get a pointer to the frame buffer, you can use assembler to write to the memory. Have a look at SDL_Surface::pixels.
Quote:Original post by Spoonbender
Why does it have to be in asm though?
because I want to find the fastest way to get pixel on the screen (SDL with c++ is pretty slow)
Quote:Original post by philipptrQuote:Original post by Spoonbender
Why does it have to be in asm though?
because I want to find the fastest way to get pixel on the screen (SDL with c++ is pretty slow)
SDL with assembly would be no different. Why is it you think it's slow? Are you sure you have X11 (which I'm assume you're using) configured correctly?
well I always used it uner windows, and Pixel acces was always quite slow, when redrawing an entire 800*600 I got quite bad fps, especially when thinking of the fact that I was trying it with 2,8ghz (old 2d games were drawing 640*480 on 90mhz)
Quote:Original post by philipptrQuote:Original post by Spoonbender
Why does it have to be in asm though?
because I want to find the fastest way to get pixel on the screen (SDL with c++ is pretty slow)
SDL and c++ work grand for me. have you ensured you get a software SDL surface as your screen? because read/writes to hardware surfaces are going to be slow.
how experienced with asm are you?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement