Compare commits
4 Commits
22f1cae833
...
testing
| Author | SHA1 | Date | |
|---|---|---|---|
| 5709c50700 | |||
|
33175e2c19
|
|||
|
5685ac6e67
|
|||
|
3360f1976c
|
1
Makefile
1
Makefile
@@ -1,6 +1,7 @@
|
|||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
SRC := $(wildcard *.asm)
|
SRC := $(wildcard *.asm)
|
||||||
|
SRC := $(filter-out functions.asm, $(SRC))
|
||||||
OBJDIR := build
|
OBJDIR := build
|
||||||
OBJS := $(SRC:%.asm=$(OBJDIR)/%.o)
|
OBJS := $(SRC:%.asm=$(OBJDIR)/%.o)
|
||||||
BINS := $(SRC:%.asm=$(OBJDIR)/%)
|
BINS := $(SRC:%.asm=$(OBJDIR)/%)
|
||||||
|
|||||||
0
functions.asm
Normal file
0
functions.asm
Normal file
@@ -1,17 +1,22 @@
|
|||||||
; Hello World Program - asmtutor.com
|
; %include 'functions.asm'
|
||||||
; Compile with: nasm -f elf helloworld.asm
|
|
||||||
; Link with (64 bit systems require elf_i386 option): ld -m elf_i386 helloworld.o -o helloworld
|
|
||||||
; Run with: ./helloworld
|
|
||||||
|
|
||||||
SECTION .data
|
SYS_EXIT equ 1
|
||||||
msg db 'Hello World!', 0Ah ; assign msg variable with your message string
|
SYS_WRITE equ 4
|
||||||
|
STDOUT equ 1
|
||||||
|
|
||||||
SECTION .text
|
section .data
|
||||||
global _start
|
msg db "Hello, world!", 0Ah
|
||||||
|
|
||||||
|
section .text
|
||||||
|
global _start
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
mov edx, 13 ; number of bytes to write - one for each letter plus 0Ah (line feed character)
|
mov edx, 14
|
||||||
mov ecx, msg ; move the memory address of our message string into ecx
|
mov ecx, msg
|
||||||
mov ebx, 1 ; write to the STDOUT file
|
mov ebx, STDOUT
|
||||||
mov eax, 4 ; invoke SYS_WRITE (kernel opcode 4)
|
mov eax, SYS_WRITE
|
||||||
int 80h
|
int 0x80
|
||||||
|
|
||||||
|
mov ebx, 0
|
||||||
|
mov eax, SYS_EXIT
|
||||||
|
int 0x80
|
||||||
|
|||||||
Reference in New Issue
Block a user