simple asm example with SVGA error

Started by
7 comments, last by demonkoryu 13 years, 7 months ago
I try to use SVGA with nasm .
	SECTION .data		; data sectionmsg:	db "Hello World",10	; the string to print, 10=crlen:	equ $-msg		; "$" means "here"				; len is a value, not an address	SECTION .text		; code section        global main		; make label available to linker main:				; standard  gcc  entry point	push    bx	mov     bx, 104h	mov     ax, 4F02h	int     10h	pop     bx	mov	edx,len		; arg3, length of string to print	mov	ecx,msg		; arg2, pointer to string	mov	ebx,1		; arg1, where to write, screen	mov	eax,4		; write sysout command to int 80 hex	int	0x80		; interrupt 80 hex, call kernel		mov	ebx,0		; exit code, 0=normal	mov	eax,1		; exit command to kernel	int	0x80		; interrupt 80 hex, call kernel

The code source :
	push    bx	mov     bx, 104h	mov     ax, 4F02h	int     10h	pop     bx

give me this error :
$ ./helloSegmentation fault (core dumped)

What is wrong ?
Under linux is not allow BIOS int .
I think is a true ... not sure .
What another solutions is ?

[Edited by - mythcat on September 1, 2010 9:27:52 AM]

"Imagination is more important than knowledge..."

Advertisement
Yes, most likely this type of direct hardware access is not allowed. I know for sure it is not allowed in Windows, and I presume that it essentially must be the case for all OSes which support windowing.

If that is the case, then your only option is to switch platforms, or settle for doing just the drawing part of rasterization (I presume you're doing this to make a software rasterizer?) into a buffer that can be blitted to a window in the OS. The actual drawing is the more interesting part of the equation anyhow. I do this on Windows with a DIBSection, but I don't know what the Linux equivalent is.

throw table_exception("(? ???)? ? ???");

Quote:Original post by Ravyne
Yes, most likely this type of direct hardware access is not allowed. I know for sure it is not allowed in Windows, and I presume that it essentially must be the case for all OSes which support windowing.

If that is the case, then your only option is to switch platforms, or settle for doing just the drawing part of rasterization (I presume you're doing this to make a software rasterizer?) into a buffer that can be blitted to a window in the OS. The actual drawing is the more interesting part of the equation anyhow. I do this on Windows with a DIBSection, but I don't know what the Linux equivalent is.


I use a bootloader asm program and a want improve the graphics.

"Imagination is more important than knowledge..."

Quote:Original post by mythcat
I use a bootloader asm program and a want improve the graphics.


for a bootloader it should be fine, as long as it runs before the OS (bootloaders tend to do that), (any OS running in protected mode will prevent user applications from accessing the hardware directly).

I'd suggest installing a VM to test your bootloader rather than testing it as a normal application.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
if you are calling this from the boot sector or other low-level bootloader, int 80 will not be available (this is a linux interrupt gate only usable within linux)
If you are calling this from within linux, int 10 is not available as it is a REALMODE bios interrupt.

Maybe you need to rethink the design a little to make this work? Sounds like you have a long road ahead of you too, if it is in assembler!
Quote:Original post by SimonForsman
for a bootloader it should be fine, as long as it runs before the OS (bootloaders tend to do that), (any OS running in protected mode will prevent user applications from accessing the hardware directly).


Actually, many boot loaders switch to protected mode before loading the OS. Grub for example does this.
Is just a test for learning asm .
I readed long time ago about asm with win and dos .
I try to design my boot loader and seam to be some problems .
Yes i use qemu to test it ( see qemu -fda /dev/sdb )
Basically i need a mini os with this features :
- run python and opengl module .
- run vi
- running on usb stick .
- nothing more software .
So many linux os have python and vi but also have xorg and gnome ...
On Win is portable python and winvi .
Linux seam to be ok , in this case , but if i want use python i need more ...
I saw boot cd with graphics interface (like northon style)
I search on the internet and i don't found anything about direct hardware.
If i learn about direct hardware i think is possible to use shaders language with my
FX5200.
It is theoretically possible , but how ... This is the big question .
I'm new in this , but i hope is no hard to do this .
I you have some suggestion to help me , it's ok.
Thank you all .
Regards .

"Imagination is more important than knowledge..."

Quote:Original post by mythcat
Is just a test for learning asm .
I readed long time ago about asm with win and dos .
I try to design my boot loader and seam to be some problems .
Yes i use qemu to test it ( see qemu -fda /dev/sdb )
Basically i need a mini os with this features :
- run python and opengl module .
- run vi
- running on usb stick .
- nothing more software .
So many linux os have python and vi but also have xorg and gnome ...
On Win is portable python and winvi .
Linux seam to be ok , in this case , but if i want use python i need more ...
I saw boot cd with graphics interface (like northon style)
I search on the internet and i don't found anything about direct hardware.
If i learn about direct hardware i think is possible to use shaders language with my
FX5200.
It is theoretically possible , but how ... This is the big question .
I'm new in this , but i hope is no hard to do this .
I you have some suggestion to help me , it's ok.
Thank you all .
Regards .


Accessing a FX5200 directly is very difficult, there are no official public specifications for that hardware.

You can look at http://nouveau.freedesktop.org/wiki/ to see how far the opensource effort has come at creating a compatible driver for nvidia hardware but the 3D and shader support is shaky at best.

ATI hardware is a bit easier since they've released the necessary documentation, but even there 3D hardware is fairly complicated as you'll see if you compare the quality and performance of the opensource and proprietary drivers.

Your best bet is to use a standard such as VESA for decent 2D graphics since almost all modern cards (including the FX5200) support it.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Quote:Original post by mythcat
Basically i need a mini os with this features :
- run python and opengl module .
- run vi
- running on usb stick .
- nothing more software .


I think your best bet would be to use a minimal Linux or BSD distro for embedded systems; or try a mature homebrew OS.

This topic is closed to new replies.

Advertisement