dev.bat
path %path%;c:\masm32\bin
cmd
 

dec1.asm
comment *
	dec1.asm for MASM32
 
ml /c /AT /Fl dec1.asm
link16 /t dec1;
*
 
		.model	tiny
 
		.code
		org	100h
start:
		mov	ax, 1234h
		mov	di, offset buf + 5
		mov	bx, 10
		mov	cx, 5
L1:
		xor	dx, dx
		div	bx
		or	dl, 30h
		dec	di
		mov	byte ptr [di], dl
		loop	L1
 
		mov	ah, 09h
		mov	dx, offset buf
		int	21h
 
		mov	ax, 4c00h
		int	21h
 
buf		db	5 dup (?), '$'
 
		end	start
 

旧バージョン
+ ...
dec1.asm
comment *
	dec1.asm for MASM32
 
ml /c /AT /Fl dec1.asm
link16 /t dec1;
*
 
		.model	tiny
 
		.code
		org	100h
start:
		mov	ax, 1234h
		mov	di, offset buf
		mov	si, offset base
		mov	cx, 5
L1:
		mov	bx, word ptr [si]
		xor	dx, dx
		div	bx
		or	al, 30h
		mov	byte ptr [di], al
		mov	ax, dx
		inc	di
		add	si, 2
		loop	L1
 
		mov	ah, 9h
		mov	dx, offset buf
		int	21h
 
		mov	ax, 4c00h
		int	21h
 
base		dw	10000, 1000, 100, 10, 1
buf		db	5 dup (?), '$'
 
		end	start
 

dec2.asm
comment *
	dec2.asm for MASM32
 
ml /c /AT /Fl dec2.asm
link16 /t dec2;
*
 
		.model	tiny
 
		.code
		org	100h
 
start		proc
		mov	ax, 0cafeh
		mov	di, offset buf
		mov	si, offset base
		mov	cx, 5
L1:
		mov	bx, word ptr [si]
		call	div_ltd
		or	dl, 30h
		mov	byte ptr [di], dl
		inc	di
		add	si, 2
		loop	L1
 
		mov	ah, 9h
		mov	dx, offset buf
		int	21h
 
		mov	ax, 4c00h
		int	21h
start		endp
 
div_ltd		proc
		xor	dx, dx
L1:
		sub	ax, bx
		jc	L2
		inc	dl
		jmp	L1
L2:
		add	ax, bx
		ret
div_ltd		endp
 
		even
base		dw	10000, 1000, 100, 10, 1
buf		db	5 dup (?), '$'
 
		end	start
 
最終更新:2017年11月07日 06:25