Re: ASM noob - couple of questions
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Thu, 09 Mar 2006 22:13:15 -0500
Betov wrote:
Then, feel free to execute your book.
Okay. You like firing squad? Lethal injection? Mme. La Guillotine? Hangin'? ("Bowels in or bowels out? Are you confused? Shall I help you decide?") :)
....
with FASM as I could use it with Linux later.
Good choice, but you will never learn anything of Assembly
by linking Asm Chunks to C... And as long as Linux Assembly
do not, so to say, exist...
None so blind as those who will not see... :)
I wonder what Linux uses instead of DirectX ?
I don't know. Ask Chuck or Frank.
I, for one, don't know. DirectX is the COM thingie, right? (.com = simple, COM = COMplicated) Beth gave a rundown on it some time ago. No wonder John can't figure it out! There's a kind of "linked list" from one "interface" to the next, right?
There are "portable graphics libraries", but John may need DirectX or a near equivalent. This is for the webcam, right? Did "fasmcam.asm" do you any good? That uses AVICAP32.DLL. I don't know what the Linux equivalent would be. I saw an interesting comment that suggested that simply piping the "camera device" into the "framebuffer device" was "interesting"...
We all agrea on the point that, in Win32 Assembly, around
80% ofthe time is wasted at searching the OS infos.
Not limited to Win32, either. I don't think the situation in Linux is quite as bad as you seem to think, but... The "assembly language" part is a lot easier than the "interfacing with the OS" part! Doing anything with graphics in Linux is particularly bad. This is why the "just call the library" (or "you *must* call the library"!) is so popular. :(
Just for the hell of it, here's some Windows/Linux code Numit_or posted (Yahoo nasm-users group). Uses "opengl" (and/or "libglut" and/or "libglu"... "Mesa" may have something to do with it...) Requires some external files, it won't assemble or anything, but "just to look at":
;---------------------------------------------------
; triangle.asm
;
; A very simple *Linux/Windos* opengl application using the glut library. It
; draws a nicely colored triangle in a top-level application window.
; Compile with:
; make linux (in Linux)
; make windows (in Windows)
;
; you can find nasm in:
; http://nasm.sourceforge.net/
;
; Mingw is in:
; http://www.mingw.org/
;
; author: numit_or (numit_or at cantv.net)
;
;-------------------------------------------------------------
;
; libGL is in
; libMesaGL1 pack
; libgkut and libGLU are in:
; libMesaglut pack
;
;------------------------------------------------------------
%include "nmadcros.inc"
GL_COLOR_BUFFER_BIT equ 16384
GL_POLYGON equ 9
section .data
title db 'A Simple Triangle', 0
zero dd 0.0
one dd 1.0
half dd 0.5
neghalf dd -0.5
section .text
display:
invoke glClear, GL_COLOR_BUFFER_BIT ; glClear(GL_COLOR_BUFFER_BIT)
invoke glBegin, GL_POLYGON ; glBegin(GL_POLYGON)
invoke glColor3f, [one], 0, 0 ; glColor3f(1, 0, 0)
invoke glVertex3f, [neghalf], [neghalf], 0 ; glVertex(-.5, -.5, 0)
invoke glColor3f, 0, [one], 0 ; glColor3f(0, 1, 0)
invoke glVertex3f, [half], [neghalf], 0 ; glVertex(.5, -.5, 0)
invoke glColor3f, 0, 0, [one] ; glColor3f(0, 0, 1)
invoke glVertex3f, 0, [half], 0 ; glVertex(0, .5, 0)
invoke glEnd ; glEnd()
invoke glFlush ; glFlush()
ret
PROC main, argc, argv
invoke glutInit, addr [.argc], [.argv]
invoke glutInitDisplayMode, 0
invoke glutInitWindowPosition, 80, 80
invoke glutInitWindowSize, 400, 300
invoke glutCreateWindow, title
invoke glutDisplayFunc, display
invoke glutMainLoop
ret
ENDP
;-------------------
Now, to me, that doesn't look a hell of a lot like "real assembly language". I can stare at it and think like a CPU, but I can't see what it "does". Reminds me a bit of why I found trying to learn C "unsatisfying" - I felt more like a data entry clerk than a programmer. The library routines are having all the fun! :)
Can't blame Linux, or libraries - I get the same reaction to the Windows APIs. James was asking for some "pure asm" - defined as "using just interrupts" for Windows. Might have a better shot at that in Linux, actually. I'm beginning to figure out the "framebuffer device" - graphics for Linux with "just ints". This isn't the popular "GUI app" that John's wanting to learn, though... :(
Dos was more fun!
Best,
Frank
.
- Follow-Ups:
- Re: ASM noob - couple of questions
- From: o//annabee
- Re: ASM noob - couple of questions
- From: Betov
- Re: ASM noob - couple of questions
- References:
- ASM noob - couple of questions
- From: Daniel Bodnar
- Re: ASM noob - couple of questions
- From: JGCASEY
- Re: ASM noob - couple of questions
- From: Betov
- Re: ASM noob - couple of questions
- From: JGCASEY
- Re: ASM noob - couple of questions
- From: Betov
- ASM noob - couple of questions
- Prev by Date: Re: BBS test
- Next by Date: Re: BBS test
- Previous by thread: Re: ASM noob - couple of questions
- Next by thread: Re: ASM noob - couple of questions
- Index(es):
Relevant Pages
|