我正在编写一个C程序,它调用一个程序集函数,传递一个数组作为参数。在汇编代码(用于8086)中,我能够在内存中获得数组的地址,并将地址保存在ES:BX中,但在此之后,我需要将值复制到数组BARCODE中,但我找不到实现该地址的任何方法。
我的代码如下所示:
代码:
unsigned char computeControlDigit(char* barCodeASCII);
int main( void ){
char barCodeStr[14]
unsigned char controlDigitCheck;
controlDigitCheck = computeControlDigit(barCodeStr);
}Assemby代码:
_DATA SEGMENT WORD PUBLIC 'DATA'
BARCODE DB 13 DUP(?)
_DATA ENDS
PUBLIC _computeControlDigit
_computeControlDigit PROC FAR
PUSH BP
MOV BP, SP
PUSH ES
LES BX, [BP+6]
; code to copy from memory to
; array and code of operations on the array
POP ES
POP BP
RET
_computeControlDigit ENDP
_TEXT ENDS
END任何帮助都是非常受欢迎的。
发布于 2019-03-27 21:42:35
您可以使用
mov al,es:[bx]要从字符串中读取字符,但由于这是一个大型模型,您需要创建一个指向条形码的远指针。您可能需要考虑使用ds:si作为输入,使用es:di作为输出,因为这将允许代码存放和stosb。
https://stackoverflow.com/questions/55386623
复制相似问题