Author Topic: Assembler DOS XP (long listing)  (Read 1517 times)

beltorak0

  • Member
  • **
  • Posts: 223
  • Kudos: 0
    • http://www.angelfire.com/realm/beltorak
Assembler DOS XP (long listing)
« on: 30 December 2002, 23:54 »
by inspiration from char X[11]; here's the dos xp kernel (hehe) in assembly.
 
quote:
doxp.s
 
Code: [Select]

system.inc

 
Code: [Select]

syscall.inc

 
Code: [Select]

Makefile

 
Code: [Select]
note: You might need to put back in tabs;




I've tested it some; adding new command should be relatively easy (add a link list entry, write code handling command name).

I am seriously considering writing my own shell (haha).

-t.

[edit] buffer overflow detection (still fairly crude) works now.  made use of readv and writev sys_calls cause they're cooler than read and write.

-t.

[ December 31, 2002: Message edited by: beltorak ]

from Attrition.Org
 
quote:
Like many times before, Microsoft is re-inventing the wheel and opting for something other than round.

-t.


Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Assembler DOS XP (long listing)
« Reply #1 on: 10 January 2003, 12:12 »
Sweet, do you feel like hosting a binary for Linux, and is it possible that the program could be wrote directly to the bootsector of a floppy.

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
Assembler DOS XP (long listing)
« Reply #2 on: 10 January 2003, 13:06 »
what would be nice is if you could make a bootable disk image that can be written to a floppy. Also, hosting binaries for some commonly used OSs would be a good idea too!
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Assembler DOS XP (long listing)
« Reply #3 on: 10 January 2003, 13:31 »
Why can't I get nasm to assemble it? My nasm appears to be brain dead and seems to like "#" for comment chars rather than ";". Still every line seems to error and it doesn't even like the first include line because of the "%" char. I've never written an ASM program on Linux but am interested in learning the differences. Also the formatting gets screwed up in a copy/paste. Is there any way you can make them available on a web site so I can wget them? Or email them to me?

[ January 10, 2003: Message edited by: void main ]

Someone please remove this account. Thanks...

beltorak0

  • Member
  • **
  • Posts: 223
  • Kudos: 0
    • http://www.angelfire.com/realm/beltorak
Assembler DOS XP (long listing)
« Reply #4 on: 14 January 2003, 11:18 »
hmm... i'm not sure void; I'm using: NASM version 0.98.33 compiled on May 27 2002; what's yer ver? although I doubt that would have much to do with it...  have you checked "man nasm" to see if you have a funny version?

here's the tar.gz; includes updates (minor ones) and a binary ... should run on any 2.4 kernel, but I didn't check the syscalls for version information.  not being a serious project and all.

ChangeLog (posted here cause I already made the tarball, and I'm to lazy to append it      ;)      )
  • removed the string functions to it's own file: string.S
  • check for <enter only> lines, but other whitespace only lines will throw an error (bug or better emulation? i'll let you decide).
  • ".gdbinit" included with a few helpfull defines if you want to step thru it.  automatically set breakpoint at "_start", but for some reason gdb refuses to break at the first executable byte.... setting a breakpoint at *'_start.buff_clear' is a good spot; it's right before the "_"kernel"_" reads STDIN.

And, no.  You can't dd this to a floppy and expect it to be functional.  It requires a working linux kernel for the syscalls.  If you want one that will work from a floppy, I could make one, but upon exit, the system would hang.  not to mention i'd have to reboot to test it, reboot to recode it, and reboot to to debug it, and reboot to debug it, &c&c&c....

the string functions (all three, emulating 5) should be generic enough to work with an assembler product from scratch, although I'm sure there are better ones out there (not to mention the fact that they would be optimized for size, which is where assembler programming really shines.  I wrote them to get back in practise.

I had improved upon it a great deal, but then I made the common (micor$oft) mistake of coding the libraries around the POS program, and it ended up breaking.... so it is pretty much exactly as you saw it before (if you got it to run).  I had to pull it off the site and rework it a little for the string.S include.

btw, from the reaction times i had thought everybody ran away screaming "assembly!! nooo!!! nobody does that anymore!" when I first posted it.... my thimble runneth over      ;)     ....

anyway, for serious work, check out www.linuxassembly.org ; the section on asmutils is geared for writing linux assembly for systems with very tight memory constraints -- embedded stuff.

and the much much better nasm manual here.

and on to another post....

[ January 14, 2003: Message edited by: beltorak ]

from Attrition.Org
 
quote:
Like many times before, Microsoft is re-inventing the wheel and opting for something other than round.

-t.


voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Assembler DOS XP (long listing)
« Reply #5 on: 14 January 2003, 11:49 »
I'm running:

Code: [Select]

I downloaded your tar ball but the Makefile included in it has some serious corruption. Has much binary in it. I created a new Makefile from your first post and it assembles fine and runs. Great job! Don't know why my copy/paste didn't work. I'll have to compare the sources....

[ January 14, 2003: Message edited by: void main ]

Someone please remove this account. Thanks...

beltorak0

  • Member
  • **
  • Posts: 223
  • Kudos: 0
    • http://www.angelfire.com/realm/beltorak
Assembler DOS XP (long listing)
« Reply #6 on: 16 January 2003, 01:24 »
very odd indead... i just checked my makefile; it looks like the binary for doxp... i can't understand how it got clobbered... i'll replace the pkg in a few....

very very wierd....

-t?
from Attrition.Org
 
quote:
Like many times before, Microsoft is re-inventing the wheel and opting for something other than round.

-t.