1 / 7

Practical exercises 5JJ20/2M200: Introduction to the assembler

Practical exercises 5JJ20/2M200: Introduction to the assembler. Dr.ir. Ad Verschueren. Texteditor: wordpad /. Program: XYZ.ASM. Assembler: asm504. Simulator: dScope. Debugger: tScope. Listing: XYZ.LST. Executable: XYZ.HEX. Programmer: Flash tools. Programs and files. With error messages.

fergal
Download Presentation

Practical exercises 5JJ20/2M200: Introduction to the assembler

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. Practical exercises 5JJ20/2M200:Introduction to the assembler Dr.ir. Ad Verschueren

  2. Texteditor:wordpad/... Program:XYZ.ASM Assembler:asm504 Simulator:dScope Debugger:tScope Listing:XYZ.LST Executable:XYZ.HEX Programmer:Flash tools Programs and files With error messages

  3. The assembler • Translate readable instructions to machine code • One processor instruction on one text line • Keep track of addresses with ‘location counter’ • Updated with number of bytes in each instruction • ‘Labels’ assign names to address at start of text line • ‘Pseudo-instructions’ for assembler itself • Reserve memory space, place constants in memory • Assign readable names to constant values • Listing control, conditional assembly, ……...

  4. Tab Translating normal instructions • Use standard instruction names and formats • Label names for JUMP/CALL and direct addresses • Do not forget ‘#’ for constant values • May use calculations for addresses or constants MOV A,#23 + 2 ;load A with constantLoop: DEC A ;A <= A - 1 JNZ Loop ;IF A not 0, GOTO Loop Label Parameter(s) Instruction name Comments after ;

  5. Addressing with the location counter • Keeps track of instruction/data placement • Assembler keeps only one location counter! • Updated by instruction/constant/storage space size • Forced to specific value with ‘ORG’ (ORiGin) • Shown in listing Data memory XXXX0030003100000003 ORG 0030h ;set location to 48Data: DS 1 ;Define Storage, 1 byte ORG 0000h ;set location to 0Strt: MOV Data,#23 ;’Data’ <= 23 SJMP Strt ;keep doing this Program memory

  6. Assembler pseudo-instructions • See assembler documentation! • TITLE, TABS, WIDTH etc. to get nice listing • EQU (EQUals) to name a constant value • DB/DW Define Byte/Word constants (program memory) • END to signal ‘end of text’, is NOT ‘end of program’ TABS 6 ;’Wordpad’ standardLucky EQU 111b ;define named constant MOV A,#Lucky ;register A <= 7 DB ‘Luck’,0 ;define FIVE bytes END ;assembler stops here

  7. The first session’s assignments • Perform ‘getting started’ part of manual • Installation and test of all programs needed here • Setting up connection to practicumprocessor board • Using a given example program • Do NOT use ‘Flash tools’ • Example ‘program’ in assignments document • Demonstrates common assembler ‘constructs’ • Read, discuss and (try to) understand...

More Related