name "flags" org 100h jmp instruct instruction: db "Pick the right answer. Press any key to continue.", 0Dh,0Ah, "$" blank: db " ", 0Dh,0Ah, "$" q1: db "1. What is the best fps?: a. WARZONE b. VALORANT c. APEX LEGEND ", 0Dh,0Ah, "$" q2: db "2. Which is the best community among them?: a. WARZONE b. VALORANT c. APEX LEGENG ","$" q3: db "3. Which among them is the best having skins?: a. WARZONE b. VALORANT c. APEX LEGEND ", 0Dh,0Ah, "$" q4: db "4. Which among them is balanced?: a. WARZONE b. VALORANT c. APEX LEGEND ", 0Dh,0Ah, "$" q5: db "5. Which among them is the hard to play?: a. WARZONE b. VALORANT c. APEX LEGEND ", 0Dh,0Ah, "$" q6: db "6. Do you think Valorant players can dominate csgo players?: a. TRUE b. FALSE ", 0Dh,0Ah, "$" q7: db "7. Do you think WARZONE players can dominate APEX LEGEND players?: a. TRUE b. FALSE ", 0Dh,0Ah, "$" q8: db "8. Do you think APEX LEGEND players can dominate WARZONE players?: a. TRUE b. FALSE ", 0Dh,0Ah, "$" q9: db "9. Do you think Valorant players can dominate APEX LEGEND players?: a. TRUE b. FALSE ", 0Dh,0Ah, "$" q10: db "10. Do you think CSGO players can dominate VALORANT players?: a. TRUE b. FALSE ", 0Dh,0Ah, "$" tama: db ". Nice you're correct, next question", 0Dh,0Ah, "$" mali: db ". Sorry but you're wrong, try again" , 0Dh,0Ah, "$" invalid: db ". What! there is no such thing as choicen, try again" , 0Dh,0Ah, "$" tapos: db ". Nice! Nice you've completed it!" , 0Dh,0Ah, "$" instruct: mov dx, offset instruction mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... ; GAME 1 START game1: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q1 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'b' ; compare input to 'b', if yes, jmp to cans1 je cans1 cmp al, 'a' ; compare input to 'a', if yes, jmp to xans1 je xans1 cmp al, 'c' ; compare input to 'c', if yes, jmp to xans1 je xans1 mov dx,invalid ;else, print invalid mov ah,9 int 21h jmp game1 ; then jmp to game1 cans1: mov dx, tama mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game2 xans1: mov dx, mali mov ah, 9 int 21h jmp game1 mov ah, 00 ;clearscreen mov al,02 int 10h ; GAME 2 START game2: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q2 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'b' je cans2 cmp al, 'a' je xans2 cmp al, 'c' je xans2 mov dx,invalid mov ah,9 int 21h mov ah, 00 ;clearscreen mov al,02 int 10h jmp game2 cans2: mov dx, tama mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game3 xans2: mov dx, mali mov ah, 9 int 21h jmp game2 ; GAME 3 START game3: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q3 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'c' je cans3 cmp al, 'b' je xans3 cmp al, 'a' je xans3 mov dx,invalid mov ah,9 int 21h jmp game3 cans3: mov dx, tama mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game4 xans3: mov dx, mali mov ah, 9 int 21h jmp game3 ; GAME 4 START game4: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q4 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'c' je cans4 cmp al, 'a' je xans4 cmp al, 'b' je xans4 mov dx,invalid mov ah,9 int 21h jmp game4 cans4: mov dx, tama mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game5 xans4: mov dx, mali mov ah, 9 int 21h jmp game4 ; GAME 5 START game5: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q5 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'c' je cans5 cmp al, 'a' je xans5 cmp al, 'b' je xans5 mov dx,invalid mov ah,9 int 21h jmp game5 cans5: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game6 xans5: mov dx, mali mov ah, 9 int 21h jmp game5 ; GAME 6 START game6: mov ah,00 mov al,02 int 10h mov dx, offset q6 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'b' je cans6 cmp al, 'a' je xans6 mov dx,invalid mov ah,9 int 21h jmp game6 cans6: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game7 xans6: mov dx, mali mov ah, 9 int 21h jmp game6 ; GAME 7 START game7: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q7 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'b' je cans7 cmp al, 'a' je xans7 mov dx,invalid mov ah,9 int 21h jmp game7 cans7: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game8 xans7: mov dx, mali mov ah, 9 int 21h jmp game7 ; GAME 8 START game8: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q8 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'a' je cans8 cmp al, 'b' je xans8 mov dx,invalid mov ah,9 int 21h jmp game9 cans8: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game9 xans8: mov dx, mali mov ah, 9 int 21h jmp game8 ; GAME 9 START game9: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q9 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'b' je cans9 cmp al, 'a' je xans9 mov dx,invalid mov ah,9 int 21h jmp game10 cans9: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game10 xans9: mov dx, mali mov ah, 9 int 21h jmp game9 ; GAME 8 START game10: mov dx, offset blank mov ah, 9 int 21h mov dx, offset q10 mov ah, 9 int 21h mov ah, 1 int 21h cmp al, 'a' je cans10 cmp al, 'b' je xans10 mov dx,invalid mov ah,9 int 21h jmp stop cans10: mov dx, tapos mov ah, 9 int 21h mov ah, 0 int 16h ; wait for any key.... jmp game10 xans10: mov dx, mali mov ah, 9 int 21h jmp game10 stop: ret
Write, Run & Share Assembly code online using OneCompiler's Assembly online compiler for free. It's one of the robust, feature-rich online compilers for Assembly language. Getting started with the OneCompiler's Assembly compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Assembly
and start coding.
Assembly language(asm) is a low-level programming language, where the language instructions will be more similar to machine code instructions.
Every assembler may have it's own assembly language designed for a specific computers or an operating system.
Assembly language requires less execution time and memory. It is more helful for direct hardware manipulation, real-time critical applications. It is used in device drivers, low-level embedded systems etc.
Assembly language usually consists of three sections,
Data section
To initialize variables and constants, buffer size these values doesn't change at runtime.
bss section
To declare variables
text section
_start
specifies the starting of this section where the actually code is written.
There are various define directives to allocate space for variables for both initialized and uninitialized data.
variable-name define-directive initial-value
Define Directive | Description | Allocated Space |
---|---|---|
DB | Define Byte | 1 byte |
DW | Define Word | 2 bytes |
DD | Define Doubleword | 4 bytes |
DQ | Define Quadword | 8 bytes |
DT | Define Ten Bytes | 10 bytes |
Define Directive | Description |
---|---|
RESB | Reserve a Byte |
RESW | Reserve a Word |
RESD | Reserve a Doubleword |
RESQ | Reserve a Quadword |
REST | Reserve a Ten Bytes |
Constants can be defined using
CONSTANT_NAME EQU regular-exp or value
%assign constant_name value
%define constant_name value
Loops are used to iterate a set of statements for a specific number of times.
mov ECX,n
L1:
;<loop body>
loop L1
where n specifies the no of times loops should iterate.
Procedure is a sub-routine which contains set of statements. Usually procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
procedure_name:
;procedure body
ret