6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 10:30 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: WDC Tools gotcha's
PostPosted: Sat Feb 24, 2024 9:10 am 
Offline

Joined: Tue Jan 09, 2024 6:48 am
Posts: 3
Many people seem to dislike to WDC Tools suite.
Saying it is old (no dispute there). Saying it is clunky (probably depends on what you are used to).
Saying it has many bugs/quirks. As long as, you are aware of them and can work around them, I call them "gotcha's".

As a beginning .asm and C programmer, with around 4 months of overall experience solely with WDC Tools (and none with CA65 or similar). I combined it with Notepad++ instead of TIDE. These are the gotcha's I have found/encountered so far.

1) Assembler (wdc02as/wdc816as)
- No spaces allowed around '+' in an equate: "STAT EQU BASE + 1" will have "STAT EQU BASE". Needs to be "STAT EQU BASE+1".
- Do not use the "REPT cnt" directive combination to auto-repeat cnt times an assembly statement. Assembler will crash. Need to manually replace/insert.

2) C Compiler (wdc02cc/wdc816cc)
- Some common datatypes are not standard included (e.g. uint8_t, uint16_t, uchar, ushort, ulong, etc.). Need to be user-defined.
- There is no prefix for binary values (e.g. in bitmasks etc). Must use HEX, octal or decimal.

3) Linker (wdcln)
Did not find anything so far.

4) Debugger (wdcdb)
- Needs to be run as Administrator
- Requires -hz (and -sz??) options during linking for the debugger to load/execute your code properly.

Are you aware of items you can add to the above list? Hopefully including workarounds or solutions.

PS : I am updating the above list as people respond, saving you reading the entire thread. Thank you for those who contribute.


Last edited by DMartens on Sat Feb 24, 2024 10:40 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: WDC Tools gotcha's
PostPosted: Sat Feb 24, 2024 10:16 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 745
Location: Germany
another thing for the C compiler, it doesn't support binary notation. it doesn't even tell you that anywhere, not in the documentation, an error message, or error number.
it just kinda prints out the first line with binary from the source file on it and then quietly crashes (and yes the compiler does actually appear to crash instead of exiting because the return code is "-1073741819" instead of "0", "1", etc.)
it took me so god damn long to figure out why i wasn't able to compile by mandelbrot program. well turns out it had some binary masks in it!

the reason why it doesn't have binary notation is because it technically isn't part of the C standard ("0b" is a GNU GCC extention that a lot of other compilers have adopted) so WDC didn't include the functionality, which IMO is a very strange decision considering that the Compilers are for CPUs that very often deal with individual bits and masks...


Top
 Profile  
Reply with quote  
 Post subject: Re: WDC Tools gotcha's
PostPosted: Sat Feb 24, 2024 2:21 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1398
Location: Scotland
DMartens wrote:
2) C Compiler (wdc02cc/wdc816cc)
- Some common datatypes are not standard included (e.g. uint8_t, uint16_t, uchar, ushort, ulong, etc.). Need to be user-defined.
- There is no prefix for binary values (e.g. in bitmasks etc). Must use HEX, octal or decimal.


C doesn't define uint8_t and so on. It's not part of the language standard.

Also note that the WDC C compiler is relatively old - it may well be ANSI C, but is it C89, C99, ... ?

C99 introduced the concept of a <stdint.h> file to define these types for you - some older C compilers also had it too but it may well have been very implementation dependant.

So - all you need to do is copy this file from another implementation that can use it, adapt as needs and use it.

And again binary prefix isn't a standard part of C ...

See here for an interesting way to do it:

https://www.thecodingforums.com/threads ... -c.318127/

So while I'll probably never use the WDC C compiler (because it doesn't run natively under Linux and cc65 is good enough for me) in this case I suspect it's not really at fault...

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: