I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian.

My project contains a lot of lines like

ldx #<pname
ldy #>pname

where pname is a label where a string may be found. How is that done in crasm? I couldn't find any such thing as < and > in the man page.

  • 2
    What's your target platform? Something like 64tasm or cc65 might be a better choice. – fadden Nov 6 '18 at 21:36
  • 1
    That's an idea. I'm writing for the c64. And you just reminded me that cc65 comes with an assembler. – OmarL Nov 6 '18 at 22:05
  • 1
    I can certainly endorse ca65. It's pretty powerful for a 6502 cross assembler. It also comes with a nice disassembler. – JeremyP Nov 19 '18 at 15:51
  • @JeremyP, when I tried ca65 I got a load of extraneous fluff in my binary, including what looked like symbol tables and other linker's business. Do you know what I'm doing wrong there? – OmarL Nov 19 '18 at 16:13
  • 1
    That sounds like its given you an object file that still needs to be linked. Does the result have a .o extension? – JeremyP Nov 20 '18 at 14:03

CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So

>label needs to become (label >> 8)


<label is to be changed to (label & $FF)

(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)

  • 2
    "lets say frugal" - I love understatement :-) – user6464 Nov 7 '18 at 0:43

It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:

High byte:

ldx #pname>>8

Low byte:

ldx #pname&255

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.