Donate to us via Paypal!
Society leans ever heavily on computers, if you have the power to take out computers you can take out society. - cubeman372
Monday, March 01, 2021
Navigation
Home
 Find:
 Information:
Learn
Communicate
Submit
Shop
Challenges
 Exploit:
 Programming:
 Think:
 Track:
 Patch:
 Other:
 Need Help?
Other
Members Online
Total Online: 120
Guests Online: 120
Members Online: 0

Registered Members: 133766
Newest Member: denim6321d
Latest Articles

View Thread

HellBound Hackers | Computer General | Programming

Author

ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 01-08-16 12:29
I started learning assembly, and I found a hello world example on the site.
.MODEL small
.DATA
printme db \"Hello World!\",13,10,\'$\'
.CODE
mov ax,@data
mov ds,ax
mov dx,offset printme
mov ah,9
int 21h
mov ax,4c00h
int 21h

I try 'nasm -f elf test.asm', but I catch error.
May somebody show me the right code?
I use windows which is 64 bit, but I run the 32bit compiler.




Edited by psyl0cke on 01-08-16 12:30
http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

Huitzilopochtli
Member



Posts: 1644
Location:
Joined: 19.02.13
Rank:
God
Posted on 01-08-16 16:37
printme db \"Hello World!\",13,10,\'$\'

Those back slashes are from php addslashes () and prob shouldn't be in your code.

Apart from that, what does the error message say?
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 01-08-16 17:00
hello.asm:1: error: attempt to define a local label before any non-local labels
hello.asm:1: error: parser: instruction expected
hello.asm:2: warning: label alone on a line without a colon might be in error
hello.asm:2: error: attempt to define a local label before any non-local labels
hello.asm:4: warning: label alone on a line without a colon might be in error
hello.asm:7: error: comma, colon, decorator or end of line expected after operand


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

SuQuay_FuQuay
Member

Your avatar

Posts: 20
Location:
Joined: 13.03.16
Rank:
Hacker Level 2
Posted on 01-08-16 17:35
The errors are due to you using old 16 bit DOS code that probably won't work on modern versions of windows, unless you use an emulator like DOSbox.

The warnings can be ignored as the interpreter thinks those might be labels, thinks you may have mis-spelled something, so alerts you just incase.
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 01-08-16 17:50
May you share the up-to-date code with us?


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

Lord_Zeyn
Member



Posts: 7
Location: /home
Joined: 05.08.16
Rank:
Active User
Posted on 05-08-16 21:13
Hey psyl0cke, this is the example of "Hello world" program in NASM (Netwide Assembler):

http://pastebin.com/Kqwp6Fse

However, you need to have fundamental knowledge of working principles of CPU and memory to better understand this code.
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 06-08-16 12:04
How should I compile it? I can't get the .exe file.
I know nasm.exe -fwin32 hello.asm
What article series do you recommend?
It says "hello.asm:2: warning: label alone on a line without a colon might be in error"




Edited by psyl0cke on 06-08-16 12:41
http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

_spartax_
Member



Posts: 33
Location: SYSTEM
Joined: 03.06.16
Rank:
HBH Guru
Posted on 08-08-16 18:38
@psyl0cke, the code you have written, is in MASM specification. That is you have written code for MASM assembler (Macro Assembler) not NASM. So NASM doesn't compile it. Compile it with ml and link with link commands
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 08-08-16 21:58
Do you know how to do it with NASM?


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

_spartax_
Member



Posts: 33
Location: SYSTEM
Joined: 03.06.16
Rank:
HBH Guru
Posted on 09-08-16 02:48
; hello_world.asm
; compile with NASM
; nasm -f bin hello_world.asm -o hello_world.com

org 0x100 ; COM files start at 0x100

mov dx, msg
mov ds, dx ; dsGrinx = msg
mov ah, 0x09 ; print string function in DOS
int 0x21

; lets terminate the program
mov ax, 0x4c00 ; ah = 0x4c (exit_function), al = 0x00 (return code)
int 0x21
ret

msg db 'Hello World', 0x0D, 0x0A, '$' ; MS-DOS strings are '$' terminated
Author

RE: ASM Hello World

_spartax_
Member



Posts: 33
Location: SYSTEM
Joined: 03.06.16
Rank:
HBH Guru
Posted on 09-08-16 02:51
COM files are 16 bit. So they won't run on a 64-bit windows machine. They will run on a 32-bit windows machine. To work in 32-bit / 64-bit machines you must program either in Windows / Linux Assembly
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 09-08-16 20:05
How to the a Hello World with popup and console in 32bit and 64bit windows?


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

_spartax_
Member



Posts: 33
Location: SYSTEM
Joined: 03.06.16
Rank:
HBH Guru
Posted on 09-08-16 20:28
hii psyl0cke see http://paste.ubuntu.com/22836222/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 09-08-16 20:52
How should I compile it under windows?
How to do it with console?
How to do it with 64bit console and popup?


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 09-08-16 20:56
_spartax_ wrote:
hii psyl0cke see http://paste.ubuntu.com/22836222/


asm_spartax_popup.asm:9: error: symbol `strMsg' undefined


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 09-08-16 23:29
Thanks for _spartax_ for the right code:
http://paste.ubuntu.com/22839587/ Grin

I compiled it by:
nasm -f win32 hello_world_popup.asm -o hello_world_popup.obj
I linked it by:
GoLink.exe /console /entry _start hello_world_popup.obj kernel32.dll user32.dll

I'm looking for the console variant now.


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 10-08-16 09:39
This is the console version: http://pastebin.com/dbcrMUaq


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 10-08-16 09:47
How to write Hello World! in window, like on app10?




Edited by psyl0cke on 10-08-16 10:44
http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 10-08-16 10:45
How to make this program work?
http://pastebin.com/XyP8GaqQ


http://psyl0ckediary.tumblr.com/
Author

RE: ASM Hello World

psyl0cke
Member



Posts: 824
Location: sharing love everywhere ♥
Joined: 01.07.13
Rank:
God
Posted on 11-08-16 16:05
It works now: http://psyl0ckediary.tumblr.com/post/148749366843/iv-hello-world-linux-win-printf-puts


http://psyl0ckediary.tumblr.com/