From: Alan Cox Date: Sat, 17 Jan 2015 01:13:43 +0000 (+0000) Subject: tgl6502: snapshot of syscall work X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=17d7200a5b8957d01bf4124a2f84ca91fceef0cb;p=FUZIX.git tgl6502: snapshot of syscall work We make syscalls now, but the arguments are mashed. --- diff --git a/Kernel/platform-tgl6502/tgl6502.s b/Kernel/platform-tgl6502/tgl6502.s index 63cee77c..2ab37cc2 100644 --- a/Kernel/platform-tgl6502/tgl6502.s +++ b/Kernel/platform-tgl6502/tgl6502.s @@ -366,33 +366,42 @@ syscall_entry: ; Remove the arguments. This is fine as by the time we go back ; to the user stack we'll have finished with them lda sp + sta ptr1 ldx sp+1 + stx ptr1+1 jsr cincaxy sta sp stx sp+1 - ldy #0 ; ; We copy the arguments but need to deal with the compiler ; stacking in the reverse order. At this point ptr1 points ; to the last byte of the arguments (first argument). We go ; down the stack copying words up the argument list. ; - + ldx #'S' + stx $FF03 + ldx #0 + pha + tya + jsr outcharhex + pla + iny + dey + beq noargs copy_args: lda (ptr1),y ; copy the arguments over - sta U_DATA__U_ARGN,x - iny - inx + sta U_DATA__U_ARGN+1,x + dey lda (ptr1),y sta U_DATA__U_ARGN,x - iny - dex - dex - dex - cpy #8 + inx + inx + dey bne copy_args - +noargs: + ldx #'Y' + stx $FF03 ; ; Now we need to stack switch. Save the adjusted stack we want ; for return @@ -420,6 +429,9 @@ copy_args: lda #>kstack_top sta sp+1 + ldx #'S' + stx $FF03 + cli ; ; Caution: We may enter here and context switch and another task