Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Assembly Lanuage - ASM


Scar0ptics's Avatar
Member
0 0

If you really want to break it down to a science then why not learn ASM, hell, most people don't even have a fucking clue what it is. This is the science behind a compiler as it already has these functions built within it already. This will allow you to break down the logic and science of system functions within operations going on with the machine.

section .text global main ;must be declared for using gcc

main: ;tell linker entry point mov edx, len ;message length mov ecx, msg ;message to write mov ebx, 1 ;file descriptor (stdout) mov eax, 4 ;system call number (sys_write) int 0x80 ;call kernel

mov eax, 1 ;system call number (sys_exit) int 0x80 ;call kernel

section .data

msg db 'Hello, world!',0xa ;our dear string len equ $ - msg ;length of our dear string

I was messing around with this and ended up creating two strings to show Hello World on two different lines. :Dtee-hee


Scar0ptics's Avatar
Member
0 0

section .text global main ;must be declared for using gcc

main: ;tell linker entry point

mov	edx, len	    ;message length
mov	ecx, msg	    ;message to write
mov	ebx, 1	     ;file descriptor (stdout)
mov	eax, 4	    ;system call number (sys_write)
int	0x80	             ;call kernel

mov	edx, len2	    ;message length
mov	ecx, msg2	    ;message to write
mov	ebx, 1	     ;file descriptor (stdout)
mov	eax, 4	     ;system call number (sys_write)
int	0x80	             ;call kernel


mov	edx, len3	    ;message length
mov	ecx, msg3	    ;message to write
mov	ebx, 1	    ;file descriptor (stdout)
mov	eax, 4	    ;system call number (sys_write)
int	0x80	            ;call kernel


mov	eax, 1	        ;system call number (sys_exit)
int	0x80	                ;call kernel

 section	.data

  msg	db	'Hello,',0xa	    ;our dear string
  len	equ	$ - msg         ;length of our dear string

  msg2	db	'    ',0xa	  ;our dear string
  len2	equ	$ - msg2	 ;length of our dear string

  msg3 db 'world!', 0xa   ;our dear string
  len3 equ $ - msg3      ;length of our dear string

I made some simple modifications….tee-hee:Ptee-hee

Also, check out http://syscalls.kernelgrok.com/