SirCmpwn

Untitled

Apr 29th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. ; Problem: Assembling short literals
  2.  
  3. .align 0x1D
  4. SET A, label1
  5. label1: ; If the prior instruction is long, this is 0x1F. Otherwise, it's 0x1E.
  6.  
  7. ; Obviously the right option is to make this label 0x1E. But how to make an assembler understand this?
  8. ; Possible Solution:
  9. ; During assembly, assume all literals are short literals where applicable, and save expressions. Do not evaluate expressions until pass two.
  10. ; Pass two should evaluate all expressions. If -1 <= result <= 0x1E, then it can be shortened. Iterate through the label list and subtract one from
  11. ; every label whose address is greater than $ and use the short literal in the final output.
Advertisement
Add Comment
Please, Sign In to add comment