Skip to content
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

More info about c64 #54

Open
tingtron opened this issue May 18, 2019 · 11 comments
Open

More info about c64 #54

tingtron opened this issue May 18, 2019 · 11 comments

Comments

@tingtron
Copy link

There is a disk image for Commodore 64 under

  • PLASMA/images/c64/PLASMA.D64

It contains plasma.prg file. I am trying to load it using c64 Mini, which should load regular Commodore 64 games and programs. But no luck yet.

Questions:

  • Are there any resources available (URL, video etc) how to use PLASMA on C64?
  • There are C64 specific sources (src/vmsrc/c64 and src/libsrc/c64), but they are smaller in number than Apple. Are there plans for more features or list of TODOs?

References:

  • https://gurce.net/c64mini/ - many useful links
  • Amazon: (search C64 Mini) $39.95 - a steal for such platform with joystick and cables.
@dschmenk
Copy link
Owner

Unfortunately the Commodore 64 code is barely a work-in-progress at the moment. It does build a minimal binary, but that is about it. More of a source code restructuring to support other 6502 platforms than a complete implementation for anything but the Apple II.

There are certainly a large number of TODOs for the C64, I just need to get to them someday. Thanks for your interest - it's always good to have motivation.

@tingtron
Copy link
Author

From motivation point of view ... Commodore platform of course, having

  • active demo scene and active game development
  • the SID and graphics
  • rich KERNAL and BASIC ROM, which is well documented but uses hex/numeric addressing in code

So it would be interesting to see how PLASMA would fare compared to assembler. But compared to BASIC there is obvious advantage. It would be interesting to see how the old PEEK/POKE style BASIC programs would shine with a benefit of symbolic access to the "API".

@tingtron
Copy link
Author

From practical steps, I would envision these stages for C64:

  • Cross-compile C64 PLA files on PC/Mac and copy p-code to C64 manually
  • PLASMA VM for C64 (plvm and cmd.pla) running pre-compiled p-code
  • Platform-specific C64 header files for Zero Page, KERNAL and BASIC ROM
  • PLASMA compiler and editor running on C64

Is that a fair view of the stages? Anything major missed?
Would it be possible to estimate how far along the things are in these stages?

@tingtron
Copy link
Author

Quick update:
I was able to run the PLASMA shell on C64 (emulator and C64 mini).
The issue was that after loading, the program would not autostart, like most C64 disk programs do.
E.g. these commands will just load, but won't run the program:

  • LOAD"*",8,1:
  • LOAD"*",8,1:RUN

Doing RUN alone would cause a BASIC error.
What works is to "jump" to the load address ($1000) from BASIC:
SYS 4096

@david-schmidt
Copy link
Collaborator

david-schmidt commented May 21, 2019

Some C64 tools such as the Blitz! compiler would insert a little BASIC stub (and load at the BASIC starting address of 2049) that did the SYS for those that didn't want to go the extra step of the SYS 4096 itself. Because of course you're not going to RUN an assembly program. ;-)

@dschmenk
Copy link
Owner

I was trying to figure out how to put this into the build: just a sequence of bytes as a header, but never got around to it. However, the bigger issue to work through is the memory map and to decide what goes where. It's quite chopped up. Maximizing RAM and having the ability to call ROM code without swapping out important parts of the VM or potentially data buffers to transfer data into needs to be discussed. I just don't have the background on the C64 to make off-the-cuff decisions that won't require much refactoring later ;-)

@tingtron
Copy link
Author

tingtron commented May 23, 2019

It looks like C64 BASIC is expected to be loaded at $0801 (first two bytes of .PRG).
So the manual stub would look like (assembly starts at $080D / 2061).

SYS = $9e
BASIC = $0801

*= BASIC ; 10 SYS2061
!word basend
!text 10,0,SYS,"2061",0
basend:
!byte 0,0
*= BASIC+12

jsr cls
... etc assembly

The assembly code could start at $1000 (4096), but since BASIC needs to load at $0801, it would lead to extra ~2k of space in the .PRG file - which could be used for binary data or other code,

@tingtron
Copy link
Author

As a proof of concept, the following was added near the top of plvmc64.s
in place of *= $1000.

CLS     = $e544                 ; KERNAL: clear screen
SYS     = $9e

*= $0801                        ; BASIC stub
!word STUBEND                   ;   10 SYS2061
!text 10,0,SYS,"2061",0         ; ($80D) - after stub
STUBEND:
!byte 0,0
                                ; => 2061 ($80D)
        JSR     CLS             ; remove BASIC logo

The resulting build runs in emulator and C64 Mini.

Plasma on C64 Mini

@dschmenk
Copy link
Owner

Very nice! You can send me a pull request or I can add it myself. The mini64 is very nice - I may have to pick one up.

@jameskeim
Copy link

From motivation point of view ... Commodore platform of course, having

  • active demo scene and active game development
  • the SID and graphics
  • rich KERNAL and BASIC ROM, which is well documented but uses hex/numeric addressing in code

So it would be interesting to see how PLASMA would fare compared to assembler.
But compared to BASIC there is obvious advantage. It would be interesting to see how
the old PEEK/POKE style BASIC programs would shine with a benefit of symbolic access
to the "API".

Along the same line of thought ... it would be interesting to see how PLASMA would fare as one of the "built-in" languages of the new Commander X16 8-bit computer. The system shares a lot of similarities with the C64 and the Vic-20. But it will have access to better video and newer peripherals. They are targeting BASIC and ASM as the main languages but it might be fun to see PLASMA take advantage of the speed and the updated video and sound capabilities.

@dschmenk
Copy link
Owner

I've been watching the CX16 progress. I'm not too motivated to jump in just yet. I'm not a fan of how they cut up the memory map and couldn't just commit to the 65816, nor am I particularly impressed with the choice of video subsystem. However, it could be a target without too much effort. The biggest hurdle will be to refactor the current modules into 8K chunks to fit into the bank switched memory. This is also something the Beeb wants, as its extended memory is accessed 8K at a time as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants