Added routines to handle command line params
git-svn-id: svn://svn.cc65.org/cc65/trunk@2012 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -29,6 +29,7 @@ OBJS= _scrsize.o \
|
|||||||
ctype.o \
|
ctype.o \
|
||||||
cvline.o \
|
cvline.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
|
mainargs.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
read.o \
|
read.o \
|
||||||
revers.o \
|
revers.o \
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import zerobss, push0
|
.import zerobss, push0
|
||||||
.import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated
|
.import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated
|
||||||
.import _main
|
.import callmain
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "apple2.inc"
|
.include "apple2.inc"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
L1: lda sp,x
|
L1: lda sp,x
|
||||||
sta zpsave,x ; Save the zero page locations we need
|
sta zpsave,x ; Save the zero page locations we need
|
||||||
dex
|
dex
|
||||||
bpl L1
|
bpl L1
|
||||||
|
|
||||||
@@ -44,12 +44,12 @@ L1: lda sp,x
|
|||||||
; Save system stuff and setup the stack
|
; Save system stuff and setup the stack
|
||||||
|
|
||||||
tsx
|
tsx
|
||||||
stx spsave ; Save the system stack ptr
|
stx spsave ; Save the system stack ptr
|
||||||
|
|
||||||
lda MEMSIZE
|
lda MEMSIZE
|
||||||
sta sp
|
sta sp
|
||||||
lda MEMSIZE+1
|
lda MEMSIZE+1
|
||||||
sta sp+1 ; Set argument stack ptr
|
sta sp+1 ; Set argument stack ptr
|
||||||
|
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
|
|
||||||
@@ -64,13 +64,9 @@ L1: lda sp,x
|
|||||||
|
|
||||||
;; sta USEROM
|
;; sta USEROM
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
@@ -78,7 +74,7 @@ _exit: jsr donelib
|
|||||||
|
|
||||||
; Restore system stuff
|
; Restore system stuff
|
||||||
|
|
||||||
lda #$ff ; Reset text mode
|
lda #$ff ; Reset text mode
|
||||||
sta TEXTTYP
|
sta TEXTTYP
|
||||||
|
|
||||||
ldx spsave
|
ldx spsave
|
||||||
|
|||||||
21
libsrc/apple2/mainargs.s
Normal file
21
libsrc/apple2/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
C_OBJS =
|
C_OBJS =
|
||||||
|
|
||||||
S_OBJS = crt0.o \
|
S_OBJS = crt0.o \
|
||||||
|
mainargs.o \
|
||||||
systime.o
|
systime.o
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import push0, _main, zerobss
|
.import push0, callmain, zerobss
|
||||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
|
|
||||||
.importzp sp
|
.importzp sp
|
||||||
@@ -41,13 +41,9 @@
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/atmos/mainargs.s
Normal file
21
libsrc/atmos/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +40,7 @@ OBJS = _scrsize.o \
|
|||||||
joy_stddrv.o \
|
joy_stddrv.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
kernal.o \
|
kernal.o \
|
||||||
|
mainargs.o \
|
||||||
mouse.o \
|
mouse.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o \
|
revers.o \
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.export _exit
|
.export _exit
|
||||||
.import condes, initlib, donelib
|
.import condes, initlib, donelib
|
||||||
.import zerobss
|
.import zerobss
|
||||||
.import push0, _main
|
.import push0, callmain
|
||||||
.import RESTOR, BSOUT, CLRCH
|
.import RESTOR, BSOUT, CLRCH
|
||||||
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
|
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
|
||||||
.import __RAM_START__, __RAM_SIZE__
|
.import __RAM_START__, __RAM_SIZE__
|
||||||
@@ -108,13 +108,9 @@ L1: lda sp,x
|
|||||||
stx IRQVec+1
|
stx IRQVec+1
|
||||||
cli
|
cli
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
NoIRQ1: jsr push0 ; argc
|
NoIRQ1: jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Back from main (this is also the _exit entry). Reset the IRQ vector if
|
; Back from main (this is also the _exit entry). Reset the IRQ vector if
|
||||||
; we chained it.
|
; we chained it.
|
||||||
|
|||||||
21
libsrc/c128/mainargs.s
Normal file
21
libsrc/c128/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ OBJS = _scrsize.o \
|
|||||||
joy_stddrv.o \
|
joy_stddrv.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
kernal.o \
|
kernal.o \
|
||||||
|
mainargs.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o
|
revers.o
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import push0, _main, zerobss
|
.import push0, callmain, zerobss
|
||||||
.import MEMTOP, RESTOR, BSOUT, CLRCH
|
.import MEMTOP, RESTOR, BSOUT, CLRCH
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -75,13 +75,9 @@ MemOk: stx sp
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/c16/mainargs.s
Normal file
21
libsrc/c16/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ OBJS = _scrsize.o \
|
|||||||
joy_stddrv.o \
|
joy_stddrv.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
kernal.o \
|
kernal.o \
|
||||||
|
mainargs.o \
|
||||||
mouse.o \
|
mouse.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o \
|
revers.o \
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ ST = $90 ; IEC status byte
|
|||||||
TIME = $A0 ; 60 HZ clock
|
TIME = $A0 ; 60 HZ clock
|
||||||
FNAM_LEN = $B7 ; Length of filename
|
FNAM_LEN = $B7 ; Length of filename
|
||||||
SECADR = $B9 ; Secondary address
|
SECADR = $B9 ; Secondary address
|
||||||
DEVNUM = $BA ; Device number
|
DEVNUM = $BA ; Device number
|
||||||
|
FNAM = $BB ; Pointer to filename
|
||||||
KEY_COUNT = $C6 ; Number of keys in input buffer
|
KEY_COUNT = $C6 ; Number of keys in input buffer
|
||||||
RVS = $C7 ; Reverse flag
|
RVS = $C7 ; Reverse flag
|
||||||
CURS_FLAG = $CC ; 1 = cursor off
|
CURS_FLAG = $CC ; 1 = cursor off
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import zerobss, push0
|
.import zerobss, push0
|
||||||
.import _main
|
.import callmain
|
||||||
.import RESTOR, BSOUT, CLRCH
|
.import RESTOR, BSOUT, CLRCH
|
||||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
|
|
||||||
@@ -81,13 +81,9 @@ L1: lda sp,x
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
72
libsrc/c64/mainargs.s
Normal file
72
libsrc/c64/mainargs.s
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main.
|
||||||
|
; Based on code from Stefan A. Haubenthal, <polluks@web.de>
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
; Setup a pointer to our argv vector
|
||||||
|
|
||||||
|
lda #<argv
|
||||||
|
sta __argv
|
||||||
|
lda #>argv
|
||||||
|
sta __argv+1
|
||||||
|
|
||||||
|
; Save the last filename as argument #0. Since the buffer we're copying into
|
||||||
|
; is zeroed out, we don't need to add a NUL character.
|
||||||
|
|
||||||
|
ldy FNAM_LEN
|
||||||
|
cpy #16+1
|
||||||
|
bcc L0
|
||||||
|
ldy #16 ; Limit the length
|
||||||
|
L0: dey
|
||||||
|
L1: lda (FNAM),y
|
||||||
|
sta argv0,y
|
||||||
|
dey
|
||||||
|
bpl L1
|
||||||
|
inc __argc ; __argc = 1
|
||||||
|
|
||||||
|
; Find argument in BASIC buffer, if found, use it as arg #1
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
L2: lda $200,y
|
||||||
|
beq L9
|
||||||
|
iny
|
||||||
|
cmp #$8F ; REM token
|
||||||
|
bne L2
|
||||||
|
sty argv+2 ; Store offset
|
||||||
|
ldy #>$200
|
||||||
|
sty argv+3
|
||||||
|
inc __argc ; argc = 2
|
||||||
|
|
||||||
|
; Done
|
||||||
|
|
||||||
|
L9: rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Data
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
argv: .word argv0 ; Pointer to program name
|
||||||
|
.word $0000 ; Optional second argument
|
||||||
|
.word $0000 ; Last vector must always be NULL
|
||||||
|
|
||||||
|
.bss
|
||||||
|
argv0: .res 17 ; Program name
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +48,7 @@ OBJS = _scrsize.o \
|
|||||||
kplot.o \
|
kplot.o \
|
||||||
kscnkey.o \
|
kscnkey.o \
|
||||||
kudtim.o \
|
kudtim.o \
|
||||||
|
mainargs.o \
|
||||||
mouse.o \
|
mouse.o \
|
||||||
peeksys.o \
|
peeksys.o \
|
||||||
pokesys.o \
|
pokesys.o \
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.export _exit
|
.export _exit
|
||||||
|
|
||||||
.import _clrscr, initlib, donelib
|
.import _clrscr, initlib, donelib
|
||||||
.import push0, _main
|
.import push0, callmain
|
||||||
.import __CHARRAM_START__, __CHARRAM_SIZE__, __VIDRAM_START__
|
.import __CHARRAM_START__, __CHARRAM_SIZE__, __VIDRAM_START__
|
||||||
.import __EXTZP_RUN__, __EXTZP_SIZE__
|
.import __EXTZP_RUN__, __EXTZP_SIZE__
|
||||||
.import __BSS_RUN__, __BSS_SIZE__
|
.import __BSS_RUN__, __BSS_SIZE__
|
||||||
@@ -282,11 +282,6 @@ ccopy2: lda __VIDRAM_START__,y
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Create the (empty) command line for the program
|
|
||||||
|
|
||||||
jsr push0 ; argc
|
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
; Execute the program code
|
; Execute the program code
|
||||||
|
|
||||||
jmp Start
|
jmp Start
|
||||||
@@ -378,10 +373,9 @@ Start:
|
|||||||
|
|
||||||
cli
|
cli
|
||||||
|
|
||||||
; Call the user code
|
; Push arguments and call main()
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
jsr callmain
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/cbm510/mainargs.s
Normal file
21
libsrc/cbm510/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ OBJS = _scrsize.o \
|
|||||||
kplot.o \
|
kplot.o \
|
||||||
kscnkey.o \
|
kscnkey.o \
|
||||||
kudtim.o \
|
kudtim.o \
|
||||||
|
mainargs.o \
|
||||||
peeksys.o \
|
peeksys.o \
|
||||||
pokesys.o \
|
pokesys.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
.exportzp ktab2, ktab3, ktab4, time, RecvBuf, SendBuf
|
.exportzp ktab2, ktab3, ktab4, time, RecvBuf, SendBuf
|
||||||
|
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import push0, _main
|
.import push0, callmain
|
||||||
.import __BSS_RUN__, __BSS_SIZE__
|
.import __BSS_RUN__, __BSS_SIZE__
|
||||||
.import irq, nmi
|
.import irq, nmi
|
||||||
.import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
|
.import k_irq, k_nmi, PLOT, UDTIM, SCNKEY
|
||||||
@@ -214,11 +214,6 @@ Z4:
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Create the (empty) command line for the program
|
|
||||||
|
|
||||||
jsr push0 ; argc
|
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
; Execute the program code
|
; Execute the program code
|
||||||
|
|
||||||
jmp Start
|
jmp Start
|
||||||
@@ -293,10 +288,9 @@ Start:
|
|||||||
|
|
||||||
cli
|
cli
|
||||||
|
|
||||||
; Call the user code
|
; Push arguments and call main()
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
jsr callmain
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/cbm610/mainargs.s
Normal file
21
libsrc/cbm610/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,14 @@
|
|||||||
%.tgi: %.o ../../runtime/zeropage.o
|
%.tgi: %.o ../../runtime/zeropage.o
|
||||||
@$(LD) -t module -o $@ $^
|
@$(LD) -t module -o $@ $^
|
||||||
|
|
||||||
S_OBJS = crt0.o extzp.o oserror.o oserrlist.o randomize.o fio_module.o tgi_mode_table.o
|
S_OBJS = crt0.o \
|
||||||
|
extzp.o \
|
||||||
|
fio_module.o \
|
||||||
|
mainargs.o \
|
||||||
|
oserror.o \
|
||||||
|
oserrlist.o \
|
||||||
|
randomize.o \
|
||||||
|
tgi_mode_table.o
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# Drivers
|
# Drivers
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import pushax
|
.import pushax
|
||||||
.import _main
|
.import callmain
|
||||||
.import _MainLoop, _EnterDeskTop
|
.import _MainLoop, _EnterDeskTop
|
||||||
.import zerobss
|
.import zerobss
|
||||||
.importzp sp
|
.importzp sp
|
||||||
@@ -39,16 +39,10 @@
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
lda #0
|
|
||||||
tax
|
|
||||||
jsr pushax ; argc
|
|
||||||
jsr pushax ; argv
|
|
||||||
|
|
||||||
cli
|
cli
|
||||||
ldy #4 ; Argument size
|
jsr callmain
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry which must be called
|
; Call module destructors. This is also the _exit entry which must be called
|
||||||
; explicitly by the code.
|
; explicitly by the code.
|
||||||
|
|||||||
21
libsrc/geos/devel/mainargs.s
Normal file
21
libsrc/geos/devel/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ OBJS = _scrsize.o \
|
|||||||
kreadst.o \
|
kreadst.o \
|
||||||
ksetlfs.o \
|
ksetlfs.o \
|
||||||
ksetnam.o \
|
ksetnam.o \
|
||||||
|
mainargs.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o
|
revers.o
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import zerobss, push0
|
.import zerobss, push0
|
||||||
.import _main
|
.import callmain
|
||||||
.import CLRCH, BSOUT
|
.import CLRCH, BSOUT
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -70,13 +70,9 @@ L1: lda sp,x
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/pet/mainargs.s
Normal file
21
libsrc/pet/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ OBJS = _scrsize.o \
|
|||||||
ktalk.o \
|
ktalk.o \
|
||||||
kunlsn.o \
|
kunlsn.o \
|
||||||
kuntlk.o \
|
kuntlk.o \
|
||||||
|
mainargs.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o \
|
revers.o \
|
||||||
tgi_mode_table.o
|
tgi_mode_table.o
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
.export brk_jmp
|
.export brk_jmp
|
||||||
|
|
||||||
.import condes, initlib, donelib
|
.import condes, initlib, donelib
|
||||||
.import push0, _main, zerobss
|
.import push0, callmain, zerobss
|
||||||
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
|
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -99,13 +99,9 @@ L1: lda sp,x
|
|||||||
stx IRQVec+1
|
stx IRQVec+1
|
||||||
cli
|
cli
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
NoIRQ1: jsr push0 ; argc
|
NoIRQ1: jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Back from main (this is also the _exit entry). Reset the IRQ vector if
|
; Back from main (this is also the _exit entry). Reset the IRQ vector if
|
||||||
; we chained it.
|
; we chained it.
|
||||||
|
|||||||
21
libsrc/plus4/mainargs.s
Normal file
21
libsrc/plus4/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ OBJS = _scrsize.o \
|
|||||||
kbhit.o \
|
kbhit.o \
|
||||||
kernal.o \
|
kernal.o \
|
||||||
kplot.o \
|
kplot.o \
|
||||||
|
mainargs.o \
|
||||||
randomize.o \
|
randomize.o \
|
||||||
revers.o
|
revers.o
|
||||||
|
|
||||||
@@ -66,4 +67,4 @@ clean:
|
|||||||
zap: clean
|
zap: clean
|
||||||
@rm -f $(EMDS) $(JOYS) $(TGIS)
|
@rm -f $(EMDS) $(JOYS) $(TGIS)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import zerobss, push0
|
.import zerobss, push0
|
||||||
.import _main
|
.import callmain
|
||||||
.import RESTOR, BSOUT, CLRCH
|
.import RESTOR, BSOUT, CLRCH
|
||||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
|
|
||||||
@@ -75,13 +75,9 @@ L1: lda sp,x
|
|||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Pass an empty command line
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr push0 ; argc
|
jsr callmain
|
||||||
jsr push0 ; argv
|
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
|
||||||
jsr _main ; call the users code
|
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
|||||||
21
libsrc/vic20/mainargs.s
Normal file
21
libsrc/vic20/mainargs.s
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 2003-03-07
|
||||||
|
;
|
||||||
|
; Setup arguments for main
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
.constructor initmainargs, 24
|
||||||
|
.import __argc, __argv
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------
|
||||||
|
; Setup arguments for main
|
||||||
|
|
||||||
|
.proc initmainargs
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user