Hi I'm new at Assembly language, and I tried to make a random integer from 65 to 69 ('A' to 'E') and store it to AL register. This is my code.
;Write a program that displays similar to Color_Matrix_Nested_Loop but without Delay call. However this time, you must implement it with a single loop, not nested loops. Use any conditional jump as you want. INCLUDE Irvine32.inc .data value1 DWORD ? default = lightGray + (black*16) .code main PROC mov ecx, 256 mov ebx, 00h L1: mov eax, ebx call SetTextColor call GetChFromABCDE call WriteChar mov dl, bl test bl, 00001111b jnz next call crlf next: add bl, 1h loop L1 mov eax, default call SetTextColor exit main ENDP ;------------------------------------------------------------ GetChFromABCDE PROC USES eax ; ; Generates a char randomly from 'A','B','C','D','E' ; Receives: Nothing ; Returns: The char ASCII code in AL ;------------------------------------------------------------ mov eax, 5 ; get random 0 to 4 call RandomRange ; mov eax, 41h ; make range 65 to 69 mov value1, eax mov al, BYTE PTR value1 GetChFromABCDE ENDP END main Whenever I try to trace the problem, a debugger says 'Source not available' and 'Source information is missing from the debug information for this module'. I guess the problem part is this.
mov value1, eax mov al, BYTE PTR value1 My professor says try to use registers instead of memories as possible as I can, but this time I have no idea to fix this problem..
https://stackoverflow.com/questions/66512510/a-random-integer-from-65-to-69-a-to-e-and-store-it-to-al-register March 07, 2021 at 09:55AM
没有评论:
发表评论