]> git.sur5r.net Git - cc65/commitdiff
New module
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 7 Mar 2003 11:53:17 +0000 (11:53 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 7 Mar 2003 11:53:17 +0000 (11:53 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2010 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/runtime/Makefile
libsrc/runtime/callmain.s [new file with mode: 0644]

index ff7c4866c83a5dc9172d421294a6f601cef9617d..f17099b4ae5ebab171ddcb5cd1283594ee391b75 100644 (file)
@@ -41,6 +41,7 @@ OBJS =        add.o           \
                bneg.o          \
                bpushbsp.o      \
                call.o          \
+        callmain.o      \
                compl.o         \
        condes.o        \
        decax1.o        \
diff --git a/libsrc/runtime/callmain.s b/libsrc/runtime/callmain.s
new file mode 100644 (file)
index 0000000..7e7b689
--- /dev/null
@@ -0,0 +1,40 @@
+;
+; Ullrich von Bassewitz, 2003-03-07
+;
+; Push arguments and call main()
+;
+
+
+       .export         callmain
+               .export         __argc, __argv
+
+        .import         _main, pushax
+
+;---------------------------------------------------------------------------
+; Setup the stack for main(), then jump to it
+
+.proc   callmain
+
+        lda     __argc
+        ldx     __argc+1
+        jsr     pushax          ; Push argc
+
+        lda     __argv
+        ldx     __argv+1
+        jsr     pushax          ; Push argv
+
+       ldy     #4              ; Argument size
+        jmp     _main
+
+.endproc
+
+;---------------------------------------------------------------------------
+; Data
+
+.bss
+__argc:         .res    2
+__argv:         .res    2
+
+
+
+