2025-12-28 16:55:03 -05:00

48 lines
609 B
NASM

;;; tested with NASM version 2.16.01
section .text
;; entry point
main:
mov ax, 1
call _addition_test
ret
;; adding tests
_add_cx:
mov cx, 25
add ax, cx
ret
_add_dx:
mov dx, 50
add ax, dx
ret
_add_bx:
mov bx, 100
add ax, bx
ret
;; subtracting tests
_sub_cx:
sub ax, cx
ret
_sub_dx:
sub ax, dx
ret
_sub_bx:
sub ax, bx
ret
;; test function for call stack test
_addition_test:
call _add_cx
call _add_dx
call _add_bx
call _sub_cx
call _sub_dx
call _sub_bx
inc ax
dec dx
ret ; result should be 2