Skip to content

Commit

Permalink
Usage of macror
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Jul 1, 2024
1 parent 51ae247 commit db5525d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pc-dos/hello_macros.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
; Program typu "Hello, world!" urceny pro DOS a prelozitelny assemblerem NASM
;
; preklad pomoci:
; nasm -f bin -o hello.com hello_macros.asm
;
; nebo pouze:
; nasm -o hello.com hello_macros.asm

;-----------------------------------------------------------------------------

; ukonceni procesu a navrat do DOSu
%macro exit 0
mov ah, 0x4c
int 0x21
%endmacro

; vyprazdneni bufferu klavesnice a cekani na klavesu
%macro wait_key 0
xor ax, ax
int 0x16
%endmacro

; tisk retezce na obrazovku
%macro print 1
mov dx, %1
mov ah, 9
int 0x21
%endmacro

;-----------------------------------------------------------------------------
org 0x100 ; zacatek kodu pro programy typu COM (vzdy se zacina na 256)

start:
print message
wait_key
exit

; retezec ukonceny znakem $
message db "Hello, world!", 0x0d, 0x0a, "$"

0 comments on commit db5525d

Please sign in to comment.