How to express hi/lo byte of a label in crasm
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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.
assembly 6502
add a comment |Â
up vote
1
down vote
favorite
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.
assembly 6502
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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.
assembly 6502
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.
assembly 6502
assembly 6502
asked 2 hours ago
Wilson
9,703544118
9,703544118
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
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)
while
<label
is to be changed to (label & $FF)
(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)
add a comment |Â
up vote
2
down vote
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
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
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)
while
<label
is to be changed to (label & $FF)
(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)
add a comment |Â
up vote
2
down vote
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)
while
<label
is to be changed to (label & $FF)
(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)
add a comment |Â
up vote
2
down vote
up vote
2
down vote
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)
while
<label
is to be changed to (label & $FF)
(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)
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)
while
<label
is to be changed to (label & $FF)
(the last can, AFAIK, be obmitted - but keeping it makes it way more readable)
answered 1 hour ago
Raffzahn
40.8k594168
40.8k594168
add a comment |Â
add a comment |Â
up vote
2
down vote
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
add a comment |Â
up vote
2
down vote
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
add a comment |Â
up vote
2
down vote
up vote
2
down vote
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
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
answered 1 hour ago
George Phillips
3,4631421
3,4631421
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8197%2fhow-to-express-hi-lo-byte-of-a-label-in-crasm%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password