;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local Procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; NEAR MyProc ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Local Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; DB ByteVar ; DW wordvar ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NAME error ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; error.asm ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Description: Demonstrates some common errors. ; CGROUP GROUP CODE DGROUP GROUP DATA, STACK ; chage 'CODE' (in the beginning of the line) to something else to see a ; plethora of errors CODE SEGMENT PUBLIC 'CODE' ASSUME CS: CGROUP, DS: DGROUP, SS: DGROUP main: CLI ; ensure interrupts are disabled MOV AX, DGROUP MOV SS, AX MOV SP, OFFSET(DGROUP:TopOfStack) MOV AX, DGROUP MOV DS, AX CALL MyProc ; call your procedure forever: JMP forever ; a procedure MyProc PROC NEAR PUSH AX ; push registers you will change PUSH BX ; uncommenting the below line will result in ; ERROR #2 OPERANDS DO NOT MATCH THIS INSTRUCTION ; because we are attempting to load a word register with a byte variable ;MOV AX, ByteVar ; uncommenting the below line will result in ; ERROR #4 INSUFFICIENT TYPE INFORMATION TO DETERMINE CORRECT INSTRUCTION ; because the assembler doesn't know if BX points to a byte or a word ;MOV [BX], 0 POP BX ; pop the registers in the reverse order that POP AX ; they were pushed RET ; don't forget to return! MyProc ENDP imul BX, wordvar, 10 CODE ENDS DATA SEGMENT PUBLIC 'DATA' wordvar DW ? ByteVar DB ? DATA ENDS STACK SEGMENT PUBLIC 'STACK' DW 0100H DUP (?) ;256 words TopOfStack LABEL WORD STACK ENDS ; commenting out 'main' below causes ; WARNING 66: START ADDRESS NOT SPECIFIED IN OUTPUT MODULE END main