EmbeddedRelated.com
Forums

Send data to PC (C#) via DB9 Serial?

Started by subs...@styx66.net September 26, 2007
--- In 6..., "Jeff Smith" wrote:
> ;;; write the character 'a'
> movb #$61,$cf

I figured out two lines to add to the C source for as12, though Eric
is too busy right now so it's hard to get an idea of whether the
change would hurt normal use of the syntaxt by other developers.

Normally, this is the as12 syntaxt:
movb #'a,$cf
which is of course terrible for people having it burned into them to
always use balanced quotation marks. That should be every programmer.

I found I could add these two lines
if (*Optr == '\'') /* skip closing ' if any
Optr++;

in "eval.c", in this code block:
else if (*Optr == '\'') { /* character literal */
Optr++;
if (*Optr == NULL) {
if (Pass == 2)
warn("Missing character, value of 0 assumed");
val = 0;
} else
val = *Optr++;
if (*Optr == '\'') /* skip closing ' if any
Optr++;
}

Then character constants work in a reasonable way. It causes as11/as12
to skip the closing quote but only if it is present. Any comments?

Now this line works as expected:
movb #'a',$cf