无效有效地址计算

编程入门 行业动态 更新时间:2024-10-24 09:19:57
本文介绍了无效有效地址计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

请看看下面的程序,错误是无效的有效地址计算,我已经提到,行,请告诉我,为什么它的无效有效地址计算这里是节目结果

[组织的0x100]JMP启动数组1:DW 10,15,20,25,30,35,40,45,50,55数组2:DW 15,10,20,35,40,30,55,50,25,45启动:MOV BX,0    MOV CX,0循环:MOV AX,[数组2 + BX]        CMP AX,[数组1 + CX] //这里是错误无效的有效地址计算        JNE NextElementOfArray1NextElementOfArray2:加BX,2                        CMP BX,20            JE结束                        MOV CX,0            JMP环NextElementOfArray1:加CX,2                        CMP CX,20            JE NextElementOfArray2            JMP环结束:MOV AX,0x4c00    INT为0x21

解决方案

启动:MOV BX,0        MOV DX,0; < - 你的意思是MOV CX,0?循环:MOV AX,[数组2 + BX]        CMP AX,[数组1 + CX]

编辑:如果我没有记错, CX 寄存器不能用作指数

表2-1。 16位寻址与MODR / M字节形式

有效地址模r MODR / M字节的/ M值(十六进制)[BX + SI][BX + DI][BP + SI][BP + DI][SI][二][BX][BX + SI] + disp8[BX + DI] + disp8[BP + SI] + disp8[BP + DI] + disp8[SI] + disp8[二] + disp8[BP] + disp8[BX] + disp8[BX + SI] + disp16[BX + DI] + disp16[BP + SI] + disp16[BP + DI] + disp16[SI] + disp16[二] + disp16[BP] + disp16[BX] + disp16

Please look at the following program, the error is invalid effective address calculation and i have mentioned that line please tell me why its invalid effective address calculation here is the program

[org 0x100] jmp start array1: dw 10,15,20,25,30,35,40,45,50,55 array2: dw 15,10,20,35,40,30,55,50,25,45 start: mov bx,0 mov cx,0 loop: mov ax,[array2+bx] cmp ax,[array1+cx]//here is the error invalid effective address calculation jne NextElementOfArray1 NextElementOfArray2: add bx,2 cmp bx,20 je end mov cx,0 jmp loop NextElementOfArray1: add cx,2 cmp cx,20 je NextElementOfArray2 jmp loop end: mov ax,0x4c00 int 0x21

解决方案

start: mov bx,0 mov dx,0 ; <-- did you mean "mov cx, 0" ? loop: mov ax,[array2+bx] cmp ax,[array1+cx]

Edit: If I recall correctly, cx register can not be used as an index.

Table 2-1. 16-Bit Addressing Forms with the ModR/M Byte

Effective Address Mod R/M Value of ModR/M Byte (in Hexadecimal) [BX+SI] [BX+DI] [BP+SI] [BP+DI] [SI] [DI] [BX] [BX+SI]+disp8 [BX+DI]+disp8 [BP+SI]+disp8 [BP+DI]+disp8 [SI]+disp8 [DI]+disp8 [BP]+disp8 [BX]+disp8 [BX+SI]+disp16 [BX+DI]+disp16 [BP+SI]+disp16 [BP+DI]+disp16 [SI]+disp16 [DI]+disp16 [BP]+disp16 [BX]+disp16

更多推荐

无效有效地址计算

本文发布于:2023-08-07 10:29:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318629.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!