//最大公约
.386
.model flat,stdcall
option casemap:none
include kernel32.inc
includelib kernel32.lib
includelib msvcrt.lib
scanf PROTO C:DWORD,:vararg
printf PROTO C:DWORD,:vararg
.data
InFmt BYTE '%d %d',0
OutFmt BYTE '%d',0AH,0
i DWORD 1
.data?
x DWORD ?
y DWORD ?
moded_1 DWORD ?
moded_2 DWORD ?
moded_ok DWORD ?
dived DWORD ?
temp DWORD ?
.code
start:
invoke scanf,ADDR InFmt,ADDR x,ADDR y
.while EAX != -1
MOV ECX,1
MOV EBX,y
.IF x < EBX
.while ECX <= x
MOV temp,ECX
MOV EAX,x
CDQ
IDIV ECX
MOV moded_1,EDX
MOV EAX,y
CDQ
IDIV ECX
MOV moded_2,EDX
.IF moded_1 == 0 && moded_2 == 0
MOV moded_ok,ECX
MOV ECX,temp
.ENDIF
Inc ECX
.endw
.ELSE
.while ECX <= y
MOV temp,ECX
MOV EAX,x
CDQ
IDIV ECX
MOV moded_1,EDX
MOV EAX,y
CDQ
IDIV ECX
MOV moded_2,EDX
.IF moded_1 == 0 && moded_2 == 0
MOV moded_ok,ECX
MOV ECX,temp
.ENDIF
Inc ECX
.endw
.ENDIF
invoke printf,ADDR OutFmt,moded_ok
invoke scanf,ADDR InFmt,ADDR x,ADDR y
.endw
invoke ExitProcess,0
end start
**
//最小公倍数
**
.386
.model flat, stdcall
include kernel32.inc
includelib kernel32.lib
includelib msvcrt.lib ;引用C库文件
printf PROTO C:ptr sbyte,:vararg ;C语言printf函数原型声明
scanf PROTO C:ptr sbyte,:vararg ;C语言scanf函数原型声明
option casemap :none
;*【*/
.data
InFmt BYTE '%d %d',0
OutFmt BYTE '%d',0AH,0
i DWORD 1
.data?
x DWORD ?
y DWORD ?
muled DWORD ?