私はアスタリスク(*)で作られたVをランダムな前景色と背景色を持つ*で作成します。ここに私のコードです...私はいくつかの休憩を入れ、プログラムをトレースし、それが何を問題にしているかを幾分考え出しました。ループカウンタ(ECX
レジスタ)を上書きし、カーソル位置の移動に使用されるDH
/DL
レジスタを上書きするcolorプロシージャをバックスラッシュPROC
が呼び出しているため、無限ループになります。私は組み立ての初心者であり、将来これらの問題を避けて修正するためのヒントやヒントを使用することができます。どんな助けもありがとうございます、事前に感謝します!組み立て時に無意味なループが発生する
割り当てガイドライン - 問題が何であるかを決定する上https://docs.google.com/document/d/1iPqfTd0qNOQo_xubVvsZLqfeNDog8mK6kzGGrR6s-OY/edit?usp=sharing
; main.asm - Assembly language source file
; Author: Dekota Brown
; Date: 2/21/2017
; Description: Colorful V-Pattern
INCLUDE Irvine32.inc ; Irvine's assembly library
ExitProcess PROTO,dwExitCode:DWORD ; MS Windows ExitProcess function
.data
nullVar DWORD ?
msgEnd BYTE "Is the program running as you thought?",0
msgEndCaption BYTE "Program Exit...",0
symbol BYTE '*',0
.code
main PROC ; main procedure, entry point
mov EAX, nullVar
mov EBX, nullVar
mov ECX, nullVar
mov EDX, nullVar
call backslash
mov EDX,OFFSET msgEnd
mov EBX,OFFSET msgEndCaption
call MsgBoxAsk
mov EAX,07
call SetTextColor
call CrLf
call WaitMsg
INVOKE ExitProcess,0 ; end the program
main ENDP
color PROC
call Randomize ; Seed the RNG
mov ECX,20 ; Set up loop counter
L1:
mov EAX, 256
call RandomRange
call SetTextColor
mov EDX,OFFSET symbol
call WriteString
loop L1
ret
color ENDP
backslash PROC
mov dl, 2 ; Row 2
mov dh, 4 ; Column 4
mov ECX,20 ; Sets up loop counter
L2:
call color
call CrLf
add dh,1 ; Increments column or shifts right by 1 position
loop L2
ret
backslash ENDP
forwardslash PROC
ret
forwardslash ENDP
END