From: Alan Cox Date: Thu, 20 Nov 2014 23:34:26 +0000 (+0000) Subject: crt0: Correct environment and argument parsing X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1c9009608bca1b09f214cf9de2c1e3554feeaf56;p=FUZIX.git crt0: Correct environment and argument parsing From: Will Sowerbutts kernel sets up the stack differently: argc, argv, environ[] --- diff --git a/Library/libs/crt0.s b/Library/libs/crt0.s index daf4f7f3..74e61f45 100644 --- a/Library/libs/crt0.s +++ b/Library/libs/crt0.s @@ -55,14 +55,12 @@ start2: ld hl, #l__DATA - 1 ; work around linker limit ld (hl), #0 ldir call gsinit - pop hl ; environ + + ld hl, #4 + add hl, sp ld (_environ), hl - pop de ; argv - pop bc ; argc ld hl, #_exit ; return vector - ex (sp), hl ; swap it with the provided - push bc ; return address - push de ; re-stack arguments + push hl jp _main ; go .area _GSINIT