Advertisement
JPM123

Untitled

May 19th, 2021
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. INCLUDE Irvine32.inc
  2. INCLUDELIB Irvine32.lib
  3. ; EXECUTION MODE PARAMETERS
  4. .386
  5. .model flat, stdcall
  6. .stack 4096
  7. ; PROTOTYPES
  8. ExitProcess PROTO, dwExitCode:DWORD
  9. ; DATA SEGMENT
  10. .data
  11. Press0 BYTE "Press the '0' key to shift the bit in position 0.",0
  12. bit0 BYTE ?
  13. color word LIGHTCYAN, LIGHTGREEN, YELLOW, RED, WHITE , '\0'
  14. ; CODE SEGMENT
  15. .code
  16. main PROC
  17. InfiniteLoopBegin: ;Infinite Loop beings here
  18. MOV EAX,0
  19. MOV AX, [color + 0]
  20. ;inc Color
  21. call setTextColor
  22. call setTextColor
  23. call WriteBit0 ;Bit Code Value 0 displayed here
  24. mov eax,7
  25. call SetTextColor
  26. call crlf
  27. mov edx, offset press0
  28. call writestring
  29. call crlf
  30. CALL ReadDec
  31. mov ecx, eax
  32. TestingBitZeroLoop_Begin: ;Conditional loop for bit0
  33. CMP eax, 0
  34. Jz equalTo0
  35. jmp over0
  36. equalTo0:
  37. cmp bit0, 00000000b
  38. Jz equalTo0_2 ;The 0_2 means if it is equal to 0 than it will go into another part of the loop to test what the current value
  39. JMP greaterThan0_2 ;of the loop bit is . If it is 0 than it will be flipped and if its is 1 than it will be flippped to 0.
  40. equalTo0_2:
  41. mov bit0, 00000001b
  42. jmp over0
  43. greaterThan0_2:
  44. MOV EAX, 0
  45. MOV AX, [color]
  46. inc color
  47. call setTextColor
  48. mov bit0, 00000000b
  49. jmp over0
  50. LOOP TestingBitZeroLoop_Begin ;End of conditional loop
  51. over0:
  52.  
  53. JMP InfiniteLoopBegin ;Infinite loop ends her
  54.  
  55. main endp
  56. ;Preserve this
  57. WriteBit0 PROC USES EAX EBX EDX ;Write procedure for bit0
  58. ; Load registers with appropriate display information.
  59. movzx EAX, bit0
  60. call Writedec
  61. ret
  62. WriteBit0 ENDP
  63.  
  64. END main ; End of program OPCODES.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement