Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Off-topic

???
05/31/04 02:13
Read: times


 
#71487 - RE: use of macros in assembly
Responding to: ???'s previous message
mahnoor shamsi,
Macros,probably invariably,always represents a shortcut
method to write procedures or programms;be it assembly
language or any other.I give you an example in Word
where you can record a macro.That means after pressing
the start record button- whatever the user(you) do with
Word or the Word Document,the keyboard and mouse
activities,will be recorded and naturally, scripted.Like
you can play back the recorded activities,you can get
hold of the programm/procedures/scripts Word is using
to record the activities and use it,repeat it as many
times as you want.I used this in Visual Basic to convert
an Intel Hex file to a file containing only hex data.
That was required for my monitor to download the hex
file in SRAM and/or EEPROM.
In ASM51 the advantage of macro will be appreciated here:
The difference between subroutines and macros will be
clear from the list file that although macros are
shortcuts in writing codes they do not give any space
advantage i.e. every time we call a macro the whole lot
of codes representing the macro will be assembled
automatically whereas codes of subroutines are never
repeated, rather they are used all the times reading
from the same location.
(By the way I am sure you have Version 1.2h by Metalink).
$MOD52
$SYMBOLS
$NODEBUG
$PAGING
$PAGEWIDTH(100)
;Variable Declarations
BSEG AT 20H
DATCOM BIT 8Fh
DSEG AT 30H
;
;

UP_BTTN BIT P3.0
DN_BTTN BIT P3.1
BOOT EQU 0000H
;
; ***MACRO'S***
PRT_ASC MACRO
ACALL Byt2Asc
setb datcom ;send data
ACALL send_char
ENDM
;Interrupt Vector Table
CSEG
ORG BOOT ; power on/reset vector
JMP DECIDE
RETI ; external interrupt 0 vector undefined
DB 00H,00H,00H,00H,00H,00H,00H
RETI ; timer 0 overflow vector undefined
DB 00H,00H,00H,00H,00H,00H,00H
RETI ; external interrupt 1 vector undefined
DB 00H,00H,00H,00H,00H,00H,00H
RETI ;timer 1 overflow vector undefined
DB 00H,00H,00H,00H,00H,00H,00H
RETI ; serial I/O interrupt vector undefined
DB 00H,00H,00H,00H

setup: DB 033h,032h,028h,00eh
DB 002h,001h,00CH,0ffh
DECIDE: JNB UP_BTTN,GO_UP
;
;
GO_UP:
clr datcom ;send commands
mov dptr, #setup ;lcd setup string
CALL send_string
FRSHW: mov a,#80h
clr datcom ;send command
CALL send_char
MOV A,WH_L
PRT_ASC
MOV A,#20H
CALL send_char
MOV A,WM_H
PRT_ASC
MOV A,WM_L
PRT_ASC
MOV A,#20H
CALL send_char
MOV A,WS_H
PRT_ASC
MOV A,WS_L
PRT_ASC
;
;
send_char:
Push acc
push dpl
push dph
mov c,datcom
mov rs,c
clr en
mov c,acc.4
mov db4,c
mov c,acc.5
mov db5,c
mov c,acc.6
mov db6,c
mov c,acc.7
mov db7,c
setb en
clr en
;
;
ret

;
;
END



Best Regards
A.S.Rudra

List of 7 messages in thread
TopicAuthorDate
use of macros in assembly            01/01/70 00:00      
   RE: use of macros in assembly            01/01/70 00:00      
      RE: use of macros in assembly            01/01/70 00:00      
         Vendor? Version?            01/01/70 00:00      
            RE: Vendor? Version?            01/01/70 00:00      
         RE: use of macros in assembly            01/01/70 00:00      
   Waqar Zaka yet again            01/01/70 00:00      

Back to Subject List