NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nobody on October 26, 2004, 08:35:51 AM
-
Hi,
I want to send to parallel port a byte using nasm program, in linux, that:
segment .text
BITS 16
global _start
_start:
mov al,0ffh
mov dx,378h
out dx,al
nop
jmp _start
My program run, but To parallel port is same state
(040h).
Please, help me!
-
Well, the "BITS 16" is a problem. No Linux distro I'm aware of runs in 16-bit mode! With Nasm told to emit 16-bit code, and the cpu running in 32-bit mode, your "mov dx, 378h" is seen as "mov edx, 378EE90h", gobbling up the "out dx, al" and the "nop". Removing the "BITS 16" (the default for "-f elf" is 32-bits) does the "out", and the program segfaults as expected - you don't have permission to access this port! You'll need to do "sys_ioperm" or "sys_iopl" first. Either will require you to be root, I think. I don't know too much about 'em...
Best,
Frank
-
thank you, Frank!
Please, I prefer to use the Bios services, but I don't
how to use LRMI library for that.