Convert DOS asm code to Linux 
Author Message
 Convert DOS asm code to Linux

How to convert the following DOS asm code to be ran on Linux:

mov al, 0d6h
out 22h, al
in al, 23h
mov al, 50h
out 23h, al
mov al, 0dbh
out 22h, al
in al, 23h
mov al, 15h
out 23h, al

Is it needed to be changed in some way to cope with the difference between running on a 16-bit OS and 32-bit OS?



Sat, 24 Nov 2001 03:00:00 GMT  
 Convert DOS asm code to Linux


In newsgroup: comp.lang.asm.x86

Quote:

> How to convert the following DOS asm code to be ran on Linux:

> mov al, 0d6h
> out 22h, al
> in al, 23h         <-- Discarded input, synchronization??
> mov al, 50h
> out 23h, al
> mov al, 0dbh
> out 22h, al
> in al, 23h         <-- Discarded input, synchronization??
> mov al, 15h
> out 23h, al

> Is it needed to be changed in some way to cope with the difference
> between running on a 16-bit OS and 32-bit OS?

No, but you're mucking with I/O ports, which is highly frowned upon in
Linux.  You either need to execute the ioperm() system call ahead of
time, or open /dev/port and do your accesses as write()s to the
appropriate offset of /dev/port.  Either require root permissions.

Port 22h and 23h are usually chipset-specific; I also seem to recall
some Cyrix processors had registers there.  It may be that what you
really want to do is to write a kernel-space device driver.

Either way, there is no real reason to go to assembly just for I/O
port references.  Use the outb() and inbb() C functions defined in
<asm/io.h>:

        outb(0xd6, 0x22);

--
"The user's computer downloads the ActiveX code and simulates a 'Blue
Screen' crash, a generally benign event most users are familiar with
and that would not necessarily arouse suspicions."
-- Security exploit description on http://www.zks.net/p3/how.asp



Sun, 25 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need help with assembler program - convert.asm - convert.asm (1/2)

2. Need help with assembler program - convert.asm - convert.asm (2/2)

3. Need Help: Converting Clarion DOS Code to CW Code

4. problems converting unix code to linux code (direct access files)

5. Problem converting DOS BASIC routine to ASM

6. convert to Linux asm(gas)

7. Making std asm code into Turbo Asm code?

8. converting asm code

9. converting asm code to C

10. ASM Code for converting binary to decimal?

11. 32bit ASM-Code under DOS

12. asm code: Win95->ok but crashes on Linux

 

 
Powered by phpBB® Forum Software