6502: correct crt0
authorAlan Cox <alan@linux.intel.com>
Thu, 23 Nov 2017 22:22:42 +0000 (22:22 +0000)
committerAlan Cox <alan@linux.intel.com>
Thu, 23 Nov 2017 22:22:42 +0000 (22:22 +0000)
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

Library/libs/crt0_6502.s
Library/libs/crt0nostdio_6502.s

index a5f4e35..577c680 100644 (file)
@@ -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
 
index 9806f80..9dd056b 100644 (file)
@@ -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