Presentation is loading. Please wait.

Presentation is loading. Please wait.

Physics 413 Chapter 8 IBM PC Assemblers An assembler is a program that takes your assembly language program and converts the instructions into op-codes.

Similar presentations


Presentation on theme: "Physics 413 Chapter 8 IBM PC Assemblers An assembler is a program that takes your assembly language program and converts the instructions into op-codes."— Presentation transcript:

1

2 Physics 413 Chapter 8

3 IBM PC Assemblers An assembler is a program that takes your assembly language program and converts the instructions into op-codes that the microprocessor can understand. The other job of the assembler is to calculate the number of steps that the processor may have to jump forward or backward if it encounters a transfer of control instruction like JNE or CALL. These two tasks are very tedious for a human and are best relegated to the assembler.

4 DEBUG & MASM The first one is a no-frills assembler called DEBUG. It is easier for the beginner to use and comes free with DOS for your IBM PC. The other is expensive and comes with too many bells and whistles. It is called MASM DOS utility exe2 bin converts.exe to.com DEBUG cannot create.EXE (executable) files DEBUG is cheaper and easier to learn to use for the beginner.

5 DEBUG Type debug at the DOS prompt (C:>). All you will see is _ QExit from Debug RDisplays the processor registers R AXDisplays AX AAssemble. A 100 starts at CS:0100 DDump (display or list) 128 bytes of memory E 100Enter data. Space bar for next byte! F 100 120 AB Fill 0100 through 0120 with AB G = 100Execute program starting 0100 P = 100 Single-step. Treats LOOP as a step T = 100Single-step. Not good for subroutine U = 100Unassemble displays mnemonics

6 Assembler Directives db is a directive that tells the assembler to store the byte-size numbers db 2A 69 C4 5E will store these 4 bytes of data db “ hello ” will store ASCII codes of h, e, l, l, o equ assigns a value to a name stuff equ 7

7 What does MOV AL, TRICK do? Depends! The answer depends on how TRICK was defined. If your program had a statement TRICK EQU 6D then the number 6D will be copied into AL If TRICK was defined as TRICK DB 2BH, 57H, 8EH then AL = 2B

8 MASM Program.model small.stack.code mov cx, 7h mov si, offset mygoody mov al, 0 again:add al, [si] inc si dec cx jne again.exit.data mygoody db 57h, a3h, 26h, 4bh, 69h, e5h, 7ch end

9 What does MOV DX, offset TRICK do? offset is another directive If TRICK was defined as TRICK DB 2BH, 57H, 8EH then DX = logical address of 2B If your program had a statement TRICK EQU 6D then error

10 What does MOV DS, seg TRICK do? seg is another directive If TRICK was defined as TRICK DB 2BH, 57H, 8EH then DS = segment of 2B If your program had a statement TRICK EQU 6D then error


Download ppt "Physics 413 Chapter 8 IBM PC Assemblers An assembler is a program that takes your assembly language program and converts the instructions into op-codes."

Similar presentations


Ads by Google