Author Topic: How to call a assembly file from another?  (Read 9642 times)

Offline NunoLava1998

  • New Member
  • Posts: 1
How to call a assembly file from another?
« on: November 13, 2015, 09:41:10 AM »
I'm trying to start/call a assembly file from another. I do not know how to do this function in assembly. In CMD to start 123.asm you just could do this:

start 123.asm

However i do not know how to do this in assembly.

Rules for the code:

  • It must be not larger than 128 bytes.
  • Must be suitable for a bootloader to load (I'm trying to start a kernel and GUI from a bootloader, i'm in fact, trying to make a OS.).

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How to call a assembly file from another?
« Reply #1 on: November 13, 2015, 03:54:01 PM »
Well, to use a "named file" you'll need a file system. FAT12 is usual on a floppy disk - can just barely get it into 512 bytes (size of a bootsector). Easier to put your file at a known sector (sector 2 - right after the bootsector is  simple). Traditionally, an ".asm" extension would indicate source code, but you can name it anything you like. Load it (BIOS int 13h, probably) to some known location in memory and jump to it. Use "call" if there's any reason to "ret" from it.

You're not going to get much of a GUI into 128 bytes. Who made up this "rule"?

If you're new to assembly language, an OS may not be the best place to start. http://www.osdev.org has a lot of information you'll probably find useful.

Best,
Frank