From: Alan Cox Date: Thu, 23 Nov 2017 22:22:42 +0000 (+0000) Subject: 6502: correct crt0 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1c18c77f87cb32400a51ced7752607c3eea6f8f9;p=FUZIX.git 6502: correct crt0 The older compiler when we forced fastcall makes main() fastcall. The current compiler which we can now use without patches makes make() vararg for some odd reason. That means we need to leave argv on the stack. With this set the 65c816 userspace actually seems useable --- diff --git a/Library/libs/crt0_6502.s b/Library/libs/crt0_6502.s index a5f4e358..577c6809 100644 --- a/Library/libs/crt0_6502.s +++ b/Library/libs/crt0_6502.s @@ -88,7 +88,7 @@ start: inx l1: sta _environ stx _environ+1 - jsr popax ; Pull argv off the stack leaving argc +; jsr popax ; Pull argv off the stack leaving argc ldy #2 ; 2 bytes of args jsr _main diff --git a/Library/libs/crt0nostdio_6502.s b/Library/libs/crt0nostdio_6502.s index 9806f80f..9dd056bd 100644 --- a/Library/libs/crt0nostdio_6502.s +++ b/Library/libs/crt0nostdio_6502.s @@ -87,7 +87,7 @@ start: inx l1: sta _environ stx _environ+1 - jsr popax ; Pull argv off the stack leaving argc +; jsr popax ; Pull argv off the stack leaving argc ldy #2 ; 2 bytes of args jsr _main