Tuesday, August 30, 2011

Simple Project in Assembly Language - Menu


This was supposed to be my project in assembly language. (The truth is, I have never tried to master assembly language programming and I have already forgotten how the code below works. LOL! But I'm going to share it anyway.)

I thought I did not have a copy of this but I found a copy on my previous blog.

They called this "Menu"

The code below is just part of the program. Download the whole program here or here
This should be assembled using the A86 Assembler by  Eric Isaacson.


Enjoy!

start:
    ;set video mode
                mov     AH, 00h     ; I want to set the video mode...
                mov     AL, 03h     ; ...to 80x25x16
                int     10h         ; Call video interrupt

    call clear_screen

    ;--------------------------display choices
    mov ah, 09
    lea dx, box1
    int 21h
    

    mov ah, 09
    lea dx, choice
    int 21h
    

    call crlf

    mov ah, 09
    lea dx, choice1
    int 21h

    call crlf
    
    mov ah, 09
    lea dx, choice2
    int 21h

    call crlf   

    mov ah, 09
    lea dx, choice3
    int 21h

    call crlf 
    
    mov ah, 09
    lea dx, choice4
    int 21h
    
    call crlf 
    
    mov ah, 09
    lea dx, choice5
    int 21h
    
    call crlf 
    
    mov ah, 09
    lea dx, choice6
    int 21h

    call crlf 
    
    mov ah, 09
    lea dx, choice7
    int 21h

    call crlf

    mov ah, 09
    lea dx, box2
    int 21h
    

    call crlf

    ;-----------------prompt user of letters a-f or z
    call crlf
    call crlf 
    
    mov ah, 09
    lea dx, prompt
    int 21h

    ;---------------get input character
    mov ah, 01
    int 21h

    ;----compare input character with... and execute chosen subprogram
    cmp al, '1'
    je one
    cmp al, '2'
    je two
    cmp al, '3'
    je three
    cmp al, '4'
    je four    
    cmp al, '5'
    je five    
    cmp al, '6'
    je six
    cmp al, '0'
    je endendend
    
    ;-------------------no match
    mov ah, 09
    lea dx, no_match
    int 21h

    call crlf
    call crlf
    jmp next

     jmp start
one:
    call crlf 
    call crlf 
    call display_biodata_with_border   
    jmp next
two:
    call crlf 
    call crlf 
    call reverse_string
    jmp next
three:
    call crlf 
    call crlf
    call password
    jmp next
four:
    call crlf 
    call crlf
    call horizontal
    call crlf 
    call crlf    
    call crlf 
    call crlf
    call crlf 
    call crlf
    call crlf 
    call crlf

    jmp next
five:
    call crlf 
    call crlf
    call quadrant
    jmp next    
six:
    call crlf 
    call crlf
    call addition
    jmp next
endendend:
    jmp ending

;-------------------press any key to continue
next:
    mov ah, 09
    lea dx, Press_anyKey
    int 21h
    
    mov ah, 01
    int 21h
      
      cmp al, '0'
      je endendend

    
    call crlf 
    call crlf
    call crlf 

    ;set video mode
                mov     AH, 00h     ; I want to set the video mode...
                mov     AL, 03h     ; ...to 80x25x16
                int     10h         ; Call video interrupt

    call clear_screen
    
    jmp start

ending:
    mov ah, 09
    lea dx, closing
    int 21h

    ret

No comments:

Post a Comment