Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31

Thread: "Hello world" in assembler

  1. #21
    Guest

    Re: "Hello world" in assembler


    size and space are very important. my boss would freak if i said 'lets do this in <insert interpertated language here>" . *although in most cases C is the best thing to use. *the compiled code is small and fast. *i would like to see how "hello world" does in assembly as well as c in size and speed....
    Depends on the job. I don't think a grocery store manager will care that by using a compiled language he will get better performances: he just wants it ASAP and ACAP that's it. Of course, if you work in a technology company and you do things like software, drivers or I don't know what, choosing C might be a better idea. But if the manager wants something to send a document on a website or to a email, don't lose time doing it in Assembly.

  2. #22

    Re: "Hello world" in assembler

    Ha! All you guys are pathetic. I learnt how to hand compile assembler for an 8086... Ok, so it's extremely difficult (and I'm not even sure how to write a "Hello World" proggy in it), but I had to learn it for a digital electronics class (Digital Instrumentation.) Try to figure out what this one does, hehe (actually, if it's converted to asm, you'll notice that it's not all that complex):
    Code:
    mem. addr   hex code
    01000      bF 00 02
    01003      8A 05
    01005      8A 5d 01
    01008      88 45 01
    0100b      88 1d
    0100d      Cb

  3. #23

    Re: "Hello world" in assembler


    Code:
    mem. addr   hex code
    01000      bF 00 02
    01003      8A 05
    01005      8A 5d 01
    01008      88 45 01
    0100b      88 1d
    0100d      Cb
    Are you sure you did this right? How can you have different lengths of operands for the same opcodes? I looked up 8A and it says it's a byte operation, so how can you have two bytes after it at address 1005?

    But I want to mention that I had to do this kind of stuff with the Z80 processor in one of my classes. It wasn't fun. I much prefer assembler to machine language.

  4. #24

    Re: "Hello world" in assembler




    Are you sure you did this right? How can you have different lengths of operands for the same opcodes? I looked up 8A and it says it's a byte operation, so how can you have two bytes after it at address 1005?

    But I want to mention that I had to do this kind of stuff with the Z80 processor in one of my classes. It wasn't fun. I much prefer assembler to machine language.
    NB that there are actually two opcodes for which you reference, 8A and 05. Those two opcodes take two bytes. That's why the memory address goes from 01003 to 01005.

    I could have listed the opcodes and their individual memory address, but that would be too long. Basically, the first time the 8A opcode is used (at mem. addr. 01003), 8A is in mem. addr. 01003 and 05 is in mem. addr. 01004.

  5. #25

    Re: "Hello world" in assembler


    Code:
    mem. addr   hex code
    01000      bF 00 02
    01003      8A 05
    01005      8A 5d 01
    01008      88 45 01
    0100b      88 1d
    0100d      Cb
    Ok. Let's try it again.

    mov di,0200
    lodsb
    add eax,something # the table says 05 should be followed by immediate data
    lodsb
    pop ebp
    add something,something # again, the table says something should follow

    Oh I've had enough of this. This isn't making sense. Go ahead and translate it to assembler.

  6. #26

    Re: "Hello world" in assembler




    Ok. Let's try it again.

    mov di,0200
    lodsb
    add eax,something # the table says 05 should be followed by immediate data
    lodsb
    pop ebp
    add something,something # again, the table says something should follow

    Oh I've had enough of this. This isn't making sense. Go ahead and translate it to assembler.
    The first line was right.
    Code:
    mov   DI, 0200h
    mov   AL, [DI]
    mov   BL, [DI]+1
    mov   [DI]+1,AL
    mov   [DI], BL
    ret

  7. #27

    Re: "Hello world" in assembler

    The second line was right too by the way. lodsb has the same meaning as what you put. I can't find where in this Intel architecture guide it lists the register operands.

  8. #28

    Re: "Hello world" in assembler

    Basically, it just swaps the data in memory locations 00200h and 00201h.

  9. #29

    Re: "Hello world" in assembler

    I made a small mistake. lodsb isn't exactly the same as "mov eax,[di]". lodsb does that but also increments di afterwards. You could have used it to make your program one less instruction long. (But you probably weren't going for the ultimate fastest program to move two pieces of data.) Another mistake is that lodsb loads a single byte while eax is a double word, so I should have used lodsd.

  10. #30

    Re: "Hello world" in assembler


    I made a small mistake. lodsb isn't exactly the same as "mov eax,[di]". lodsb does that but also increments di afterwards. You could have used it to make your program one less instruction long. (But you probably weren't going for the ultimate fastest program to move two pieces of data.) Another mistake is that lodsb loads a single byte while eax is a double word, so I should have used lodsd.
    Well, this code was written for an 8086 and I'm not sure the 8086 has a lodsb. I know it doesn't have a eax. It's only the first 16 bit processor ever.

Similar Threads

  1. "Historic" Open Source Victory - GPL is legally valid and enforcable!
    By beezlebubsbum in forum Linux - General Topics
    Replies: 0
    Last Post: 02-22-2010, 11:33 PM
  2. "MicroHat" "SoftRed"
    By Fatal Error in forum General Chat
    Replies: 0
    Last Post: 05-12-2005, 09:03 PM
  3. "groupadd" and "tree" utilities are nowhere??
    By aromes in forum Redhat / Fedora
    Replies: 1
    Last Post: 10-05-2003, 03:50 AM
  4. error installing packages "krb5-libs" ; AND NVIDIA troubles
    By SaTaNcLaUz in forum Linux - General Topics
    Replies: 23
    Last Post: 11-14-2002, 09:26 PM
  5. Xlib:  extension "GLX" missing on display ":0.0".
    By ph34r in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 12-06-2001, 04:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •