da Silva, Joe wrote:
There are two possible reasons for using inline assembler code :
- For speed-critical portions of code.
- For very low-level, machine-specific parts of the code.
So, if it's reason #2, then you can't merely translate the code, either to Pascal, or to your new target machine language, Sparc. For example, suppose the inline assembly code is an interrupt service routine for INT4 (COM1: serial port interrupt). You can't just translate this to another platform, because INT4 (if there is such a thing) will be unrelated, the serial port I/O addresses will be different, the serial port UART probably has different registers and modes, the CPU will definitely have different registers, etc., etc.
If you want to access serial devices, you can translate in to appropriate system calls, using termios etc. (might need a few C wrappers, but they can be written portably) and let the OS do the hardware access. At least outside of Dos/Windows, that's the usual way to do it (and often the only one, unless you want to have to run the program as root).
Frank