flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Another attempt at examples...

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 07 Dec 2007, 00:53
This is what i was hoping to figure out by this post, and if so get some help on this. Especially because i'm no expert on any of the instruction sub-sets. I don't even know all the basic instructions. I figured that there woudln't be anyone (or very few if any) who knew them all (aside from Tomasz) by heart. I figured this project would be a learning experience for everyone. I don't have much time, but i thought i could throw this out onto the table to get the ball rolling. I figured that nothing could help us more than actually making example programs to do this, and not let a single instruction go uncommented (at lease until used once) and unused. Not all in one program, of course, unless part of a well organized huge program, but i find that would probably be too hard. I think that actual examples showing the changes that each instruction makes would be much better than reading about it and trying to interpret the reading and figuring out how to use it. For one, there's no guessing if we got it right or not, and two, it's much faster to look at it *AND* read about it, than trying to do it in your head and comming up with a test program to see if you're right about your guess.
Post 07 Dec 2007, 00:53
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf 07 Dec 2007, 08:15
Post 07 Dec 2007, 08:15
View user's profile Send private message MSN Messenger Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 07 Dec 2007, 20:28
That's good, but what we need is something for fasm though. Most likely something assembleable so the learner can mess with the values to see different outputs.
Post 07 Dec 2007, 20:28
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman 08 Dec 2007, 05:31
There's some simple, commented, fasm code at:
http://home.comcast.net/~dexos/
It's all for DexOS and you'll need to change the DEX2 to DEX1 or wait a few weeks for the new ver of DexOS to be released (all the examples work on both ver of DexOS)
Post 08 Dec 2007, 05:31
View user's profile Send private message Visit poster's website Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 08 Dec 2007, 09:49
I gladly found this thread for beginners tutorials and would like to say a few words out of a noob's "wishlist" in mind (...as I AM a noob! Very Happy )

I try Fasm under linux and there are rarely tut's, which I am able to understand, and what I am especially seeking at the moment is

a) a SHORT, WELL-decumented sourcecode, which gets the arguments (or parameters, don't know, if this is the exact english word...) of the commandline and put them out at the screen, so I can see, how to handle. I saw a few progs, that try to explain the handling of cmdline-arguments, but none of them was working source-code, although I'm sure, nearly all of U can code a working example in maximal 30 lines of sourcecode.

b) a SHORT, WELL-documented sourcecode of how to get in graphics-mode and do some putpixel and getpixel.
Nothing high-power, super-performance opengl, or some of this, but a simple piece of code, that gets in graphics-mode (full-screen or window, that doesn't matter) and puts anywhere a pixel in some colour and gets elsewhere the colour of one pixel.


That would be on my wishlist in the moment, maybe, one of the forum members has an example-code for this. Smile
If U try to help the newbees, why not try this way, small example-progs to various points.
-> working (compileable) sourcecode tells me much more, as any theoretically tut. Very Happy

With kindest regards, andyz74
Post 08 Dec 2007, 09:49
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 08 Dec 2007, 15:17
@andyz74, for your command line demo, i would take a look at the linux source code for fasm, also this: http://board.flatassembler.net/topic.php?t=1446

And for your simple graphic demo, take a look at this


Description:
Download
Filename: sdldemo.tar.gz
Filesize: 7.58 KB
Downloaded: 756 Time(s)

Post 08 Dec 2007, 15:17
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 08 Dec 2007, 16:23
The graphics-demo seems to be interesting, I hope I can get a lot of knowledge out of the source.
Out of my "duty" I've e found by the search-function the link U posted, and I'm aware of the fact, that prog-name and arguments are stored in the stack, but something doesn't work with that, what I have believed to learn out of it.
I expected the downstanding code to work, if I start the prog with one argument. But it doesn't work.
(Sorry, this is all off topic, I'll stop it after this entry)

Code:
format ELF executable
        entry start

     segment readable executable

start:
       pop     eax          ; Get the number of arguments
  pop     ecx          ; Get the program name
 pop     edx          ; Get arg 1


    mov eax,4            ; The system call for write (sys_write)
        mov ebx,1            ; File descriptor 1 - standard output
                  ; CX should be "popped" as pointer to prog-name
                   ; DX should be "popped" as pointer to arg 1.
      int 80h


     mov     eax,1
       mov     ebx,0
       int     80h             ; Exit

    
Post 08 Dec 2007, 16:23
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 08 Dec 2007, 19:36
I am also new to linux programming, but i would do something like this:
Code:
format ELF executable        entry start segment readable  executablestart:  pop     eax              ; Get the number of arguments        pop     ecx              ; Get the program name       pop     ecx              ; pointer to the second argument        mov     esi,ecx  call    str_len       mov     edx,esi       mov     eax,4            ; The system call for write (sys_write)      mov     ebx,1            ; File descriptor 1 - standard output                                 ; CX should be "popped" as pointer to prog-name                             ; DX should be "popped" as pointer to arg 1.       int     80h       mov     eax,1 mov     ebx,0 int     80h             ; Exit;Input ESI = ASCII string;Output ESI = string lenstr_len:        push       eax        push       ecx        mov        ecx,esistr_lp:       lodsb       or   al,al       jnz       str_lp       dec      esi       sub esi,ecx       pop     ecx       pop eax       ret    
Post 08 Dec 2007, 19:36
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 09 Dec 2007, 03:01
I'm thinking about waiting for the beginner package to come out before i really start or ask anyone else to start. That way we can get cross-platform stuff rolling out so no one has to first learn how to setup a particular OS first, especially if some one would have ended up coding for windows. No one would want to buy windows just to learn how to code for linux using fasm. As for specific examples, we've tried that numerous times before. Plus, i think learning the mneumonics is more important than screwing around with a specific api.
Post 09 Dec 2007, 03:01
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.