汇编实现模块化编程实现乘方计算——纪念第一个不需调试的汇编程序

assume cs:codesg, ds:datasg

datasg segment
	dw 1, 2, 3, 4, 5, 6, 7, 8
	dw 8 dup(0)
datasg ends

codesg segment
entry:
	mov ax, datasg
	mov ds, ax
	mov si, 0
	mov cx, 8
s0:
	mov bx, ds:[si]
	call pow
	mov ds:[si + 16], ax
	mov ds:[si + 16 + 2], dx
	add si, 2
	loop s0
	mov ax, 4c00h
	int 21h
pow:
	mov ax, bx
	mul bx
	mul bx
	ret
codesg ends
end entry

你可能感兴趣的:(系统编程)