flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 23 Apr 2008, 02:32
That is kinda weird, you're looking for a nasm solution on a fasm board!
If someone does provide the solution, then don't be disappointed if it comes in fasm format. Be prepared to convert it of you need to. |
|||
![]() |
|
DJ Mauretto 23 Apr 2008, 09:57
Set your bios as Bidirectional Parallel port mode (SPP)
![]() This set I/O permission Code: mov eax,101 ; SYS_IOPERM mov ebx,Base_Parallel ; 378H mov ecx,Size ; 3 mov edx,1 ; Turn ON int 80H test eax,eax js Error_Set_IO to write Code: mov dx,37ah in al,dx and al,11011111b ; reset bit 5 ( Write mode) out dx,al mov al,0ffh ; turn on all 8 pin mov dx,378h out dx,al ; Write byte to read Code: mov dx,37ah in al,dx or al,00100000b ; set bit 5 ( Read mode) out dx,al mov dx,378h in al,dx ; Read byte |
|||
![]() |
|
Kikin 24 Apr 2008, 03:33
Ok, first of all, sorry for posting this issue here, but it was the only forum referring assembly I could find and since the question was more OS-specific rather than assembler-specific I decided it wouldn't hurt anybody's feelings.
Thanks DJ Mauretto, I still don't understand quite well the part where you set/reset bit 5 on port 37ah, but it looks great, can't wait to try it out. Just one question, do I need to run my program as root in order to get permission with ioperm? |
|||
![]() |
|
DJ Mauretto 24 Apr 2008, 09:41
Quote: Just one question, do I need to run my program as root in order to get permission with ioperm? yes ![]() Quote: I still don't understand quite well the part where you set/reset bit 5 on port 37ah, but it looks great, can't wait to try it out. When the parallel port is bidirectional mode it use same 8 pin for IN/OUT, you must tell at the controller ( port 37ah) that you want perform a Read or Write operation,with bit 5 you select Write or Read operation ![]() Remember to set Bidirectional mode in your Bios. Note that if you need only to Write then forget bit 5 and bidirectional mode, the only code that you need is: Code: mov dx,378h mov al,Value ; Value to Write out dx,al Parallel port is standard from 20 years ,there are many tutorial on line this is only a simply way to go ,but you can do it better and more learning about Paralel Port ![]() |
|||
![]() |
|
Chewy509 28 Apr 2008, 02:46
Umm, to read/write to the parallel port don't you just open "/dev/lp0" for reading/writing using the standard open/read/write/close syscalls, and let the kernel do all the hard stuff like buffering, etc...
PS. If you want to talk directly to the port as described, then yes you'll need to run as root (or set your application as setuid root). |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.