mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 06:28:57 +00:00
Update from Oliver Schmidt
git-svn-id: svn://svn.cc65.org/cc65/trunk@3490 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
b36a0193c3
commit
2a688ef6fd
@ -4,10 +4,11 @@
|
|||||||
; This must be the *first* file on the linker command line
|
; This must be the *first* file on the linker command line
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _exit, __Exit
|
.export _exit
|
||||||
.import zerobss
|
.import zerobss
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import callmain, callirq
|
.import callmain, callirq
|
||||||
|
.import COUT
|
||||||
.import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated
|
.import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated
|
||||||
.import __INTERRUPTOR_COUNT__ ; Linker generated
|
.import __INTERRUPTOR_COUNT__ ; Linker generated
|
||||||
|
|
||||||
@ -36,12 +37,12 @@
|
|||||||
jsr init
|
jsr init
|
||||||
|
|
||||||
; Avoid re-entrance of donelib. This is also the _exit entry
|
; Avoid re-entrance of donelib. This is also the _exit entry
|
||||||
_exit: ldx #<__Exit
|
_exit: ldx #<exit
|
||||||
lda #>__Exit
|
lda #>exit
|
||||||
jsr reset ; Setup RESET vector
|
jsr reset ; Setup RESET vector
|
||||||
|
|
||||||
; Check for valid interrrupt vector table entry number
|
; Check for valid interrupt vector table entry number
|
||||||
lda intnum
|
lda intnum
|
||||||
beq :+
|
beq :+
|
||||||
|
|
||||||
; Deallocate interrupt vector table entry
|
; Deallocate interrupt vector table entry
|
||||||
@ -53,8 +54,8 @@ _exit: ldx #<__Exit
|
|||||||
; Call module destructors
|
; Call module destructors
|
||||||
: jsr donelib
|
: jsr donelib
|
||||||
|
|
||||||
; Restore the original RESET vector. This is also the __Exit entry
|
; Restore the original RESET vector
|
||||||
__Exit: ldx #$02
|
exit: ldx #$02
|
||||||
: lda rvsave,x
|
: lda rvsave,x
|
||||||
sta SOFTEV,x
|
sta SOFTEV,x
|
||||||
dex
|
dex
|
||||||
@ -100,7 +101,7 @@ init: ldx #zpspace-1
|
|||||||
ldx #<_exit
|
ldx #<_exit
|
||||||
lda #>_exit
|
lda #>_exit
|
||||||
jsr reset ; Setup RESET vector
|
jsr reset ; Setup RESET vector
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
|
|
||||||
@ -120,16 +121,41 @@ init: ldx #zpspace-1
|
|||||||
; Check for ProDOS
|
; Check for ProDOS
|
||||||
lda ENTRY
|
lda ENTRY
|
||||||
cmp #$4C ; Is MLI present? (JMP opcode)
|
cmp #$4C ; Is MLI present? (JMP opcode)
|
||||||
bne :+
|
bne prterr
|
||||||
|
|
||||||
; Allocate interrupt vector table entry
|
; Allocate interrupt vector table entry
|
||||||
jsr ENTRY
|
jsr ENTRY
|
||||||
.byte $40 ; Alloc interrupt
|
.byte $40 ; Alloc interrupt
|
||||||
.addr params
|
.addr params
|
||||||
|
bcs prterr
|
||||||
|
|
||||||
; Push arguments and call main()
|
; Push arguments and call main()
|
||||||
: jmp callmain
|
: jmp callmain
|
||||||
|
|
||||||
|
; Print error message and return
|
||||||
|
prterr: ldx #msglen-1
|
||||||
|
: lda errmsg,x
|
||||||
|
jsr COUT
|
||||||
|
dex
|
||||||
|
bpl :-
|
||||||
|
rts
|
||||||
|
|
||||||
|
errmsg: .ifdef __APPLE2ENH__
|
||||||
|
.byte $8D, 't'|$80, 'p'|$80, 'u'|$80, 'r'|$80, 'r'|$80
|
||||||
|
.byte 'e'|$80, 't'|$80, 'n'|$80, 'i'|$80, ' '|$80, 'c'|$80
|
||||||
|
.byte 'o'|$80, 'l'|$80, 'l'|$80, 'a'|$80, ' '|$80, 'o'|$80
|
||||||
|
.byte 't'|$80, ' '|$80, 'd'|$80, 'e'|$80, 'l'|$80, 'i'|$80
|
||||||
|
.byte 'a'|$80, 'F'|$80, $8D
|
||||||
|
.else
|
||||||
|
.byte $8D, 'T'|$80, 'P'|$80, 'U'|$80, 'R'|$80, 'R'|$80
|
||||||
|
.byte 'E'|$80, 'T'|$80, 'N'|$80, 'I'|$80, ' '|$80, 'C'|$80
|
||||||
|
.byte 'O'|$80, 'L'|$80, 'L'|$80, 'A'|$80, ' '|$80, 'O'|$80
|
||||||
|
.byte 'T'|$80, ' '|$80, 'D'|$80, 'E'|$80, 'L'|$80, 'I'|$80
|
||||||
|
.byte 'A'|$80, 'F'|$80, $8D
|
||||||
|
.endif
|
||||||
|
|
||||||
|
msglen = * - errmsg
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "LOWCODE"
|
.segment "LOWCODE"
|
||||||
|
Loading…
Reference in New Issue
Block a user