What's your question? We can't help you if you don't explain your situation.

Edited 3 Years Ago by Assembly Guy

my teacher wants a project with TASM, he ask us to code five qeustions with 3 choices(sorry bout that).

here is what i had code
i had made one question but I can't do another question
please help me

.model small
.stack 100h
.data

msga    db 10,13,"What is my middle name? ",10,13,"a. P b. N c. G$"
ans db 10,13,"Answer:$"
cor db " Correct$"
wrng db " Wrong$"

.code
main PROC

mov ax,@data
mov ds,ax

    mov ah, 9h
    mov dx, offset msga
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'b'
    JE CORRECT
QA:    
    mov ah, 9h
    mov bl, 12
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'b'
    JNE QA

CORRECT:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h        

    mov ax, 4c00h
    int 21h

endp

END

Well to make it do another question, you would just use the same process you used to check the first question, except printing a different question. So instead of using msga, you might write another, such as msgb and print that to the screen instead.

okay this is what i had done,

.model small
.stack 100h
.data

msg1    db "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||$"
msg2    db "|||||||||||||||||||||||||||||||Answer All The Questions!||||||||||||||||||||||||||||$"
msg3    db "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||$"
msga    db 10,13,"1. What is my middle name? " ,10,13,"a. P b. N c. G$"
msgb    db 10,13,"2. What is my name? ",10,13, "a. ryan b. dexter c. giane$"
msgc    db 10,13,"3. Who are you? ",10,13, "a. robot b. spammer c. human$"
msgd    db 10,13,"4. What is your home room? ",10,13, "a. 102 b. 104 c. 201$"
msge    db 10,13,"5. who is your adviser? ",10,13, "a. Mr. Licayan b. Mr. Liwag c. Mr. Badon$"
msgf    db 10,13,"Thank You for Answering!!!!!!!!!!$"

ans db 10,13,"Answer:$"
cor db " Correct$"
wrng db " Wrong$"
.code
main PROC

mov ax,@data
mov ds,ax

    mov ah, 9h
    mov bl, 5
    mov cx, 240
    int 10h
    mov dx, offset msg1
    int 21h
    mov dx, offset msg2
    int 21h
    mov dx, offset msg3
    int 21h

    mov ah, 9h
    mov dx, offset msga
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'b'
    JE CORRECTA
QA:    
    mov ah, 9h
    mov bl, 4
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'b'
    JNE QA

CORRECTA:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h        


    mov ah, 9h
    mov dx, offset msgb
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'a'
    JE CORRECTB
QB:    
    mov ah, 9h
    mov bl, 4
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'a'
    JNE QB

CORRECTB:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h 


    mov ah, 9h
    mov dx, offset msgc
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'c'
    JE CORRECTC
QC:    
    mov ah, 9h
    mov bl, 4
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'c'
    JNE QC

CORRECTC:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h        


    mov ah, 9h
    mov dx, offset msgd
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'b'
    JE CORRECTD
QD:    
    mov ah, 9h
    mov bl, 4
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'b'
    JNE QD

CORRECTD:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h        


    mov ah, 9h
    mov dx, offset msge
    int 21h

    mov ah,9h
    mov dx, offset ans
    int 21h

    mov ah, 1h
    int 21h
    CMP al,'a'
    JE CORRECTE
QE:    
    mov ah, 9h
    mov bl, 4
    mov cx, 6
    mov dx, offset wrng
    int 10h
    int 21h
    mov ah, 9h
    mov dx, offset ans
    int 21h
    mov ah,1h
    int 21h
    CMP al,'a'
    JNE QE

CORRECTE:
    mov ah, 9h
    mov bl, 1
    mov cx, 8
    mov dx, offset cor
    int 10h
    int 21h        

    mov ah, 9h
    mov dx, offset msgf
    int 21h

    mov ax, 4c00h
    int 21h
endp

END

Nice. Does it work? You could probably write a function to print a question, get an answer and say correct or incorrect. You would just have to pass the question and correct answer as pointers.

This question has already been answered. Start a new discussion instead.