Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Created November 3, 2019 12:27
Show Gist options
  • Save arsalanses/75f6102243d5537cce1a96492ae415a4 to your computer and use it in GitHub Desktop.
Save arsalanses/75f6102243d5537cce1a96492ae415a4 to your computer and use it in GitHub Desktop.
; Sum of the members of a array
; Author: Arsalan sefidgar
STACK_SEG segment para stack 'stack'
db 64 dup('stack ')
STACK_SEG ends
DATA_SEG segment para 'data'
array db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
sum db 0
DATA_SEG ends
CODE_SEG segment para 'code'
main proc far
assume cs:CODE_SEG, ds:DATA_SEG, es:DATA_SEG, ss:STACK_SEG
mov ax, DATA_SEG
mov ds, ax
mov cx, 0000h
mov al, 0
mov bx, offset array
startLoop:
cmp cx, 10
jge endLoop
mov al, [bx]
add [sum], al
inc cx
inc bx
jmp startLoop
endLoop:
mov ax, 4c00h
int 21h
ret
main endp
CODE_SEG ends
end main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment