[英]8086 Assembly errors
I have written this program in 8086 assembly and I can getting some errors that I do not understand. 我已经用8086汇编语言编写了该程序,但遇到一些我不理解的错误。 Namely on line 26 and 27 I am getting the error "Illegal Immediate" and on lines 31,37,38,43,44 I am getting the error "Cannot convert to pointer".
即在第26和27行上,我得到错误“非法立即”,在第31、37、38、43、44行上,我得到错误“无法转换为指针”。 I am new to this programming language, but I thought these lines were valid.
我是这种编程语言的新手,但我认为这些行是有效的。 Can anyone shed some light on what I may be doing incorrectly?
谁能告诉我我可能做错了什么? Thanks a lot.
非常感谢。
title files in title ;program name ;------------------------------------------------------------------------------------- stacksg segment para stack 'Stack' ;define the stack db 32 dup (0) ;32 bytes, might want to set larger stacksg endS ;------------------------------------------------------------------------------------- datasg segment para 'Data' ;data segment first db 0 second db 1 loopit dw 12 datasg ends ;------------------------------------------------------------------------------------- codesg segment para 'Code' ;code segment main proc far ;main procedure assume ss:stacksg, ds:datasg, cs:codesg ;define segment registers MOV AL, first ;moves 0 into AL MOV AH, second ;moves 1 into AH MOV CX, loopit ; sets limit to 12 (parity flag) MOV [200],AL ;moves 0 into memory location 200 MOV [201],AH ;moves 1 into memory location 201 MOV BL,202 ;moves 200 into BL ADD AH, AL ;adds 0 and 1, AH is still 1 MOV [BL],AH ;moves 1 into memory location 202 INC BL ;increments BL, BL is now 203 MOV CL,201 ;moves 201 into CL MOV CH, 202 ;moves 202 into CH ADD AH,[CL] ;adds 1 and 1, AH is now 2 MOV [BL], AH ;moves 2 into memory location 203 (indirectly via BL) INC BL ;increments BL, BL is now 204 loopSection: INC CL ;increments CL ADD AH,[CL] ;adds what is in memory location CL to AH MOV [BL], AH ;moves what is in BH into memory location (indirectly via BL) INC BL ;increments BL DEC CX ; decrements cx by 1 jnz loopSection main endp ;end of procedure codesg ends end main
Instruction Prefix 0 oder 1 Byte
Segment Prefix 0 oder 1 Byte
Opcode 1 oder 2 Byte
-> Mod R/M 0 oder 1 Byte
Displacement 0, 1, 2 Byte
Immediate 0, 1, 2 Byte
-> Mod R/M-Byte = MM RRR MMM
MM - Memeory addressing mode
RRR - Register operand address
MMM - Memoy operand address
RRR Register Names
Filds 8bit 16bit
000 AL AX
001 CL CX
010 DL DX
011 Bl BX
100 AH SP
101 CH BP
110 DH SI
111 BH DI
MMM Default MM Field
Field Sreg 00 01 10 11=MMM is reg
000 DS [BX+SI] [BX+SI+o8] [BX+SI+o16]
001 DS [BX+DI] [BX+DI+o8] [BX+DI+o16]
010 SS [BP+SI] [BP+SI+o8] [BP+SI+o16]
011 SS [BP+DI] [BP+DI+o8] [BP+DI+o16]
100 DS [SI] [SI+o8] [SI+o16]
101 DS [DI] [DI+o8] [SI+o16]
110 SS [o16] [BP+o8] [BP+o16]
111 DS [BX] [BX+o8] [BX+o16]
Note: MMM=110,MM=0 Default Sreg is DS !!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.