FAQ  •  Register  •  Login

hex numbers in asm blocks

<<

LTee

Posts: 153

Joined: Tue Jul 07, 2009 2:54 pm

Post Wed Jul 23, 2014 7:31 pm

hex numbers in asm blocks

Sorry to be creating so many posts the last couple of days. :)

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!
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Wed Jul 23, 2014 7:54 pm

Re: hex numbers in asm blocks

have you tried defb $ff ?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

LTee

Posts: 153

Joined: Tue Jul 07, 2009 2:54 pm

Post Wed Jul 23, 2014 8:13 pm

Re: hex numbers in asm blocks

I hadn't, no - and that seems to work fine. I'm obviously basing my tests on outdated info. :)

Many thanks!
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Thu Jul 24, 2014 11:47 am

Re: hex numbers in asm blocks

LTee wrote:I hadn't, no - and that seems to work fine. I'm obviously basing my tests on outdated info. :)

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. :)
<<

LTee

Posts: 153

Joined: Tue Jul 07, 2009 2:54 pm

Post Thu Jul 24, 2014 4:42 pm

Re: hex numbers in asm blocks

Gotcha! That makes perfect sense.

Thanks, guys!

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO