;;; hello.asm
;;; D. T.
;;; A program to display "hello" "world!"
;;; on the screen.
;;; To run:
;;; nasm -f elf -F stabs hello.asm
;;; ld -melf_i386 -o hello hello.o
;;; ./hello
%assign SYS_EXIT 1
%assign READ 3
%assign WRITE 4
%assign STDOUT 1
%assign ENDL 0x0a
;; -------------------------
;; data segment
;; -------------------------
section .data
msg db "hello"
db ENDL
db ENDL
db "world!", ENDL
MSGLEN equ 14
;; -------------------------
;; code area
;; -------------------------
section .text
global _start
_start: mov eax,WRITE
mov ebx,STDOUT
lea ecx,[msg]
mov edx,MSGLEN
int 0x80
;; exit()
mov eax,SYS_EXIT
mov ebx,0
int 0x80 ; final system call
|
# hello.py
# J. F.
# A program to display "hello" "world!"
# on the screen.
# To run:
# python3
# import hello
print("hello\n\nworld!")
|
![]() i386 architecture
|
??
|