64tass assembler peculiarity

Building your first 6502-based project? We'll help you get started here.
Vladimir
Posts: 78
Joined: 20 Jul 2016
Location: Irkutsk, Russia

64tass assembler peculiarity

Post by Vladimir »

Hi.
I tried to assemble EhBASIC with 64tass assembler.
The source was taken on the https://github.com/Klaus2m5/6502_EhBASI ... /basic.asm
BTW, I am very novice user of 64tass (or, I'm trying to become a user).
As it usually happens, I got a bunch of errors, basically in .BYTE directives, because, in accordance with the manual, 64tass does not expects here any multi character strings.
Well, I can use .TEXT instead which accepts strings of any length. But, I was surprised that not every multi character string causes an error. For example,
line 8230 .byte "XP(",TK_EXP ; EXP( gives an error, but
line 8212 .byte "EEK(",TK_DEEK ; DEEK( causes no error.
I can not understand why this is so. Does anyone know this?
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 64tass assembler peculiarity

Post by BigDumbDinosaur »

Vladimir wrote:
Hi.
I tried to assemble EhBASIC with 64tass assembler.
The source was taken on the https://github.com/Klaus2m5/6502_EhBASI ... /basic.asm
BTW, I am very novice user of 64tass (or, I'm trying to become a user).
As it usually happens, I got a bunch of errors, basically in .BYTE directives, because, in accordance with the manual, 64tass does not expects here any multi character strings.
Well, I can use .TEXT instead which accepts strings of any length. But, I was surprised that not every multi character string causes an error. For example,
line 8230 .byte "XP(",TK_EXP ; EXP( gives an error, but
line 8212 .byte "EEK(",TK_DEEK ; DEEK( causes no error.
I can not understand why this is so. Does anyone know this?
Could you please be more explicit than "gives an error?" What is the exact diagnostic being emitted by the assembler?
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Vladimir
Posts: 78
Joined: 20 Jul 2016
Location: Irkutsk, Russia

Re: 64tass assembler peculiarity

Post by Vladimir »

BigDumbDinosaur wrote:
What is the exact diagnostic being emitted by the assembler?
8230:8 error: can't convert to a 8 bit unsigned integer '"XP("'
.byte "XP(",TK_XP ; EXP(
8236:8 error: can't convert to a 8 bit unsigned integer '"OR"'
.byte "OR",TK_FOR ; FOR
8238.....
8242.....
8244.....
and so on...

This error is clear to me. Another is unclear, some similar lines do not make errors, for example:

8218 .byte "OKE",TK_DOKE ; DOKE note - "DOKE" must come before "DO"
8224 .byte "LSE",TK_ELSE ; ELSE
8226 .byte "ND",TK_END ; END
.........
.........
Why? What is the difference?
Klaus2m5
Posts: 442
Joined: 28 Jul 2012
Location: Wiesbaden, Germany

Re: 64tass assembler peculiarity

Post by Klaus2m5 »

Every assembler has its own disease. It would be interesting, if the working .byte directives produce correct object code. On the other hand if the documentation says that something isn't working it doesn't guarantee that it is not working all of the time.
6502 sources on GitHub: https://github.com/Klaus2m5
whartung
Posts: 1004
Joined: 13 Dec 2003

Re: 64tass assembler peculiarity

Post by whartung »

Vladimir wrote:
BigDumbDinosaur wrote:
What is the exact diagnostic being emitted by the assembler?
8230:8 error: can't convert to a 8 bit unsigned integer '"XP("'
.byte "XP(",TK_XP ; EXP(
8236:8 error: can't convert to a 8 bit unsigned integer '"OR"'
.byte "OR",TK_FOR ; FOR
8238.....
8242.....
8244.....
and so on...

This error is clear to me. Another is unclear, some similar lines do not make errors, for example:

8218 .byte "OKE",TK_DOKE ; DOKE note - "DOKE" must come before "DO"
8224 .byte "LSE",TK_ELSE ; ELSE
8226 .byte "ND",TK_END ; END
.........
.........
Why? What is the difference?
For whatever reason, it's ignoring your " marks. When it sees X, it's thinking that you're presenting a HEX number, and P( is not a valid HEX string. Similarly, with OR, it sees the O and probably thinks that it's an Octal number, and R is not a valid octal digit.

Mind, this is all a guess. I've not used the software.
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: 64tass assembler peculiarity

Post by GaBuZoMeu »

If I understand the ehbasic source correctly, there .byte "ABCD" is used to reserve/allocate 4 bytes of memory.
64tass ref manual allows .byte <expression>{,<expression} to reserve multiple bytes in one line.
But "string" is not a valid expression me thinks.

You can verify this: how many bytes in those lines where 64tass does not report an error are reserved? (compare the PC values) - I assume it increments by one for the string and by one for the token.
User avatar
jim30109
Posts: 45
Joined: 31 Mar 2017

Re: 64tass assembler peculiarity

Post by jim30109 »

I've been working with 64tass a lot lately. I've had to replace most .byte directives in sample codes with .text directives.

It is actually pretty powerful once you get used to it because of some variation.

.null "text" will compile to the byte values followed by a $0 (null), so you don't have to use .text "text",0

.ptext "text" puts a character count in front, so you don't have to use .text 4,"text"

64tass has its quirks, but is the one I eventually gravitated to because it is straight forward to build a ROM image with.

Thanks,
Jim W4JBM
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 64tass assembler peculiarity

Post by BigDumbDinosaur »

TASS is yet another example of an assembler written by someone who evidently didn't know that, at least in the 6502 universe, a standard does exist for the assembly language.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Dan Moos
Posts: 277
Joined: 11 Mar 2017
Location: Lynden, WA

Re: 64tass assembler peculiarity

Post by Dan Moos »

BDD, what assembler would you recommend that best adhered to the standard. I still haven't settled on an assembler yet.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 64tass assembler peculiarity

Post by GARTHWILSON »

That would be good information to add to the "assemblers" portion of my links page, at http://wilsonminesco.com/links.html#assem .
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Dan Moos
Posts: 277
Joined: 11 Mar 2017
Location: Lynden, WA

Re: 64tass assembler peculiarity

Post by Dan Moos »

Quote:
That would be good information to add to the "assemblers" portion of my links page, at http://wilsonminesco.com/links.html#assem .
Agree whole heartedly. As a newbie, that list was a good start, but I needed more guidance! I'm trying to settle on an assembler to stick with for a spell, and want to be sure I'm learning the standard way of doing things, not some almost right assembler's quirks. I'm sure after a while I can re-evaluate and find that a quirky one will be what I want, but untill then...
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: 64tass assembler peculiarity

Post by barrym95838 »

BigDumbDinosaur wrote:
TASS is yet another example of an assembler written by someone who evidently didn't know that, at least in the 6502 universe, a standard does exist for the assembly language.
... or maybe he or she knew, but decided to follow a more unique path, for any reason under the Sun. You must be aware that variety is the spice of life, BDD!

Mike B.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 64tass assembler peculiarity

Post by GARTHWILSON »

Dan, does it need to be free, or would you be willing to pay for a good one? I'm not sure paying is necessary to get a good one that has rather standard operation, but at least it's not like Windows which you kind or 'rent.' I bought Cross-32 (C32 for short) from Universal Cross Assemblers over 20 years ago; and although as an intensive user I find bugs in everything, I have not been sorry. It's still $99, even though that's quite a bit less money now than it was back then, and it assembles for lots of different processors, and gives you the tools to make the tables for new processors too, meaning you could design your own processor and have a nice macro assembler for it. I've used it for 65c02 and 65816, and have enjoyed freedoms it gives that many others apparently don't, if I am to believe what I see in others' code written for free assemblers.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Dan Moos
Posts: 277
Joined: 11 Mar 2017
Location: Lynden, WA

Re: 64tass assembler peculiarity

Post by Dan Moos »

I'd be willing to pay once I am far enough along to make an experience informed decision. $99 is a bit steep for me, because I really don't know what I want/need.

What I THINK I want/need is an assembler who's syntax (other than the mnemonics, which I hope are exactly the same in every 6502 assembler) is as standard as one could hope for. As I learn, I'm discovering that maybe there isn't a hard standard, so I'm lightening up my expectations there. I want a tool I can learn with, and hopefully keep using as I get more proficient.

ACME has worked well for my simple fledgling needs, and maybe it fills the bill for my admittedly poorly informed desires.
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 64tass assembler peculiarity

Post by BigDumbDinosaur »

Dan Moos wrote:
BDD, what assembler would you recommend that best adhered to the standard. I still haven't settled on an assembler yet.
Two assemblers I recommend are André Fachat's xa65 cross-assembler (documentation right here) and Andrew Jacobs' Java-powered cross-assembler. Both assemblers support the MOS Technology assembly language syntax standard and generate code for NMOS 6502s, 65C02 and 65C816. They are free for the downloading.

André's assembler is very comprehensive and runs on 64 bit Linux (I've tested it on one of my Linux machines). I don't know if the source can be compiled on a Windows box but I do know André originally developed it on an Atari ST (MC68000 system) and was able to compile the source code as written on Linux.

Andrew's assembler should be able to run on any machine that has the Java run-time installed. He was able to assemble my Supermon 816 program on it, which means it fully understands the 65C816 in native mode.

Use your favorite text editor with either assembler (I use UltraEdit, which while not free as in free beer, is tailor-made for software development).
Quote:
As I learn, I'm discovering that maybe there isn't a hard standard...
The definitive form of the 6502 assembly language is that published by MOS Technology c. 1975. The WDC standard is the MOS Technology standard with additions to cover the 65C816/65C802, primarily in the areas of immediate mode addressing. So there really is a standard for the assembly language itself.

The one place where the standard does not apply is pseudo-operations (assembler directives), such as .byte or .word. Assembler developers are free to conjure whatever pseudo-ops they wish. However, most good assemblers use pseudo-ops that are or resemble those published by MOS Technology.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply