; I think therefore that providing we dec sp+1 we are always ok and
; will be somewhere between 0 and 255 bytes of valid
;
-;
__sighandler:
jsr stash_zp ; saves sp etc
dec sp+1 ; ensure we are safe C stack wise
pla
- sta ptr1 ; ZP was swapped
+ sta jmpvec+1 ; ZP was swapped
pla
- sta ptr1+1 ; ptr1 is now the function
+ sta jmpvec+2 ; ptr1 is now the function
pla
+
ldx #0
jsr pushax ; signal(int sig)
- jsr jptr1 ; no jsr (x) so fake it
+ jsr jmpvec ; no jsr (x) so fake it
jsr stash_zp ; recovers sp
initmainargs: ; Hardcoded compiler dumbness
rts ; will return via the kernel stub
- ; to user space
-jptr1: jmp (ptr1)
;
;
; On entry sp/sp+1 have been set up by the kernel (this has to be
; with an IRQ handler one. The commondata is per process and we depend
; upon this to make it all work
;
+; FIXME: we need to save and restore jmpvec+1/2. As we can re-enter
+; signal handlers we also need to shift to a save/restore of the ZP
+; values (and jmpvec+1/2) onto the C stack
+;
; Swap the C temporaries
;
stash_zp:
bpl Swap1
rts
+;
+; Ensure this version is found before the broken one in cc65 runtime
+; whichh won't work on 65C816
+
+;
+; Ullrich von Bassewitz, 06.08.1998
+;
+; CC65 runtime: call function via pointer in ax
+; Reworked Alan Cox 2017 to handle cases where ZP != 0
+;
+
+ .export callax
+ .import jmpvec
+
+ .macpack generic
+ .macpack cpu
+
+callax:
+
+.if (.cpu .bitand ::CPU_ISET_65SC02)
+ phx
+ pha
+ rts
+.else
+ sta jmpvec+1
+ stx jmpvec+2
+ jmp (jmpvec+1) ; jump there
+.endif
+
+
.bss
_environ: .res 2
; I think therefore that providing we dec sp+1 we are always ok and
; will be somewhere between 0 and 255 bytes of valid
;
-;
__sighandler:
jsr stash_zp ; saves sp etc
dec sp+1 ; ensure we are safe C stack wise
pla
- sta ptr1 ; ZP was swapped
+ sta jmpvec+1 ; ZP was swapped
pla
- sta ptr1+1 ; ptr1 is now the function
+ sta jmpvec+2 ; ptr1 is now the function
pla
+
ldx #0
jsr pushax ; signal(int sig)
- jsr jptr1 ; no jsr (x) so fake it
+ jsr jmpvec ; no jsr (x) so fake it
jsr stash_zp ; recovers sp
initmainargs: ; Hardcoded compiler dumbness
rts ; will return via the kernel stub
- ; to user space
-jptr1: jmp (ptr1)
;
;
; On entry sp/sp+1 have been set up by the kernel (this has to be
; Need to save the environment ptr. The rest of the stack should be
; fine.
;
+;
+; FIXME: sort out some sort of constructor mechanism for this
;
lda sp
ldx sp+1
; with an IRQ handler one. The commondata is per process and we depend
; upon this to make it all work
;
+; FIXME: we need to save and restore jmpvec+1/2. As we can re-enter
+; signal handlers we also need to shift to a save/restore of the ZP
+; values (and jmpvec+1/2) onto the C stack
+;
; Swap the C temporaries
;
stash_zp:
bpl Swap1
rts
+;
+; Ensure this version is found before the broken one in cc65 runtime
+; whichh won't work on 65C816
+
+;
+; Ullrich von Bassewitz, 06.08.1998
+;
+; CC65 runtime: call function via pointer in ax
+; Reworked Alan Cox 2017 to handle cases where ZP != 0
+;
+
+ .export callax
+ .import jmpvec
+
+ .macpack generic
+ .macpack cpu
+
+callax:
+
+.if (.cpu .bitand ::CPU_ISET_65SC02)
+ phx
+ pha
+ rts
+.else
+ sta jmpvec+1
+ stx jmpvec+2
+ jmp (jmpvec+1) ; jump there
+.endif
+
+
.bss
_environ: .res 2