From 5d65206c33b0438899e6911c61de6f18cfc54f51 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 18 Jan 2015 16:41:31 +0000 Subject: [PATCH] 6502: now we have the runtime in common space, remove the extra copies --- Kernel/platform-tgl6502/tgl6502.s | 13 ++--------- Kernel/usermem_std-6502.s | 39 ++++++++----------------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/Kernel/platform-tgl6502/tgl6502.s b/Kernel/platform-tgl6502/tgl6502.s index e20f7f24..8479c5e0 100644 --- a/Kernel/platform-tgl6502/tgl6502.s +++ b/Kernel/platform-tgl6502/tgl6502.s @@ -38,6 +38,7 @@ .import outcharhex .import outxa + .import incaxy .include "kernel.def" .include "../kernel02.def" @@ -380,7 +381,7 @@ syscall_entry: sta ptr1 ldx sp+1 stx ptr1+1 - jsr cincaxy + jsr incaxy sta sp stx sp+1 @@ -502,16 +503,6 @@ _platform_interrupt_i: jmp _platform_interrupt -; -; Hack for common runtime helper (fixme move helpers to common) -; -cincaxy:sty tmp1 - clc - adc tmp1 - bcc incaxy2 - inx -incaxy2:rts - ; ; ROM disc copier (needs to be in common), call with ints off ; diff --git a/Kernel/usermem_std-6502.s b/Kernel/usermem_std-6502.s index 468a3770..c957ab16 100644 --- a/Kernel/usermem_std-6502.s +++ b/Kernel/usermem_std-6502.s @@ -6,7 +6,7 @@ .export __uput, __uputc, __uputw, __uzero .import map_kernel, map_process_always - .import outxa + .import outxa, popax .importzp ptr2, tmp2 ; ; These are intended as reference implementations to get a platform @@ -38,10 +38,10 @@ ; __uget: sta tmp2 stx tmp2+1 ; save the count - jsr cpopax ; pop the destination + jsr popax ; pop the destination sta ptr2 ; (ptr2) is our target stx ptr2+1 - jsr cpopax ; (ptr2) is our source + jsr popax ; (ptr2) is our source sta ptr3 stx ptr3+1 @@ -79,10 +79,10 @@ __uget_done: __ugets: sta tmp2 stx tmp2+1 ; save the count - jsr cpopax ; pop the destination + jsr popax ; pop the destination sta ptr2 ; (ptr2) is our target stx ptr2+1 - jsr cpopax ; (ptr2) is our source + jsr popax ; (ptr2) is our source sta ptr3 stx ptr3+1 @@ -151,10 +151,10 @@ __ugetw: sta ptr2 __uput: sta tmp2 stx tmp2+1 - jsr cpopax ; dest + jsr popax ; dest sta ptr2 stx ptr2+1 - jsr cpopax ; source + jsr popax ; source sta ptr3 stx ptr3+1 @@ -192,7 +192,7 @@ __uput_done: __uputc: sta ptr2 stx ptr2+1 jsr map_process_always - jsr cpopax + jsr popax ldy #0 sta (ptr2),y jmp map_kernel @@ -200,7 +200,7 @@ __uputc: sta ptr2 __uputw: sta ptr2 stx ptr2+1 jsr map_process_always - jsr cpopax + jsr popax ldy #0 sta (ptr2),y txa @@ -211,7 +211,7 @@ __uputw: sta ptr2 __uzero: sta tmp2 stx tmp2+1 jsr map_process_always - jsr cpopax ; ax is now the usermode address + jsr popax ; ax is now the usermode address sta ptr2 stx ptr2+1 @@ -237,22 +237,3 @@ __uzero_tail: __uzero_done: jmp map_kernel -; -; We need this helper in common, no easy way to put it without further -; work. We should plonk the runtime in common, we have room and its -; a) easier b) means we can share it with userspace (iffy but doable) -; - -cpopax: ldy #1 - lda (sp),y - tax - dey - lda (sp),y - inc sp - beq n1 - inc sp - beq n2 - rts -n1: inc sp -n2: inc sp+1 - rts -- 2.34.1