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

Back to Subject List

Thread Closed: Off-topic

???
05/08/04 16:25
Read: times


 
#70022 - RE: what these terms do in coding
Responding to: ???'s previous message
DW <expr1> [,<expr2> [,<expr3> ... ]]
define words The DW instruction reserves and initializes a number of words with the values defined by the arguments. Every argument may be an arbitrary expression and requires two bytes of space. DW is only allowed in the CODE segment!
Example: DW 0,0C800H,1999,4711

DS <expr>
define space Reserves a number of uninitialized bytes in the current segment. The value of <expr> must be known on pass 1! DS is allowed in every segment, except in the BIT segment!
Example: DS 200H


DBIT <expr>
define bits Reserves a number of uninitialized bits. The value of <expr> must be known on pass 1! DBIT is only allowed in the BIT segment!
Example: DBIT 16

CSEG [AT <expr>] switch to CODE segment [at address]
DSEG [AT <expr>] switch to DATA segment [at address]
ISEG [AT <expr>] switch to IDATA segment [at address]
BSEG [AT <expr>] switch to BIT segment [at address]
XSEG [AT <expr>] switch to XDATA segment [at address]
These instructions switch to one of the five 8051 address spaces. If a segment base address is specified with "AT <expr>", a new absolute segment is started, and the location counter is set to <expr>. If "AT <expr>" is omitted, the location counter keeps the previous value of the particular segment.The value of <expr> must be known on pass 1! At program start, the default segment is CODE and the base addresses and location counters of all segments are set to zero. Examples: DSEG ;switch to previous DATA segment
CSEG AT 8000h ;start a new CODE segment at address 8000H
XSEG at 0 ;start a new XDATA segment at address 0

<symbol> EQU <expr> define numeric constant
<symbol> EQU <reg> define invariant register
<symbol> SET <expr> define numeric variable
<symbol> SET <reg> define variable register
The EQU instruction defines a symbol for a numeric constant or a register. If a numeric expression <expr> is assigned to the symbol, It will be of the type NUMBER. If a register <reg> is assigned to the symbol, it will be of the type REGISTER. <reg> may be one of the special assembler symbols A, R0, R1, R2, R3, R3, R4, R5, R6, or R7. A symbol once defined with EQU can never be changed!The SET instruction is working quite similar to EQU. However, symbols defined with SET can be redefined with subsequent SET instructions!The values of <expr> and <reg> must be known on pass 1!
A symbol that has been SET, cannot be redefined with EQU! A symbol that has been EQU'd cannot be reSET! On pass 2, forward references to a SET symbol always evaluate to the last value, the symbol has been SET to on pass 1. Register symbols can be used as instruction operands within the whole program instead of the corresponding registers. Forward references to register symbols are not allowed!

Examples: MAXMONTH EQU 12
OCTOBER EQU MAXMONTH-2
COUNTREG EQU R5

CHAPTER SET 1
CHAPTER SET CHAPTER+1
CHAPTER SET A

I think that makes the things clear Read the documentation that came with your assembler before posting questions onto the public forums.

Regards,
Prahlad J. Purohit



List of 13 messages in thread
TopicAuthorDate
what these terms do in coding            01/01/70 00:00      
   RE: what these terms do in coding            01/01/70 00:00      
      RE: what these terms do in coding            01/01/70 00:00      
         RE: what these terms do in coding            01/01/70 00:00      
      RE: what these terms do in coding            01/01/70 00:00      
   RE: what these terms do in coding            01/01/70 00:00      
   RE: what these terms do in coding            01/01/70 00:00      
      RE: what these terms do in coding            01/01/70 00:00      
   RE: what these terms do in coding            01/01/70 00:00      
      Some questions about the code            01/01/70 00:00      
         RE: Some questions about the code            01/01/70 00:00      
      Some questions about the code            01/01/70 00:00      
   Some more questions about the Main Loop            01/01/70 00:00      

Back to Subject List