How would I execute a C/C++ written program from an asm program with pure DOS?
How would I execute a C/C++ written program from an asm program with pure DOS?
DOS???
Also, this is an assembly or DOS API question, not C++. Moved.
Meh. Even from assembly, I think I'd link against a CRT and use exec(). But Interrupt 21 function 5b looks promising.
Last edited by CornedBee; 12-22-2007 at 04:25 PM.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Okay, I was already sort of on that track. Here is the asm I have so far
It took me a while to get together. cprogram.exe was compiled with DJGPP; here's it's codeCode:jmp start Filename db 'CPROGRAM.EXE', 0 getkey: mov ah, 0 int 016h ret start: mov ah, 40h mov al, 0 mov dx, Filename mov ds, dx mov bx, 0 mov es, bx int 21h call getkey ret
But the asm program displays this:Code:#include <stdio.h> int main(void) { printf("Starting...\n\n"); printf("Good news; This is a real live running C program.\n"); printf("\nEnding...\n"); return 0; }
As you can see I have a major glitch error.Code:♀☻ ☻█☻─ ♀☻ï♣♀☻♫♀♀☻¶♀♀☻▼♀♀☻¡♠♀☻¡♠♀☻ñ≡ ≡7♣♀☻N+ └r►º |►º ▐☺¶♦K☺¶♦V☺¶♦å►º É►º Ü►º ╕►º T☻p ≥♦ï╙╕►º ╕►º ╕►º @☺¶♦P ╖♀Ω«►º ≡╕►º ─#☻╨╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º ╕►º è♦♀☻ ♥♀☻v ♀☻a/ └╢ ≡╢ ≡╢ ≡╢ ≡╢
Help me out a little here?
Last edited by Yarin; 12-22-2007 at 06:40 PM.
My reference tells me that 40h is WriteFile.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
But I am interrupting 21h am I not?
Do you know where I could get a copy of this reference? (Assuming you have a list of interrupts)
The problem is that the reference is in German.
But perhaps Ralf Brown's list would be a good reference. http://www.ctyme.com/rbrown.htm
Look for int 21h, and there you can look up the function you want. 40h, as I said, is Write File.
This page looks interesting, too: http://www.ctyme.com/intr/cat-010.htm
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law