Download presentation
Presentation is loading. Please wait.
Published byOpal Henry Modified over 9 years ago
1
1/1/ /e/e eindhoven university of technology Practical exercises 5JJ20/2M200: Introduction to the assembler Dr.ir. Ad Verschueren
2
1/1/ /e/e eindhoven university of technology Programs and files Texteditor: wordpad/... Program: XYZ.ASM Assembler: asm504 Listing: XYZ.LS T Executabl e: XYZ.HEX Simulator: dScope Debugger: tScope Programmer: Flash tools With error messages
3
1/1/ /e/e eindhoven university of technology 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
1/1/ /e/e eindhoven university of technology 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 MOVA,#23 + 2;load A with constant Loop:DECA;A <= A - 1 JNZLoop;IF A not 0, GOTO Loop Parameter(s ) Instruction name Comments after ; Label TabTab
5
1/1/ /e/e eindhoven university of technology XXXX 0030 0031 0000 0003 XXXX 0030 0031 0000 0003 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 ORG0030h;set location to 48 Data:DS1;Define Storage, 1 byte ORG0000h;set location to 0 Strt:MOVData,#23;’Data’ <= 23 SJMPStrt;keep doing this Data memory Program memory
6
1/1/ /e/e eindhoven university of technology 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’ TABS6;’Wordpad’ standard LuckyEQU111b;define named constant MOVA,#Lucky;register A <= 7 DB‘Luck’,0;define FIVE bytes END;assembler stops here
7
1/1/ /e/e eindhoven university of technology 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...
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.