LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-30-2009, 10:38 AM   #1
Andy@LufbraUni
LQ Newbie
 
Registered: Mar 2009
Posts: 3

Rep: Reputation: 0
DOS to Linux Program Porting (_BX Register)


Hi,

I am currently trying to port a DOS program to Linux to be compiled under GCC. The program I am porting makes use of the Borland style pseudo-register variables _BX, _AH, _ES etc:

_AH=0x48;
_BX=0xFFFF;
geninterrupt (0x21);

Are there any equivalents for use under GCC that I could replace these with as I am currently getting the error message:

error: '_BX' undeclared (first use in this function)

from GCC as these variables are obviously not defined anywhere in Linux.

Thanks.
 
Old 03-30-2009, 12:26 PM   #2
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Using GCC you may put values into registers with inline assembler like so:
Code:
	asm("mov $0xffff, %ax\n");
to load AX with 0xffff. However I don't think this will be very useful as the Dos function call 0x21 needs these values loaded into registers to tell it what to do. Just loading the registers with values isn't enough in Linux unless you are doing something clever with Dos emulation.

For example - the example you gave appears to be a Dos memory allocation call with the number of paragraphs in the BX register. You would have to translate this and other calls to suitable Linux calls if porting.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Porting Serial port program from windows to linux farofeiro Programming 4 01-09-2009 11:40 AM
Issues porting c program from SUSE to Redhat v9.2 serconsult Programming 11 07-31-2008 03:28 AM
Porting DOS program to Linux. I have the C source code ... Micro420 Programming 8 04-19-2008 07:36 AM
How to register a program in rpm database ringvix Linux - Newbie 3 06-01-2006 02:45 PM
How to register a program for command line?? wepakis Linux - Software 8 11-13-2004 02:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration