Unfortunately, I stuck with one thing while playing something with the JSRFAR kernel routine ($FF6E). I'll try to describe it as good as I can:
I have a little routine in bank 3 (ROM) which should display a 'B' at $0801 (second col in first raw of textscreen):
Then I want to call this routine with this code in bank 0:
- routine in bank 0 (RAM):
- d06e 78 sei ; disable IRQ
- d06f a2 03 ldx #$03
- d071 86 02 stx $02 ; set bank to 3
- d073 a2 ac ldx #$ac
- d075 86 03 stx $03 ; set far address to $AC40
- d077 a2 40 ldx #$40 ;
- d079 86 04 stx $04 ;
- d07b a2 00 ldx #$00
- d07d 86 06 stx $06 ; set a_reg = 0
- d07f 86 07 stx $07 ; set x_reg = 0
- d081 86 08 stx $08 ; set y_reg = 0
- d083 86 09 stx $09 ; set z_reg = 0
- d085 ba tsx
- d086 86 0a stx $0A ; store stackpointer
- d088 a9 01 lda #$01 ; display "A" at $0800 for debug
- d08a 8d 00 08 sta $0800 ;
- d08d 20 6e ff jsr $ff6e ; call kernel $FF6E: JSR_FAR routine
- d090 a9 03 lda #$03 ; display "C" at $0802 for debug
- d092 8d 02 08 sta $0802 ;
- d095 58 cli ; enable IRQ
- d096 60 rts ; return
It should work as this: Store all needed parameters for jsr_far in $02 to $0A, the display an 'A', call the subroutine in $3AC40 which display a 'B' then return to the routine in bank 0 which display now a 'C'.
If I call it from BASIC10 like this
only the "A" is being display and then the C65 (xc65) freezes. So the routine in $34c40 do nothing or can't be called at all.
Did I miss something? I can't find any more detailed info in the documentations I had.