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

Please Add Mega65 support - 45GS02 processor #45

Open
CptnRoughnight opened this issue Nov 5, 2022 · 2 comments
Open

Please Add Mega65 support - 45GS02 processor #45

CptnRoughnight opened this issue Nov 5, 2022 · 2 comments

Comments

@CptnRoughnight
Copy link

Hi,

love the project. Can you please add support for Mega65? It uses a 45GS02, so there are some more opcodes.

https://files.mega65.org/manuals-upload/mega65-book.pdf the processor and instruction set is described in the appendix.

greetings

@t-edson
Copy link
Owner

t-edson commented Nov 6, 2022

Hi.
Currently I'm working in including support for the 65c02. After that I can think on including support for new CPU.

@BruderJo
Copy link

If you are fine with the current 6502 Opcodes only, you could start using the Mega65 with a simple unit
A "hello" program was working fine :-)
Copy the code as "Mega65.pas" into the unit directory and insert "uses Mega65" into your code.

{Mega65 unit    
Set P65PAS compiler to work in a Mega65 system.
Include some routines from the Kernal. 
}
{$ORG $2001}
{$BOOTLOADER $1E,$20,$0A,$00,$DE,$9C,58,$FE,$02,48,58,$9E,'COD_4A',58,$8F,32,80,54,53,80,65,83,49,48,49,$00,$00,$00}
{$STRING NULL_TERMINATED}
//Set RAM for Mega65
//{$CLEAR_STATE_RAM} If we clears, we'll need to define all RAM map
{$SET_DATA_ADDR ''}
{$SET_DATA_ADDR '00FB-00FE'}  //Some bytes from Zero page
{$SET_STATE_RAM '0100-01FF:SFR'} //Stack
unit Mega65;
interface
type 
  pointer = word;
var
  screenBorder: byte absolute 53280;  
  screenBack  : byte absolute 53281;  
  screen: [2000]byte absolute $800;
  //////////// KERNAL FUNCTIONS //////////
 
  //Initialize VIC; restore default input/output to keyboard/screen; clear screen; set PAL/NTSC switch and interrupt timer.
  procedure CINT;
  //Initialize CIA's, SID volume; setup memory configuration; set and start interrupt timer.
  procedure IOINIT;
  //Read byte from default input (for keyboard, read a line from the screen). (If not keyboard, must call OPEN and CHKIN beforehands.)
  procedure CHRIN: char;
  //Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
  procedure CHROUT(c: char register);
  //Read byte from default input. 
  procedure GETIN: byte;
  
implementation
  procedure CINT;
  begin
    asm
    JSR $FF81
    end
  end; 
  
  procedure IOINIT;
  begin
    asm 
    JSR $FF84  
    end 
  end; 
  procedure CHRIN: char;
  begin
    asm
    JSR $FFCF  ;return char in A register
    end
  end; 
  
  procedure CHROUT(c: char register);
  begin
    asm 
    JSR $FFD2  ;argument already in A register
    end 
  end; 
  procedure GETIN: byte;
  {Read byte from default input. (If not keyboard, must call OPEN and CHKIN beforehands.)
  Input: <none>
  Output: A = Byte read.}
  begin
    asm 
          JSR $FFE4
    end 
  end; 
  
end.

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

3 participants