-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commander X16 Port (I would help) #216
Comments
Hi!
I applaud the idea of porting a Forth to X16. BASIC V2 is not fun at all
and should be better avoided...
Unfortunately I do not have a lot of time to help out, but I would be happy
to answer any question that might pop up!
…On Sat, 21 Sep 2019 at 22:23, Stefan ***@***.***> wrote:
FYI https://github.com/commanderx16/x16-emulator
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AAY34O5ZUMQAOFJCGMHTKYLQKZ7C3A5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IZAVY#issuecomment-533827671>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAY34OZ5RMYUOIHTZNHETP3QKZ7C3ANCNFSM4IY7IDSA>
.
|
Thanks! Do you have an IRC or anything like that for questions? |
No I don’t, sorry, but posting issues like this works for me at least
…On Sun, 22 Sep 2019 at 00:46, Serentty ***@***.***> wrote:
Thanks! Do you have an IRC or anything like that for questions?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AAY34O247IQSOJXMRJJVJB3QK2P23A5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7I24JY#issuecomment-533835303>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAY34OZPN4XH35L7DF47J7TQK2P23ANCNFSM4IY7IDSA>
.
|
Okay. I'll leave comments here on this thread if I have questions, and possibly open other issues if I find problems that aren't restricted to just the port. |
I am also trying to port the Durexforth code to the CX16 and I do have a couple of questions regarding address $1234 and the f_no_tail_call_elimination. Address $1234 (4660) is in the middle of the BASIC RAM memory, is it possible to move that address to another place? It feels like a "randomly" selected address and as such, I am worried that the code might eventually grow to make the memory at $1234 being a part of Forth commands. As my 6502 assembler knowledge is a bit rusty after 35 years I have a problem following the code that deals with the $1234 address as well as the purpose of the F_NO_TAIL_CALL_ELIMINATION flag. I feel that the port should be quite straightforward once I changed the code that deals with the C64 zero-page, fixed addresses in the ROM and the usage of hardware registers/flags/chips. |
Hi! I added comments to explain purpose of $1234 and F_NO_TAIL_CALL_ELIMINATION. I hope it clears things up. Let me know if there are other questions! Thanks for asking! |
Unfortunately, I am still having problems and it seems to be related to keyboard input and possibly the stacks which brings me to the LSB/MSB stacks I am trying to understand the MSB and LSB comments and wonder if you can clarify them? MSB = $73 ; msb stack is [$3b, $72] |
Hi!
I added some comments re: parameter stack.
Hope it helps!
…On Wed, 9 Oct 2019 at 07:58, kghultland ***@***.***> wrote:
Unfortunately, I am still having problems and it seems to be related to
keyboard input and possibly the stacks which brings me to the LSB/MSB stacks
I am trying to understand the MSB and LSB comments and wonder if you can
clarify them?
MSB = $73 ; msb stack is [$3b, $72]
LSB = $3b ; lsb stack is [3, $3a]
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AAY34OZUM6OIYEYG3SVKL7TQNVXHXA5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAWWPWA#issuecomment-539846616>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAY34OZO5CMA4Q3ZOOINKJTQNVXHXANCNFSM4IY7IDSA>
.
|
So, in essence, all of the zero-page from $03 to $72 (110 bytes) will be overwritten by the I sure hope that the CX16 Kernel don't mess with the BASIC zero-page area :D |
That is correct. Having the stack in zp gives compact code. If worse comes
to worse, however, you could always move the parameter stack to normal
memory.
…On Wed, 9 Oct 2019 at 11:55, kghultland ***@***.***> wrote:
So, in essence, all of the zero-page from $03 to $72 (110 bytes) will be
overwritten by the
parameter stack?
I sure hope that the CX16 Kernel don't mess with the BASIC zero-page area
:D
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AAY34O65JZY4J2OYDDR7I3LQNWTAXA5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAXKXUY#issuecomment-539929555>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAY34OZP7NYNOZROSO6UDBDQNWTAXANCNFSM4IY7IDSA>
.
|
For what it's worth, the X16 docs state that 0-$80 can be used freely by
non-BASIC programs.
…On Wed, 9 Oct 2019 at 12:00, Johan Kotlinski ***@***.***> wrote:
That is correct. Having the stack in zp gives compact code. If worse comes
to worse, however, you could always move the parameter stack to normal
memory.
On Wed, 9 Oct 2019 at 11:55, kghultland ***@***.***> wrote:
> So, in essence, all of the zero-page from $03 to $72 (110 bytes) will be
> overwritten by the
> parameter stack?
>
> I sure hope that the CX16 Kernel don't mess with the BASIC zero-page area
> :D
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#216?email_source=notifications&email_token=AAY34O65JZY4J2OYDDR7I3LQNWTAXA5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAXKXUY#issuecomment-539929555>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAY34OZP7NYNOZROSO6UDBDQNWTAXANCNFSM4IY7IDSA>
> .
>
|
Stupid me :D The problem I had was not with the .asm code The problem is because I didn't realize that the code tries to load the |
As an aside to this, I'm toying with writing a Forth for C64/X16 with more of a focus on usability. DurexForth is very high quality program, but Forth itself is needlessly cryptic. I'm prototyping something now that uses single bytes for the stack instead of 16-bits per cell, e.g. "dup" dupes the top two bytes, "dup.w" dupes the top two words (16-bits), if necessary "dup.l" could be available for longs (32-bits). I'm also changing some of the syntax to be a little more accessible to people who are not already Forth programmers such as "\n" for a carriage-return instead of "CR" |
To each their own! Durexforth was also non-standard from the beginning. It
was only after some time I came to think the benefits of being compatible
with Starting Forth and the Forth standard documentation + test suites
outweighed cool non-standard features.
|
Another update, the CX16 emulator does not support reading from or writing to the normal hard disk directory on other KERNEL commands than LOAD and SAVE. So I spent the last week trying to debug code that will work on real hardware :p What I need to do is to put the files in a SD-card image and read the data from there... :) Well at least this debugging made me understand how Durexforth works under the hood... |
Yeah, the X16 emulator hijacks device no.1 with native code! |
I would be interested in helping with this if I could be assigned to improving usability. E.g. better error messages, adding an optional stack overflow/underflow checking mode, providing documentation etc. |
@kghultland Thanks for the update! Very exciting!
@Kroc That sounds great. How about you make a fork, then submit the changes
as pull requests?
|
That all depends where that's happening; both @Serentty and @kghultland appear to be making ports, but their changes are not public, so I don't know if they've forked the code-base entirely, or intend to add the X16 support as a compile-time option and send the changes back to you. I'd much rather we work on a single repo as it's not unreasonable to be able to support the C64 and X16 with the same code base. |
If possible, I think it’d be practical if X16 porting efforts could
eventually be brought in here, so that this could remain the mainline repo.
|
The real changes this far are small, mainly removed references to the C64 Hardware, fixed some use of extra undocumented 6502 instructions and added some extra code to help me debug the core The base.fs file compiles ok until it starts to include other .fs files, the error I am at now is in the asm.fs file. After I have managed to find the reasons for the .fs commands compilations failing we will have to decide if we want this as a fork or if we just want a compile-time flag for the CX16. Once it comes to implementing graphics functions using the "Vera" chipset and sound I am sure that I will need help :) But that code is written in Forth and Forth compiled assembler code so that will be a lot easier to do. |
👍🏻For the graphics stuff, I’d guess that would have to be a near-complete
rewrite. From what I saw, it doesn’t look like Vera has much in common with
VIC-II besides maybe the resolution :)
|
The ROM is getting drawing commands added to it at the moment, so you may not have to do much writing directly to hardware when the ROM will already have line-drawing primitives to hand :) |
@kghultland Let me know if you would like some debugging help. It would be fun to help out! |
I notice that this thread has been silent for a while. |
Wow! |
I am still working on it in my spare time, unfortunately, my spare time has been low the last couple of weeks because of me finishing off a consultant assignment. My main stumbling block at the moment is the limitations of the emulator, for now, to write to files with other Kernel commands than the SAVE call. I am going to look at Acmeforth as well but I think that having the Forth interpreter/compiler running natively is more in line with the visions of this new CX16 retro computer :D |
I've been noodling with an 8-bit Forth-like for the X16 as a sort of self-bootstrapping method of doing a scripting language on the system. For example, lets say that I want to read in a text file, do a load of rather complex analysis and compression and write out a new binary; in assembler, this would be a long and arduous bit of development and would still be inflexible in the end. BASIC is problematic in that it undergoes total spaghettification as soon as your program grows beyond a certain point of complexity. Forth is pretty much the lowest level, minimal language you can implement quickly that will give you the speed, compactness and flexibility you need to do scripting tasks on the system. But Forth was 16-bit because it was invented on an 16-bit minicomputer. A native 8-bit Forth is shockingly less complex to write; and notably simpler with the benefit of 65C02 opcodes: E.g. the store (
And executing the word atop the stack:
|
The jmp (pl_stack+2, x) trick is also possible with 16-bit Forths - it’s
merely a matter of how the stack is organized. DurexForth uses a split
stack (with separate MSB and LSB areas) but it is actually more common to
have a single stack that allows these indirections. You could look at any
6502 FIG-FORTH to see how it works.
The main problem with 8-bit cell size is that you still need double cells
to work with adresses. Then from user perspective it gets a bit unwieldy,
since one might need to do S>D D+ for a routine operation like adding an
offset to an address.
Having said that, I think sounds like an interesting idea to come up with a
Machine Forth for 6502!
…On Wed, 27 Nov 2019 at 20:47, Kroc Camen ***@***.***> wrote:
I've been noodling with an 8-bit Forth-like for the X16 as a sort of
self-bootstrapping method of doing a scripting language on the system.
For example, lets say that I want to read in a text file, do a load of
rather complex analysis and compression and write out a new binary; in
assembler, this would be a long and arduous bit of development and would
still be inflexible in the end. BASIC is problematic in that it undergoes
total spaghettification as soon as your program grows beyond a certain
point of complexity.
Forth is pretty much the lowest level, minimal language you can implement
quickly that will give you the speed, compactness and flexibility you need
to do scripting tasks on the system.
But Forth was 16-bit because it was invented on an 16-bit minicomputer. A
native 8-bit Forth is shockingly less complex to write; and notably simpler
with the benefit of 65C02 opcodes:
E.g. the store (!) word:
store:
lda pl_stack+2, x ; get value to store (3rd byte)
sta (pl_stack, x) ; store via the address on the stack
inx ; consume...
inx ; three...
inx ; bytes
rts
And executing the word atop the stack:
execute:
; we must reduce the stack by 2 bytes before we jump!
inx
inx
; 65C02: do a jump directly from the parameter stack,
; with +2 to compensate for already having popped the stack
jmp (pl_stack+2, x)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AAY34OYDSX3ANJJQ2FUGRDDQV3FD5A5CNFSM4IY7IDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFKSLWQ#issuecomment-559228378>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAY34OZ256D6A6KZHJEPZA3QV3FD5ANCNFSM4IY7IDSA>
.
|
I've named my project for an 8-bit native Forth-like -- https://github.com/Kroc/pling -- though you should disregard the existing code, it's all being redone. I've opened a discussion thread if anybody here would like to contribute ideas regarding what an 8-bit native Forth should be like: https://github.com/Kroc/pling/issues/1 |
Two years? Well, my words were certainly bolder than my effort. :D |
@jkotlinski: I am late to this conversation, but I thank you for this. I just discovered forth earlier this year, and it has become my main programming language. I love the fact that I have a high quality ANS Forth 2012 version for my C64, which I use everyday. I thank you and your team for the great work! |
@jcolivo thank you for the kind words! :) |
@jcolivo sorry for the necropost. I was wondering, may I add your words to Testimonials section in README.md? |
Is the X16 still a thing, or did public interest wane? |
The work on the prototype seems to be continuing and is apparently closing
in on final. The forum is only moderately active but not dead. What mostly
blocks actual release at this point is the chip shortage. Once that is
overcome, it does look like the thing will ship, and I would expect a sharp
increase in interest then.
Another somewhat retro machine that is actually shipping is the Mega65.
…On Sun, 11 Sept 2022 at 14:39, Johan Kotlinski ***@***.***> wrote:
Is the X16 still a thing, or did public interest wane?
—
Reply to this email directly, view it on GitHub
<#216 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZXPRCJNA4CHMUY53APBPLV5XHJDANCNFSM4IY7IDSA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
So, I know that making and maintaining a port to anything is a big commitment, so if you would rather not, that's fine and you can go ahead and close this. That said...
David Murray (The 8-Bit Guy) is designing a new computer called the Commander X16 meant for retrocomputing enthusiasts, people learning programming, and anyone else who would want such a system. It's based around the 65C02 (possibly being upgraded to the 65816 before release), and is 6502-compatible. It comes with BASIC in ROM, and while this is okay, BASIC is really starting to show its age and it would be nice to have another language available that is still well-suited to an 8-bit CPU, and Forth is one of the best options. That's why I'm interested in seeing this ported over, and would love to help make that happen.
The X16 is strongly inspired by Commodore designs, and it is compatible with the C64 in many ways, including having a compatible KERNAL jump table ($FFD2 is still CHROUT, and so on). The video chip is also capable of 40×25 text at 16 colours, just like the VIC-II. So, a lot of stuff would just work out of the box.
I would estimate this as being about as difficult as a port to the Commodore 128 would be, and I would be willing to do most of the work, just asking some questions here and there.
The text was updated successfully, but these errors were encountered: