访问程序集x86中的数组索引

时间:2016-11-22 00:06:11

标签: assembly x86 masm

所以我在汇编语言x86中遇到问题,我必须提示用户输入0-6的数字,并打印一周中的某一天,(0 =星期日,1 =星期一..等。我在这里得到这个问题到目前为止我的代码。

.model small
    .data
    message db "Please enter a number between 0 and 6$"
      sunday    db "Sunday$"
      monday    db "Monday$"
      tuesday   db "Tuesday$"
      wednesday db "Wednesday$"
      thursday  db "Thursday$"
      friday    db "Friday$"
      saturday  db "Saturday$"


  days  dd OFFSET sunday,  OFFSET monday, OFFSET tuesday, OFFSET wednesday, OFFSET thursday, OFFSET friday, OFFSET saturday

    .code
    main proc
    mov ax,@data
    mov ds, ax
    mov si, 0
    mov cx, 7
    L1: 
        mov ah,9
        mov dx,OFFSET message
        int 21h

        mov ah,1
        int 21h



        mov ah,2h
        mov dl, [days + si] 
        sub dl, 30h     
        int 21h 

        inc [si] 

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

        loop L1



        mov ax, 4c00h
        int 21h
        int 20h


    main endp
    end

0 个答案:

没有答案