永发信息网

查表程序 汇编语言

答案:2  悬赏:50  手机版
解决时间 2021-01-23 09:59
  • 提问者网友:杀生予夺
  • 2021-01-22 21:07
查表程序 汇编语言
最佳答案
  • 五星知识达人网友:傲气稳了全场
  • 2021-01-22 21:40
;在数据区,以table 开始连续存放0-9的立方值,
;设任给一数x x在tab1单元,查表求x的立方值 并把结果存到tab2 要求输入的数及最后结果要显示在屏幕上
assume cs:code, ds:data
data segment
    table dw 0, 1, 8, 27, 64, 125, 216, 343, 512, 729;
    display db 0AH, 0DH, "Please input a number(0~9): ", "$"
    tab1 db 5
             db ?
             db 5 dup (0)
    tab2 dw ?
    dis db 3 dup ("0"), "$"
    crlf db 0AH, 0Dh, "$"
data ends
code segment
    start:
                    mov ax, data
                    mov ds, ax
                                                        
                    mov dx, offset display
                    mov ah, 9
                    int 21h
                                                        
                    mov dx, offset tab1
                    mov ah,10
                    int 21h
                                                        
                    mov al, tab1+2
                    sub al, 30h
                                                                        
                    add al, al
                    sub bx, bx
                    mov bl, al
                    mov ax, table[bx]
                    mov tab2, ax
                                                        
                    mov bl, 2
                    mov cl, 10
    lp:         div cl
                    add ah,30H
                    mov byte ptr dis[bx], ah
                    dec bl
                    sub ah,ah
                    cmp al, 0
                    jne lp
                    mov dx, offset crlf
                    mov ah, 9
                    int 21h
                                                                            
                    mov ah, 9
                    mov dx, offset dis
                    int 21h
                                                        
    exit:       mov ax, 4c00h
                    int 21h
code ends
end start


PS:若有不明白的地方,可以追问

全部回答
  • 1楼网友:思契十里
  • 2021-01-22 21:46
MOVC A,@A+DPTR
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯