Re: Question about jumps
- From: "Evenbit" <nbaker2328@xxxxxxxxxxx>
- Date: 29 Aug 2006 15:09:23 -0700
I think a person learns best by playing with existing programs. Here
is a little 'template' or 'starter kit' that you can build on. Just
keep adding macros and subroutines to extend the functionality.
; nasm -f elf -l stk.lst -Xvc -O8 -o stk.o stk.asm
; ld -s -o stk stk.o
; define some system constants
_sys_exit equ 1
_sys_write equ 4
_sys_stdout equ 2
; define some system macros
%macro sys_exit 1
mov eax, _sys_exit
mov ebx, %1
int 0x80
%endmacro
%macro writestr 2+
[section .data]
%%str: db %2
%%endstr:
__SECT__
mov ecx, %%str
mov edx, %%endstr-%%str
mov ebx, %1
mov eax, _sys_write
int 0x80
%endmacro
global _start
section .data
hw db 'Hello, World!', 10
hwlen equ $-hw
section .text
_start:
mov edx, hwlen
mov ecx, hw
mov ebx, _sys_stdout
mov eax, _sys_write
int 0x80
writestr _sys_stdout, 'Goodbye, World!', 10
sys_exit 0
Nathan.
.
- Follow-Ups:
- Re: Question about jumps
- From: Markus Pitha
- Re: Question about jumps
- From: Evenbit
- Re: Question about jumps
- References:
- Question about jumps
- From: Markus Pitha
- Question about jumps
- Prev by Date: Re: Question about jumps
- Next by Date: Re: Question about jumps
- Previous by thread: Re: Question about jumps
- Next by thread: Re: Question about jumps
- Index(es):
Relevant Pages
|