031.修改博客30中的程序,利用标号来模拟条件分支语句

; Alternate version of Regist.asm     (RegistAlt.asm)

; Shows code generated by MASM, using .IF/.ELSE/.ENDIF
; directives as comments. The automatically generated
; label names are different from page 221, but the
; logic is the same.

INCLUDE Irvine32.inc

.data
TRUE = 1
FALSE = 0
gradeAverage  WORD 275	; test value
credits       WORD 12	; test value
OkToRegister  BYTE ?

.code
main PROC
	mov OkToRegister,FALSE

;.IF gradeAverage > 350
 	cmp  gradeAverage,350
 	jbe  @C0001
 	mov  OkToRegister,TRUE
	jmp  @C0008

;.ELSEIF (gradeAverage > 250) && (credits <= 16)
@C0001:
	cmp  gradeAverage,250
	jbe  @C0004
	cmp  credits,16
	ja   @C0004
	mov  OkToRegister,TRUE
	jmp  @C0008

;.ELSEIF (credits <= 12)
@C0004:
	cmp  credits,12
	ja   @C0008
	mov  OkToRegister,TRUE

;.ENDIF
@C0008:

main ENDP
end main


展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 技术黑板 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读