[英]8086 Assembly errors
我已經用8086匯編語言編寫了該程序,但遇到一些我不理解的錯誤。 即在第26和27行上,我得到錯誤“非法立即”,在第31、37、38、43、44行上,我得到錯誤“無法轉換為指針”。 我是這種編程語言的新手,但我認為這些行是有效的。 誰能告訴我我可能做錯了什么? 非常感謝。
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.