6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Jun 04, 2024 6:44 am

All times are UTC




Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Tue Jan 24, 2017 10:27 am 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 110
Location: Virginia USA
I scanned my copy of the Hyper C manual this weekend. Here it is...

Cheers,
Andy


Attachments:
HyperC Manual.pdf [125.62 MiB]
Downloaded 380 times
Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 24, 2017 4:14 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1933
Location: Sacramento, CA, USA
Good stuff! Thanks Andy!

Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 25, 2017 9:18 am 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 110
Location: Virginia USA
Hi Mike,

You're welcome! I learned a lot from it.

Cheers,
Andy


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 18, 2017 5:28 am 
Offline

Joined: Sat Nov 26, 2016 8:57 pm
Posts: 15
Reading the HyperC manual, and writing a bit more test code, I still can't decide on using a register or accumulator architecture for the bytecode. I appreciate you finding the HyperC manual, that's a great resource, Andy!

I see two ways to do the bytecode compiler: (1) a HyperC-like register based bytecode, perhaps with more registers (A, B, r3, and so on), and (2) a Forth VM-like bytecode, with a top-of-stack register. I'm leaning towards the second approach. The first would incur costs from register-to-register moves, where as the second would only deal with indexing and popping overhead (1 cycle for X indexing, 2 for INX/DEX). Is there any good reason to use the first approach?

Of course, another backend can be written for the compiler. I need one to focus on, however.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 18, 2017 3:01 pm 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 110
Location: Virginia USA
Hi James,

I can only comment on HyperC as that's what I'm most familiar with. The manual defines a 16 bit VM that uses the zero page as 16 bit registers and defines a set of pseudo-opcodes for the interpreter. The interpreter works very much like the FIG FORTH's inner interpreter except for its definition of the VM. I guess it depends on how much of a stack you want to use. HyperC uses a software stack set at high memory that works downward and is not confined to 256 bytes. HyperC's return stack (at least for the 6502) is still in page $1. HyperC's software stack is like FORTH's data stack except it uses a zero page location for a pointer instead of a machine register. More details regarding HyperC may be found here: http://mirrors.apple2.org.za/ground.ica ... es/Hyperc/ . As far as I know there was a HyperC compiler for the Apple IIe/c and the Apple Macintosh.

Maybe you can borrow ideas from both approaches...

Cheers!
Andy


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 01, 2017 10:57 pm 
Offline

Joined: Sat Dec 12, 2015 7:48 pm
Posts: 126
Location: Lake Tahoe
I went through many of the same thoughts when designing PLASMA. Over the years, I took a number of approaches to solving similar problems that you are facing. One was the native code vs bytecode code generation. I ultimately went with bytecode only in my last implementation, thinking I would implement a JIT if I wanted optimized native code. Bytecode has a number of benefits including code density, relocatability, and ease of execution from "external" memory - auxiliary memory in an Apple //e or extended memory in an Apple ///. For the previous version, I did write a back-end code generator that would spit out native 6502 for the more basic ops, and call into the VM for the larger ops. Code size explosion kept me from outputting 6502 for every op. It did very basic peephole optimizations and tracked the TOS so it didn't need to DEX/INX all the time. PLASMA is about a simple compiler as you'll find (thus its name - Proto Language AsSembler). It might be of some use if you want to see what I tried. Maybe you'll get inspired and do something much more intelligent. You can browse the source for the code generator on the backwaters of SourceForge (yeah, it was that long ago):

http://vm02.cvs.sourceforge.net/viewvc/ ... iew=markup

I had other implementations of PLASMA that could return multiple values like all the cool new languages do nowadays, but I couldn't figure out a robust way to handle values that might get left dangling on the stack.

Dave...

Edit: make sure I had the correct version link


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 14, 2018 11:28 am 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 110
Location: Virginia USA
After obtaining permission from the author I have had the source code to the Apple II HyperC operating system uploaded here: http://mirrors.apple2.org.za/Apple%20II ... ce%20Code/

I also have a *.zip of text files for those interested in the source code. Attached here: See the read.me file for instructions.

Cheers!
Andy


Attachments:
READ.ME.txt [2.15 KiB]
Downloaded 181 times
HCSRC.zip [49.27 KiB]
Downloaded 175 times
Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 16, 2018 7:39 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1003
Location: Canada
With the WDC tools now being free, isn't this kind of moot?

Interesting, but only for retro hobby stuff. Which I love BTW...

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 16, 2018 7:51 pm 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 110
Location: Virginia USA
At the time I thought it was an interesting implementation of a high level language for a 6502-based machine. I liked it better than BASIC or Pascal. I might have gone with Forth if there was documentation available at the time. Maybe there was but I couldn't find it. As of now it may have educational value. I still use it now and then...

Cheers,
Andy


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 16, 2018 8:42 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10821
Location: England
BillO wrote:
With the WDC tools now being free, isn't this kind of moot?

Hmm, I don't know all the details, but my first guess would always be
- better to have one more tool than one fewer
- better to have a tool under community stewardship
- better to have a tool with source available
- better to have a tool which will still run with all features in N years time

Which is to say, WDC probably won't have released sources, might withdraw their offer, might be offering something less than fully featured, probably won't be very responsive to bug reports.


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 16, 2018 8:58 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1003
Location: Canada
BigEd wrote:
BillO wrote:
With the WDC tools now being free, isn't this kind of moot?

Hmm, I don't know all the details, but my first guess would always be
- better to have one more tool than one fewer
- better to have a tool under community stewardship
- better to have a tool with source available
- better to have a tool which will still run with all features in N years time

Which is to say, WDC probably won't have released sources, might withdraw their offer, might be offering something less than fully featured, probably won't be very responsive to bug reports.


Good points.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 21, 2020 12:33 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
Hi, I was just wondering if this is still an active project.

CC65 updates... sometimes, and WDC also have their own Compiler.
but I don't really know if either were improved much ever since this thread started.

but even then, as bigEd said, it's always better to have another option.

as far as i understood the thread there are basically 2 options
1. where the Compiler outputs code that natively runs on the target CPU, which is probably the most efficient option but also requires the Compiler to directly support each target CPU
2. where the Compiler outputs intermediate code that runs on a sort of VM on the target CPU, which adds a lot of overhead when running anything on it, but also means that supporting another CPU can be done by "just" porting the VM to that CPU. (overall Java but it's C)

Sorry I can't contribute much more to the discussion.


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 21, 2020 1:15 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
I've been debugging the WDC 65C02 C compiler and have got it to a state where it crashes a lot less often and produces runnable code -- I've been using it to write demos for the W65C165MMC module.

I have to finish cleaning up the library and header files and then figure out with WDC how to get it released.

My home PC died a couple of weeks ago and I've lost some recent work but the main changes were checked into Git so hopefully not too much is gone for good.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 21, 2020 4:38 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
BitWise wrote:
I've been debugging the WDC 65C02 C compiler and have got it to a state where it crashes a lot less often and produces runnable code -- I've been using it to write demos for the W65C165MMC module.

I have to finish cleaning up the library and header files and then figure out with WDC how to get it released.

My home PC died a couple of weeks ago and I've lost some recent work but the main changes were checked into Git so hopefully not too much is gone for good.


that sounds good, but where would one get that fixed compiler? I currently got version 3.49.1

also are there any examples given for both C code and maybe a batch file that generates a binary? because i appear to be too stupid to do it myself.
but i don't really want to derail the thread, so maybe later i'll just make a "WDC C question" thread or something, as a place to ask stupid questions about how to actually use that thing.


Last edited by Proxy on Mon Sep 21, 2020 5:07 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Sep 21, 2020 5:06 pm 
Offline

Joined: Mon Sep 17, 2018 2:39 am
Posts: 133
Hi!

Proxy wrote:
Hi, I was just wondering if this is still an active project.

CC65 updates... sometimes, and WDC also have their own Compiler.
but I don't really know if either were improved much ever since this thread started.

but even then, as bigEd said, it's always better to have another option.


There is another option now, the VBCC compiler port to 6502 http://www.compilers.de/vbcc.html see the announcement: viewtopic.php?f=2&t=6100

Also, there is a lot of activity lately in the CC65 project, many bug-fixes and new optimizations, over https://github.com/cc65/cc65/.

Have Fun!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4

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: