int13_diskette: unsupported AH=80

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jh302
Posts: 2
Joined: Fri Nov 27, 2009 3:41 pm

int13_diskette: unsupported AH=80

Post by jh302 »

Hello everyone.
I'm trying to make a 2 stage bootloader. I'm using gas and bochs.
The code is supposed to read sectors of the floppy (image), to load it to memory
The floppy image is created with bximage, and is written to over a loopback device.
I hope that someone can help me, I've been using a lot of time...

Code: Select all

.code16
.section .text
.globl _start
_start:
mov $0x7c0,%ax
mov %ax,%ds
mov $0,%dl
mov $0,%ah
int $0x13
jc _start
read:	
mov $2,%ah
mov $18,%al
mov $0,%ch
mov $2,%dh
mov $1,%cl
mov $0x8000,%ax
mov %ax,%es
xor %bx,%bx
int $0x13
jc read
jmp succes
jmp idle
succes:	
  mov $0xb800, %ax
  mov %ax, %ds
  movb $'O', 0
  movb $0x1e, 1
  movb $'K', 2
  movb $0x1e, 3
idle:
  jmp idle 
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: int13_diskette: unsupported AH=80

Post by f2 »

Check out this snippet:

Code: Select all

mov $2,%ah
mov $18,%al
mov $0,%ch
mov $2,%dh
mov $1,%cl
mov $0x8000,%ax
mov %ax,%es
xor %bx,%bx
int $0x13
At the beginning, you put AH = 02h, but after you put AX = 8000h. So, AH = 80h. Do you see your mistake?

in the future, I suggest you re-read your code before posting unnecessarily.
Last edited by f2 on Sun Nov 29, 2009 4:05 pm, edited 1 time in total.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: int13_diskette: unsupported AH=80

Post by Combuster »

Tommy wrote:before posting unnecessarily.
Well, sometimes you need a second pair of eyes to see the (obvious?) solution.

What would help to fix these problems, is to use a debugger. The int is the system call, if you check directly before that what values you are actually passing, you can often locate the problem yourself. Debugging with bochs requires some practice (and time), but it really pays off in the long run.

On another note, briefly describing what things you tried so far helps a lot in avoiding the "don't be lazy/stupid" response - it happens a lot because a lot of people that come here are lazy or stupid.

Oh and, welcome to the forums.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: int13_diskette: unsupported AH=80

Post by PatrickV »

quote="jh302"]The floppy image is created with bximage[/quote]
You wont be able to read this because the image because it has to be in binary form. I don't know what format it will be saved in. I assume you have not have the floppy disk loaded of course.
jh302 wrote: mov $2,%ah
mov $18,%al
mov $0,%ch
mov $2,%dh
mov $1,%cl
You are reading raw sectors. You may have issues located your code if yoiu don't have the correct sectors etc.
You have made a lot of mistakes i guess you should start doing some reading or look at other peoples examples

Patrick V
Post Reply