;鏈接庫測試
;測試Irvine32鏈接庫的過程
include irvine32.inc
TAB=9 ;TAB的ASCII碼
.code
main PROC
call Randomize ;初始化隨機生成器
call Rand1
call Rand2
call WaitMsg ;是用這句話之後就不會導致閃退了
exit
main ENDP
Rand1 PROC
;生成10個僞隨機整數
mov ecx,10 ;循環執行10次
L1:
call Random32 ;生成隨機整數
call WriteDec ;用無符號十進制形式輸出
mov al,TAB ;水平製表符
call WriteChar ;輸出製表符
loop L1
call Crlf
ret
Rand1 ENDP
Rand2 PROC
;在-50~+49之間生成10個僞隨機整數
mov ecx,10 ;循環10次
L1:
mov eax,100 ;數值範圍0~99
call RandomRange;生成隨機整數
sub eax,50 ;數值範圍-50~+49
call WriteInt ;用有符號十進制形式輸出
mov al,TAB ;水平製表符
call WriteChar ;輸出水平製表符
loop L1
call Crlf
ret
Rand2 ENDP
end main
020.動態鏈接庫測試隨機整數以及輸出結果閃退的處理辦法
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.