flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Why Is It That "int 21h" Doesn't Work For OS

Author
Thread Post new topic Reply to topic
nitt



Joined: 27 Aug 2011
Posts: 13
Location: United States
nitt 15 Oct 2011, 21:10
I could never figure this out, but it's probably something obvious I just don't know.

But when I first started learning Assembly, I used the "int 21h" interrupt like all the time. Then once I started getting more advanced, I figured out replacements for all of the commands that use int 21h. The only one I couldn't figure out though, was how to read and write files without int 21h.

My question is just why doesn't int 21h work in OS construction? When I'm writing my OS, I can use any interrupt except for int 21h.
Post 15 Oct 2011, 21:10
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 15 Oct 2011, 21:29
Quote:

My question is just why doesn't int 21h work in OS construction? When I'm writing my OS, I can use any interrupt except for int 21h.

Because the interrupt service routine is provided by the DOS operating system (and clones), while other interrupts you might been using (e.g. 0x10, 0x13, 0x16), the ISRs are provided by the BIOS so they are available without an OS.

To read and write files, you need to write your own code to deal with FAT file system and also use Int 0x13 read/write operations (or your own code to handle the hardware directly).

Search the forum, there are some FAT code already besides FAT-capable OSes (although not sure how many of them provide the source without some sort of membership these days).
Post 15 Oct 2011, 21:29
View user's profile Send private message Reply with quote
nitt



Joined: 27 Aug 2011
Posts: 13
Location: United States
nitt 15 Oct 2011, 21:33
LocoDelAssembly wrote:
Quote:

My question is just why doesn't int 21h work in OS construction? When I'm writing my OS, I can use any interrupt except for int 21h.

Because the interrupt service routine is provided by the DOS operating system (and clones), while other interrupts you might been using (e.g. 0x10, 0x13, 0x16), the ISRs are provided by the BIOS so they are available without an OS.

To read and write files, you need to write your own code to deal with FAT file system and also use Int 0x13 read/write operations (or your own code to handle the hardware directly).

Search the forum, there are some FAT code already besides FAT-capable OSes (although not sure how many of them provide the source without some sort of membership these days).


Thanks, I'll be looking that up.

I wish people would make more advanced tutorials. I started Assembly tutorials, made them as basic as possible, and went on to like 28 (enough tutorials to explain what I know). But it seems that no one else has the time to make video tutorials.

I probably won't be able to figure this out for awhile unless someone provides source and explanation. Because I have a lot of more ambitious things to do than just sit on a computer and learn Assembly.
Post 15 Oct 2011, 21:33
View user's profile Send private message Reply with quote
addes3



Joined: 09 May 2011
Posts: 29
addes3 15 Oct 2011, 22:11
Well, there's a great FAT12/FAT16 OS tutorial over at http://www.brokenthorn.com/Resources/OSDevIndex.html . I'm currently using this. There's also some great stuff at http://osdev.net.
Post 15 Oct 2011, 22:11
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 21 Oct 2011, 02:57
INT 21h is a PC/MS-DOS (originally) usage and would need to be written into your own OS to work. Otherwise you need to use BIOS calls and they are all over the place. Look up 'Ralf Brown's Interrupt List' and you can use those until you've got command of the hardware to use.
Post 21 Oct 2011, 02:57
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 05 Nov 2011, 10:21
nitt wrote:
When I'm writing my OS, I can use any interrupt except for int 21h.


Not correct. You can use only what BIOS gives you - INT $10, $13, $15 as the most important ones, and only from real mode.

You can't use for example INT $21 (DOS), INT $2F (DOS more mess), INT $31 (DPMI), INT $33 (mouse driver), INT $60 to $67 (EMS VCPI PACKET ...).

Quote:
I couldn't figure out though, was how to read and write files without int 21h.


Implement a filesystem (FAT, LPFS, NTSC, EXT, ...) Wink
Post 05 Nov 2011, 10:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.