1 / 9

Physics 413 Chapter 8

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 that the microprocessor can understand.

Download Presentation

Physics 413 Chapter 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Physics 413Chapter 8

  2. IBM PC Assemblers • An assembleris 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.

  3. 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 ischeaper and easier to learn to use for the beginner.

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

  5. 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

  6. 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

  7. 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

  8. What does MOV DX, offset TRICK do? • offsetis 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

  9. What does MOV DS, seg TRICK do? • segis 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

More Related