SX Assembler Directives
1 / 62
Term:
Definition:
Show example sentence
Show hint
Keyboard Shortcuts
  • Previous
  • Next
  • F Flip card

Complete list of Terms and Definitions for SX Assembler Directives

Terms Definitions
How do you set a port to be input or output? mov !rportname, #constantA 1 in binary represents an input; 0 an outputex: mov !rb, #%11111111; set all of port b to input
How do you access a port's directional register? !rportnameex: !rbNote: each bit in the 8-bit port register represents the respective i/o pin on that port
What must you do to keep the watchdog from resetting the SX unexpectedly? Clear the watchdog periodically within it's time valueex: clr !wdt; clears watchdog timer
ds reserve bytes for a variableex: var1 ds 2var1 is now two bytes long(put an org statement beforehand to use specific registers)
What's wrong with this?var1 ds 2mov w,var2 Only the first byte of var1 is stored into w; use var1+1 to access the second byte of var1 (note: w is a one byte accumulator)
setb Set Bitsets one bit in a registerex: setb
What is compatability mode? A directive in the device preprocessor statement; slows everything down so that the SX can run code written for other microcontrollers
MODE register a
FSR (File Select Register) a
equ= equateex: var1 equ 8var1 points to register 8ex: var1 equ $8var1 holds the hex value $8
clr clearclears a byte, or a bit of a byteex: clr rb; sets rb to 0
add pc,w skip w steps
clc clear carry bit of status register
and and's var2 with var1 (or w), and stores it into var1 (or w). var2 can be replaced by a constantuasge: and w,var2
jnz jump if zero flag is 0 (cleared)ex: jnz testwill jump to label test only if the z flag is 0
jmp $+3 jump 3 instructions ahead
jb jump if bit is setex: jb rb.0,testwill jump to label test when bit 0 of rb is 1
IREAD a
What's the difference between equ and = ? when equ is used, the value of var1 cannot be changedwhen = is used, the value of var1 can be changed
: local label
registers $00-$07 special
mov w,--8 8-1==w8==8
register W accumulator
! directional register
STATUS register a
stc set carry bit of status register
var.0 first bit of var
How do you multiply a register by 2? shift the bits left 1
or or's var2 with var1 (or w), and stores it into var1 (or w). var2 can be replaced by a constantuasge: or w,var2
What are local labels? labels within labelsex: label1 :label2; label2 is only visible within label1
What happens when you reset the SX while it's running? All ports change back to inputs
stz set zero bit of status register
xor xor's var2 with var1 (or w), and stores it into var1 (or w). var2 can be replaced by a constantuasge: xor w,var2
What are the watchdog prescaler values? a
what's confusing about org? Can refer to either data space or program space
djnz decrements a register by 1 and stores the result back into the register, and if it's zero, jumps to the specified label
jmp jumpused to jump to labels or different memory adressesex: jmp start; jumps to label start
mov with anything other than w w gets destroyed
rl rotate bits left (bit 7 shifts to carry flag, carry flag shifts to bit 0)
jnb jump if bit is 0 (cleared)ex: jnb rb.0,testwill jump to label test if bit 0 of rb is 0
rr rotate bits right (bit 0 shifts to carry flag, carry flag shifts to bit 7)
dec 8 8-1==8
jc jump if carry flag is setex: jc testwill jump to label test if the carry flag is set; else the program will continue as normal
add Adds two registers together and stores them in the formerex: add w,#3; w=w+3
How do you change logic levels of a port? mov rportname, #constantA 1 in binary represents high; 0 lowex: mov rb, #00000000; set all of port b to logic level 0 (low)
nop No Operation Performed
registers $08-$1F general purpose
inc incrementincrements a register by 1ex: inc w; w+1
# constant
clz clear zero bit of status register
What is the size of a word instruction? 12 bits
mov var1-w var1=var1-w
PC (Program Counter) a
What's wrong with this?mov var2,var1mov var3,var1 Since there's no instruction to move one variable into another, var1 is moved into w, and then into the destination variable. Here, var1 is loaded into w twice, which is wasteful
What can't clr be used with? clearing a port directional registerex: clr !rb; this won't work!
test tests for equality between two registersex: test var1,var2basically it does var2-var1 and checks if the zero flag is set
How to you increment/decrement a register without modifying it? You use mov w,++register or mov w,--registerex: mov w,++reg; w=reg+1 reg==regmov w,--reg; w=reg-1 reg==reg
What is the size of a data word? 8 bits
jnc jump if carry flag is 0ex: jnc test
How do you divide a register by 2? shift the bits right 1
jz jump if zero flag is setex: jz testwill jump to label test if the zero flag is set; else the program will continue as normal
ijnz increments a register by 1 and stores the result back into the register, and if it's zero, jumps to the specified label