4

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.

5
  • 3
    What's your target platform? Something like 64tasm or cc65 might be a better choice.
    – fadden
    Commented Nov 6, 2018 at 21:36
  • 2
    That's an idea. I'm writing for the c64. And you just reminded me that cc65 comes with an assembler. Commented Nov 6, 2018 at 22:05
  • 2
    I can certainly endorse ca65. It's pretty powerful for a 6502 cross assembler. It also comes with a nice disassembler.
    – JeremyP
    Commented Nov 19, 2018 at 15:51
  • 1
    @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? Commented Nov 19, 2018 at 16:13
  • 2
    That sounds like its given you an object file that still needs to be linked. Does the result have a .o extension?
    – JeremyP
    Commented Nov 20, 2018 at 14:03

2 Answers 2

7

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

>label needs to become (label >> 8)

while

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

(The last can, AFAIK, be omitted - but keeping it makes it way more readable).

1
  • 3
    "lets say frugal" - I love understatement :-)
    – user6464
    Commented Nov 7, 2018 at 0:43
4

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .