[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: off topic - Assembler using GCC



Hi, Ivan

   Sorry again for the off-topic post - I've made what I think is quite a lot
   of progress in as much as I can now get the asssembler compiled and
   sometimes running.

   However I am stuck now on implementing interrupts - specifically int 0x10.

   Everytime I run this code I get a segmentation fault error.  I have tracked
   the problem down to the int $0x10 instruction but why is this causing a
   problem ???

you're trying to call real mode code (BIOS) from protected mode
application. That's no-no... Well, you can but you'd have to map BIOS
code into your app space and set special descriptor
(i might be wrong, i did it long time ago under DOS/DPMI).

   Any and all help gratefully received.

   Ivan.

   The test code as follows :

   .globl main
   main:
	   mov	$0x00, %ah
	   mov	$0x13, %al	# set 320 x 200, 256K
	   int	$0x10		# call bios
	   call	loop
	   mov	$0x00, %ah
	   mov	$0x02, %al	# set 80 x 25, 8 x 14 box, 16 colours
	   int	$0x10		# call bios
	   ret

AFAIK, to set video modes you'd better using something like 
SVGAlib or GGI/KGI

   # loop is a simple delay function
   .globl loop
   loop:
	   mov	$0x0fff, %ebx
   .L2:
	   mov	$0xffff, %eax
   .L3:
	   sub	$1, %eax
	   jnz	.L3
	   sub	$1, %ebx
	   jnz	.L2
	   ret

question about programming better be asked in comp.os.linux.development.apps and
comp.os.linux.development.system. If you insist on calling the BIOS and
how to access hardware directly, linux kernel mailing list might be
also good place to check

regards

OK


Reply to: