6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 6:55 am

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 2:33 am 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
When programming the 6502 I use Make to invoke the Ophis assembler and run unit tests in the Py65Mon. That allows for a fast development cycle before I go to real hardware. Now that I have working 65816 hardware, I'd like a similar development environment.

Can anyone recommend a 65816 assembler for Windows?

Can anyone recommend a 65816 emulator for Windowssimilar to Py65Mon?

Thanks in advance.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 3:29 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
See my list of assemblers on my links page, at http://wilsonminesco.com/links.html#assem . Most of them are free. I really like the Cross-32 that I use. It's not free, but I think it was well worth the $99. It provides the files for assembling for lots of different processors, and they give you the information to even adapt it to a processor of your own design. I also prefer the way it handles 8- and 16-bit immediate operands compared to how other assemblers do it. Whatever you choose, make sure it has a strong macro capability.

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 3:55 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
Daryl Rictor added '816 functionality to the Kowalski simulator here, and is actively maintaining it.

[edit: oops, I know it assembles '816 source code, but '816 simulation may not be implemented yet.]

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 6:51 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
Martin_H wrote:
Can anyone recommend a 65816 assembler for Windows?

I use the Kowalski assembler to do my 65C816 work. However, it presently cannot simulate a 65C816. As far as I know, there is currently no 65C816 “emulator.” If you have working 65C816 hardware you have emulation capability, so why not test on that? That's what I do.

For those occasions where some of my bone-headed programming makes a mess, there's a “panic” button—regains control most of the time with an NMI. If the panic button doesn't regain control, there is the reset button. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 9:09 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Martin_H wrote:
Can anyone recommend a 65816 emulator for Windowssimilar to Py65Mon?


Perhaps see this thread (lib65816/run65816 and KEGS both get a mention)
65816 emulator available?


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 2:52 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
personally i've just been using WDC's Tools for both Compiling C and Assembling.
the Assembler is a bit picky when it comes to Syntax, can't use XOR instead of EOR, can't place instructions at the start of a line, can't use 0x or 0b prefixes. but besides that it's pretty good.
it works on Windows, it's free, and decently documented.
only annoying part is that you have to register on WDC's site in order to download it
for an IDE I'm using NP++ and set up the F9 key to run a batch file in the directory of the file i'm looking at which then Compiles or Assembles said file.
That allows me to have multiple different programs from different target systems (65C02, 65C816, 68k, RISCV, etc) open at the same time without needing a different IDE or Compile/Assemble key for each of them.
I just need a different batch file with the same name for each.

as for an Emulator, i don't really know of any either.
but i know that AndrewP has made a 65816 library for Logisim (a Logic Simulator), so in theory you could ask him to get a download and rebuild your system in Logisim (i did the same for my 65C02 SBC), though it would be much more work it would also be a lot more customizable.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 3:57 pm 
Offline

Joined: Mon Feb 15, 2021 2:11 am
Posts: 100
I haven't investigated it deeply, but I recall there is a 65C816 simulator that is used for development and testing of the 65C816 port of the FUZIX OS. It is based upon lib65816. The URL is https://github.com/EtchedPixels/v65c816.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 5:02 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Nice find Sean:
Quote:
Virtual 65C816
This is a simple emulator designed to help bring up Fuzix on the 65C816 processor. The I/O interface matches that of the v65 virtual platform.
The 65C816 emulator itself is taken from lib65816.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 5:44 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
Thanks for all the responses. I will take a look and see what works for me.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 6:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
Proxy wrote:
personally i've just been using WDC's Tools for both Compiling C and Assembling. the Assembler is a bit picky when it comes to Syntax, can't use XOR instead of EOR...

I'm not at all dismayed that WDC's 65C816 assembler doesn't recognize mnemonics that aren't part of WDC's published instruction set. :shock: The Kowalski assembler in 65C816 mode has the identical behavior and with a few minor exceptions, is 100-percent compliant to the MOS Technology assembly language standard as extended by WDC.

If you want to use alternate mnemonics, e.g., XOR as a substitute for EOR, you can write a macro. Incidentally, EOR for “exclusive OR” complies with a now-moribund IEEE standard for assembly language mnemonics that was promulgated in the 1970s. It makes sense to me, as the word “exclusive” starts with the letter E, not X.

Quote:
...can't place instructions at the start of a line...

That's actually common behavior in assemblers. The first field is taken to be a label or symbol if it starts at the left margin. I've known of that behavior since I started writing 6502 code (in the latter 1970s), so it's no big deal. Plus a 6800 cross-asembler I used was exactly the same. BTW, the Kowalski editor can be configured to auto-indent lines of code, thus accommodating the requirement that mnemonics and macro invocations not be at the left margin.

In any case, placing mnemonics at the beginning of the line tends to make for hard-to-read listing files. Unless you place labels on a line all by themselves, some lines will have a label as the first field and others will have a mnemonic or macro as a first field. That, in my opinion, makes for difficult reading. I religiously maintain alignment of mnemonics and comments so I can quickly read the listing while debugging. Furthermore, I stick to eight-character labels (or smaller—there are historical reasons for that) and always place mnemonics and macros in column 10. Everything comes out nicely aligned, and the labels stand out in the listing. For example:

Code:
03986  ;===============================================================================
03987  ;
03988  ;stmset: SET SEQUENTIAL TIME
03989  ;
03990  ;   ———————————————————————————————————————————————————————————————————————
03991  ;   Synopsis: This service sets the system date & time, referred to as
03992  ;             “sequential time,” from a source in user space.  Unless set
03993  ;             by calling this service, sequential time will start at zero
03994  ;             when the system is booted.
03995  ;
03996  ;             Sequential time is a count of the number of seconds that have
03997  ;             elapsed since a point in time in the past that is referred to
03998  ;             as the “epoch.”  The system does not define the epoch —— that
03999  ;             is left to a programmer writing date & time library functions
04000  ;             that refer to sequential time.
04001  ;
04002  ;             The user space source from which the date & time is to be set
04003  ;             should contain a 48-bit, little-endian, unsigned integer of
04004  ;             size S_TIME_T that has been generated from a known time
04005  ;             source, such as the RTC.  No range-checking is performed on
04006  ;             the supplied value.  The function that converts broken-down
04007  ;             time to sequential time is responsible for range checking.
04008  ;             It is possible to set sequential time to a value that cannot
04009  ;             be converted back to broken-down (human-readable) time.
04010  ;   ———————————————————————————————————————————————————————————————————————
04011  ;   Invocation example: rep #%00010000         ;16-bit index registers
04012  ;                       ldx !#bstbuf & $ffff   ;user space address LSW
04013  ;                       ldy !#bstbuf >> 16     ;user space address MSW
04014  ;                       cop #ktodset
04015  ;
04016  ;   Exit registers: .A: entry value
04017  ;                   .B: entry value
04018  ;                   .X: entry value
04019  ;                   .Y: entry value
04020  ;                   DB: entry value
04021  ;                   DP: entry value
04022  ;                   PB: entry value
04023  ;                   SR: NVmxDIZC
04024  ;                       ||||||||
04025  ;                       |||||||+———> 0
04026  ;                       +++++++————> entry value
04027  ;   ———————————————————————————————————————————————————————————————————————
04028  ;
04029  00D4E9  A9 40         stmset   lda #m_todctl         ;halt sequential...
04030  00D4EB  04 14                  tsb tudflag           ;time updates
04031  00D4ED  C2 20                  rep #m_seta           ;16-bit accumulator
04032  00D4EF  3B                     tsc                   ;make API stack frame...
04033  00D4F0  5B                     tcd                   ;local direct page
04034  00D4F1  A2 04                  ldx #s_time_t-s_word  ;working index
04035  00D4F3  9B                     txy
04036  ;
04037  00D4F4  B7 08         .main    lda [api_ptr],y       ;sequential time source
04038  00D4F6  99 16 01               sta systodsr,y        ;copy to shadow
04039     .rept s_word
04040  00D4F9  88                     dey
04041  00D4FA  88                     dey
04042  00D4FB  10 F7                  bpl .main
04043  ;
04044  00D4FD  A9 00 00               lda !#kerneldp        ;re-select kernel's...
04045  00D500  5B                     tcd                   ;direct page
04046  ;
04047  00D501  BD 16 01      .main010 lda systodsr,x        ;copy shadow to...
04048  00D504  95 04                  sta systod,x          ;sequential time
04049     .rept s_word
04050  00D506  CA                     dex
04051  00D507  CA                     dex
04052  00D508  10 F7                  bpl .main010
04053  ;
04054  00D50A  E2 20                  sep #m_seta
04055  00D50C  64 14                  stz tudflag           ;start timekeeping
04056  00D50E  18                     clc
04057  00D50F  60                     rts

Quote:
...can't use 0x or 0b prefixes...

That's because such notation has never been used in 6502 assembly language. 6502 assembly language, which has MC6800 assembly language as its ancestor, uses $ to represent a hex radix, and % to represent binary—the same notation is also used in MC68000 assembly language.

From my perspective, use of $ and % makes more sense, especially since only one character is needed to denote a hex value, instead of two. Also, speaking as someone who has scratch-written a full-featured 65C816 M/L monitor, parsing with a leading non-alphanumeric radix is much easier than parsing two leading alphanumeric characters (0x) to determine which number base to use. Use of a trailing b for binary is even more annoying—you have to read the entire number before learning that it is binary, not decimal. Whomever thought of that should have been taken out back and shot. :twisted:

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Thu Jan 06, 2022 8:23 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
BigDumbDinosaur wrote:
It makes sense to me, as the word “exclusive” starts with the letter E, not X.

well Overflow starts with an "O" but the flag is still called "V". (probably because an O looks too much like a 0)
using "X" makes sense to me because "Ex" is pronounced the same as "X" so it's the first letter that you actually pronounce in "exclusive", as you say Ex-OR instead of just E-OR.
BigDumbDinosaur wrote:
That's actually common behavior in assemblers. The first field is taken to be a label or symbol if it starts at the left margin. I've known of that behavior since I started writing 6502 code (in the latter 1970s), so it's no big deal. Plus a 6800 cross-asembler I used was exactly the same.

Interesting, i thought only really old assemblers did that because it made programming the assembler easier as you just have to check if something is an instruction if it has atleast 1 white space character infront of it.
BigDumbDinosaur wrote:
Unless you place labels on a line all by themselves, some lines will have a label as the first field and others will have a mnemonic or macro as a first field. That, in my opinion, makes for difficult reading. I religiously maintain alignment of mnemonics and comments so I can quickly read the listing while debugging.

while having all the Labels, instructions, and operands on the same column does look really amazing and clean, i couldn't read it for the life of me because of how much i rely on indenting to fiqure out where things like loops start and end.
in my programming style i exclusively put labels on otherwise empty lines (except for comments)
and normally i indent after a label, and indent back at some relavant control flow instruction (like a branch, or return)
Code:
FUNCTION:
    LDX #0
    LOOP:
        STA $1234,X
        INX
    BNE LOOP
RTS

that's also how i end up with instructions on the very start of the line, i pretty much treat the label like an opening bracket in C, while the control flow instruction is the closing bracket.
BigDumbDinosaur wrote:
That's because such notation has never been used in 6502 assembly language. 6502 assembly language, which has MC6800 assembly language as its ancestor, uses $ to represent a hex radix, and % to represent binary—the same notation is also used in MC68000 assembly language.

i just like having options... for example programs like CC65 has me constantly switch between C and Assembly, which makes it annoying that there are 2 different incompatible prefixes for the same thing.
BigDumbDinosaur wrote:
From my perspective, use of $ and % makes more sense, especially since only one character is needed to denote a hex value, instead of two.

well you need to hold SHIFT, so you're technically still pressing 2 keys. :wink:
BigDumbDinosaur wrote:
Also, speaking as someone who has scratch-written a full-featured 65C816 M/L monitor, parsing with a leading non-alphanumeric radix is much easier than parsing two leading alphanumeric characters (0x) to determine which number base to use.
[/quote]
yea i can see that being easier, so far i've only written some small functions that convert a value into a string (dec and hex), but not the other way around.
but when i get around to it i'll probably try to support both. (screw the "h" and "b" suffix though, i agree that those are just evil)

ultimately it doesn't really matter, i'll get used to these things someday anyway like everyone else on here. so please don't take any of this too seriously.
I don't really want to start a "TABs vs Spaces"-like war here.



to get a bit back on topic, don't the WDC Tools also include a Simulator? how does that one compare to hobbyist made ones?


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Fri Jan 07, 2022 3:57 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
Proxy wrote:
to get a bit back on topic, don't the WDC Tools also include a Simulator? how does that one compare to hobbyist made ones?

Dunno. I briefly fooled around with the WDC package but once Daryl had extended the Kowalski assembler to natively assemble 816 code I spent no further time with the WDC software. Although it would be great if Daryl were to get the Kowalski simulator working for the 816 it’s not something I'm desperate for at this time. When I need to test I upload the code to my POC unit and run on actual hardware.

Realistically, upgrading the simulator to support the 816 would mean some significant programming effort on Daryl’s part, and like all of us, he’s only allocated 24 hours per day. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Fri Jan 07, 2022 7:51 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Fri Jan 07, 2022 4:34 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigDumbDinosaur wrote:
like all of us, he’s only allocated 24 hours per day. :D
Plus the odd leap second! :wink:

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Fri Jan 07, 2022 3:19 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Quote:
From my perspective, use of $ and % makes more sense, especially since only one character is needed to denote a hex value, instead of two. Also, speaking as someone who has scratch-written a full-featured 65C816 M/L monitor, parsing with a leading non-alphanumeric radix is much easier than parsing two leading alphanumeric characters (0x) to determine which number base to use. Use of a trailing b for binary is even more annoying—you have to read the entire number before learning that it is binary, not decimal. Whomever thought of that should have been taken out back and shot.


Well...if you're writing an assembler (or more likely a cross-assembler) in a language which supports regular expressions, it's not too difficult to come up with one which recognizes both leading and trailing radix specifiers. If you're writing such a thing in a language which doesn't support them, then my guess is it still wouldn't be too difficult, while parsing, to copy the text of a numeric literal in the source code to a scratch area, until reaching a character which couldn't possibly be part of it. Note any radix specifiers either while copying or after, maybe set pointers to the start and end of the "data" part of the literal. Convert from there.

At least if I had to deal with suffix radix specifiers at that low level, that's the first approach that comes to mind.


Top
 Profile  
Reply with quote  
 Post subject: Re: Tool Chain for 65816
PostPosted: Fri Jan 07, 2022 4:08 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
teamtempest said what I was thinking. I usually avoid overuse of scratch areas, but they certainly can bring value, and tracking modifiers/delimiters is one of those circumstances.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

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: