Results 1 to 10 of 36

Thread: Pas2C64

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ok, for the time being, I am going to support these types in my compiler - integer (signed 16-bit), single (32-bit), and string (up to 255 characters max)...

    I can now read in Pascal syntax constants and variables using these standard types, and store them in generated assembly code.

    I feel I am very close to actually doing some assignment statements, and probably some math too in the compiler

    I have also found out how to detect key presses, so I will have routines for this too; WaitForAnyKey and WaitForKey(some key code), and probably even IsKeyPressed(some key code).

    I think I know how I will do inputting of strings from the keyboard (not sure about numbers though yet)...

    cheers,
    Paul

  2. #2
    After I found a very simple c64 interrupt routine here:

    http://xabreman.wordpress.com/2011/0...rrupt-example/

    I thought that I can do this too, so by adding some new routines into the Pascal language & their support framework (parsing + code generation), I can now actually do this very same interrupt routine using compiled Pascal routines:

    Code:
    program Test;
    
    procedure irqtest; interrupt;
    begin
      IncMemB($d020);
      StdIRQ;
    end;
    
    procedure Init;
    begin
      SetInterrupt(irqtest);
    end;
    
    begin
      Init;
    end.
    which produces this:
    Code:
        :BasicUpstart2(main) // 10 sys <start address>
        
        .import source "rtl\Macros_RTL.asm"
        .import source "rtl\Consts_RTL.asm"
        
    int_irqtest:
        inc $d020
        jmp STDIRQ
        rti
    proc_init:
        sei       // disable interrupts
        
        // set a custom interrupt routine address to interrupt vector
        
        lda #<int_irqtest       // low byte of irqtest start addr
        ldx #>int_irqtest       // high byte of irqtest start addr
        sta IRQVECLO
        stx IRQVECHI
        
        cli                 // clear interrupt disable bit
        rts
    main:
        jsr proc_init
        rts
    and when run in the c64 VICE emulator, it hooks the interrupt routine into the interrupt vector and merrily runs in the background incrementing the background colour!

    Now this is progress!! haha

    cheers,
    Paul
    Last edited by paul_nicholls; 15-06-2011 at 12:40 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •