Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INCLUDE Irvine32.inc
- INCLUDELIB Irvine32.lib
- ; EXECUTION MODE PARAMETERS
- .386
- .model flat, stdcall
- .stack 4096
- ; PROTOTYPES
- ExitProcess PROTO, dwExitCode:DWORD
- ; DATA SEGMENT
- .data
- Press0 BYTE "Press the '0' key to shift the bit in position 0.",0
- bit0 BYTE ?
- color word LIGHTCYAN, LIGHTGREEN, YELLOW, RED, WHITE , '\0'
- ; CODE SEGMENT
- .code
- main PROC
- InfiniteLoopBegin: ;Infinite Loop beings here
- MOV EAX,0
- MOV AX, [color + 0]
- ;inc Color
- call setTextColor
- call setTextColor
- call WriteBit0 ;Bit Code Value 0 displayed here
- mov eax,7
- call SetTextColor
- call crlf
- mov edx, offset press0
- call writestring
- call crlf
- CALL ReadDec
- mov ecx, eax
- TestingBitZeroLoop_Begin: ;Conditional loop for bit0
- CMP eax, 0
- Jz equalTo0
- jmp over0
- equalTo0:
- cmp bit0, 00000000b
- 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
- 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.
- equalTo0_2:
- mov bit0, 00000001b
- jmp over0
- greaterThan0_2:
- MOV EAX, 0
- MOV AX, [color]
- inc color
- call setTextColor
- mov bit0, 00000000b
- jmp over0
- LOOP TestingBitZeroLoop_Begin ;End of conditional loop
- over0:
- JMP InfiniteLoopBegin ;Infinite loop ends her
- main endp
- ;Preserve this
- WriteBit0 PROC USES EAX EBX EDX ;Write procedure for bit0
- ; Load registers with appropriate display information.
- movzx EAX, bit0
- call Writedec
- ret
- WriteBit0 ENDP
- END main ; End of program OPCODES.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement