Oscar64, C compiler for Commodore 64

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 36

  • @anon_y_mousse
    @anon_y_mousse 9 місяців тому +4

    Interesting that someone would write a modern compiler for such an old platform. I especially like that the code sample you showed was using #embed, so hopefully that means they'll support C23. Your loop on the starfield didn't need to use floor or floats at all. I rewrote it with a ternary which should make it more portable to systems that might not use ASCII or PETSCII.
    for ( int i = -9; i < 10; i++, fputc( '
    ', stdout ) )
    for ( int j = 0; j < 19; j++ )
    fputc( ((i*i-j*j)%6)?' ':'*', stdout ); // This takes advantage of the fact that you're clearly just testing if there's a remainder and discarding the result of the division anyway.

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому +3

      Yes, it is amazing that we have so many languages to program for C64.
      Nice code, I like it :) Thank You!

  • @DrMortalWombat
    @DrMortalWombat 9 місяців тому +7

    Thank you for taking a look at oscar, I always enjoy your videos

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому +1

      Thank You very much and sorry for my late reply :)

  •  9 місяців тому +2

    As much as this is a "we did it because we can" project, it seems surprisingly more useful and productive than I've expected. Very cool.

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому +1

      Seams like a very good project to me, but now it's a question of further development... not do die in vain :) Cheers!

  • @MattKasdorf
    @MattKasdorf 9 місяців тому +6

    The Oscar64 code for the diamonds didn't seem to run much faster than the BASIC, might you do a speed comparison of BASIC, cc65, Oscar64, and assembly?

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому +1

      Yes, it was a bit slow, You are not the first how ask for speed comparison, So Yap, I should make a video about it :) Thank You for watching, Cheers!

    • @rjc199
      @rjc199 9 місяців тому

      From what I read it's an interpreted language. Just like basic.

  • @8bitsinthebasement
    @8bitsinthebasement 9 місяців тому +1

    Really interesting, I love the fact that you can compile generic code to multiple systems. If ever I decide to give C a go I'll look into Oscar, thanks Josip :)

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому

      Thank You Peter :) I never thought that we will be able to program in C for Commodore 64, but we have so many options these days. Not to mention BASIC for ATARI 2600 :) crazy...

  • @MrGareth1973
    @MrGareth1973 9 місяців тому +1

    Great video Josip! Thank you.

  • @bblevins
    @bblevins 9 місяців тому +2

    This is a fun video! You could do a series: "Learn C the retro way"

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому

      Thank You very much. Perhaps I should, You think that people would be interested? Cheers!

    • @bblevins
      @bblevins 9 місяців тому +1

      I know I'd be. coding C on the c64 looks fun.

    • @PSjustanormalguy
      @PSjustanormalguy 9 місяців тому

      ​@@JosipRetroBitsbut use a PDP11, after all that is what C is based on

  • @ArneChristianRosenfeldt
    @ArneChristianRosenfeldt 8 місяців тому +1

    The 6502 has this exception philosophy when it needs to carry over to the high byte. The GitHub about Oscar says that C needs to support datatypes > char . But often in my code I have small numbers. I cannot guarantee it, though. Or I have a loop and the high byte stays fixed most of the time. So usually you write an outer loop for the high byte. Pointers are either immediates or stored in the zero page. Both times: 16 bit.
    I argue about speed, not code density. Floats for example should stay in interpreted code.

    • @JosipRetroBits
      @JosipRetroBits  8 місяців тому

      Yes, Oscar64 is a 16bit based C language; latter in assembly it gets converted to 8bit.
      8bit char, or 8bit int, or byte is the same or it should be.
      For execution speed; it's a ok for convenience of easy coding :)
      Thank You for watching :) Cheers!

  • @MarcusLlewellyn
    @MarcusLlewellyn 9 місяців тому +1

    Thanks for this! I saw Oscar64's repo, but since I lack experience with C on the C64/128, I wasn't sure how this measured up to cc65 in terms of speed and optimization. I'm still not sure which is better, honestly. Particularly for someone just diving into C on the 6502 architecture.

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому +1

      This is how I see it; CC65 if faster, but Oscar64 is a bit easier to use, especially for making games and working with VICII registers. Thank You for watching :) Cheers!

    • @agpxnet
      @agpxnet 4 місяці тому

      @@JosipRetroBits Absolutely not. Oscar64 generate by far faster code than CC65. Don't use floating point on C64, use fixed point math.

  • @CaptainCommodore
    @CaptainCommodore 9 місяців тому +1

    That looks really cool 😎

  • @RandomBitzzz
    @RandomBitzzz 9 місяців тому +1

    Any idea on how well Oscar64 optimizes the code during the compile? The diamond program seemed kind of slow when you ran it.

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому

      It uses pre-written asembler routines. Yes, I've notice also, if You "printf" anything on the screen it's quite a slower then cc65. Cheers!

  • @svenvandevelde1
    @svenvandevelde1 9 місяців тому +1

    great!

  • @michaelstoliker971
    @michaelstoliker971 3 місяці тому

    Is there a graphics package for this version of C? I converted an Atari Basic program to Commodore Basic and the lack of graphics commands in Commodore Basic made it very difficult and slow performing. Of course I could have added multi color, but compared to the Atari's graphic commands, reproducing the bitmapped graphics was much more difficult than it needed to be. With this C, can you specify an X,Y location and plot a point with or without color information?

    • @michaelstoliker971
      @michaelstoliker971 3 місяці тому +1

      I should watch the whole video and I'd get my question answered,

  • @jmp01a24
    @jmp01a24 Місяць тому

    I am not a C++ programmer, but I know marco assemlers for the C64. To me, it feels odd to use all these definitions and use of them inside the source code, before compiling. I do not wan't to learn C++ so could you use a more familiar assembler than Microsoft C++ environment. Simply a text editor, like notepad, but preferably one that does autocorrection so you do not need to write # for absolute or $ for addresses, the editor can do that automatically. And that you can turn that function on or off by a menu selection (under copy, paste, etc).

  • @raidensama1511
    @raidensama1511 9 місяців тому +1

    Now get Rust to compile for C64

    • @JosipRetroBits
      @JosipRetroBits  9 місяців тому

      Well, someone needs to write a compiler :) Or do something like Rust to C and C to C64 machine code.

  • @GhassanPL
    @GhassanPL 3 місяці тому

    The content of the video is great, but please try to improve your mic quality, as you're barely audible.

  • @8bitHamburger
    @8bitHamburger 8 місяців тому

    Lets compile better games now :)

    • @JosipRetroBits
      @JosipRetroBits  8 місяців тому

      Games get better and better every year, for sure :) Cheers!