asm1: lab1

This commit is contained in:
KoroLion 2020-12-19 17:08:33 +03:00
parent 8577ab66d8
commit f9a5e49d29
4 changed files with 32 additions and 0 deletions

16
asm1/lab1/nasm.asm Normal file
View File

@ -0,0 +1,16 @@
section .data
s: db 'HELLO WORLD', 10 ; 10 = '\n'
section .text
global _start ; adding _start name to object code
_start:
mov eax, 4 ; system call 'write'
mov ebx, 1 ; write to stdout
mov ecx, s ; string adr
mov edx, 12 ; string len
int 80h
mov eax, 1 ; system call 'exit'
mov ebx, 0 ; exit code
int 80h

16
asm1/lab1/tasm.asm Normal file
View File

@ -0,0 +1,16 @@
.model small ; small memory model (64 KB)
.stack 100h ; reserve 100h bytes for stack
.data
message db 'HELLO WORLD', 13, 10, '$' ; 13 = \r, 10 = \n, string must be terminated with $
.code
start:
mov ax, @data ; unable to put in ds directly
mov ds, ax
mov dx, offset message ; offset of the message (0)
mov ah, 09h ; display string ds:dx
int 21h ; main system interrupt
mov al, 0 ; return code 0
mov ah, 4Ch ; terminate with return code
int 21h
end start

Binary file not shown.

Binary file not shown.