ES M3 Ktunotes - in
ES M3 Ktunotes - in
ES M3 Ktunotes - in
Syllabus: Design and Development of Embedded Product – Firmware Design and Development –
The assembly program contains a main routine which start at address 0000H and
it may or may not contain subroutines.
In main program subroutine is invoked by the assembly instruction LCALL
DELAY
Executing this instruction transfers the program flow to the memory
address referenced by the ‗LABEL‘ DELAY
While assembling the code a ‗;‘ inform the assembler that the rest of the
part coming in a line after the ‗;‘ symbol is comments and simply ignore it
Each assemblyinstruction should be written in a separate line
More than one ASM code lines are not allowed in a single line.
In the previous example LABEL DELAY represent the reference to the start of
the subroutine
DELAY: MOV R0, #255 ; load Register R0 with 255
DJNZ R0, DELAY ; Decrement R0and loop till R0=0
RET ; return to callingprogram
We can directly replace the LABEL by putting desired address first and then
writing assembly code for the routine
ORG 0100H
MOV R0, #255 ; load Register R0 with 255
DJNZ R0, DELAY ; Decrement R0and loop till R0=0
RET ; return to callingprogram
ORG 0100H is not an assembly language instruction; it is an assembler directive
instruction. It tells the assembler that the instruction from here onwards should
be placed at location starting from 0100H
• The program written in any of the high level language is saved with the corresponding
language extension
• Any text editor provided by IDE tool supporting the high level language in use can be
used for writing the program
• Some cross compilers avail for the high level languages may not be so efficient in
generating optimized target processor specific instructions
• Target images created by such compilers may be messy and no optimized in terms of
performance as well as code size