Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hex numbers in asm blocks
#1
Sorry to be creating so many posts the last couple of days. Smile

Should this work?
Code:
asm
defb ffh
end asm

I read a post elsewhere which suggested that that was the correct syntax to use for hex numbers in an asm block, but I get this:
Code:
test.bas:1: Error: Undefined label 'ffh'

If I switch the 'ffh' for a '255' then all is fine. 1.4.0-s1885, as before. Thanks!
Reply
#2
have you tried defb $ff ?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#3
I hadn't, no - and that seems to work fine. I'm obviously basing my tests on outdated info. Smile

Many thanks!
Reply
#4
LTee Wrote:I hadn't, no - and that seems to work fine. I'm obviously basing my tests on outdated info. Smile

Many thanks!
The FFh is all letter, and the compiler/assembler think its an identifier.
If you want to ensure it knows it's a hex number, prefix it with 0. So FFh should be 0FFh.
This is common to all assemblers. Any hex number starting with a letter and ending with 'h' must be prefixed with 0. Thus:

A3h => Error (it's an 'identifier'). Use 0A3h
2Bh => Ok (Already starts with a number).

Using the $ prefix is always ok and avoids this problem. Smile
Reply
#5
Gotcha! That makes perfect sense.

Thanks, guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)