Results 1 to 10 of 36

Thread: Pas2C64

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #30
    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
  •