Added constructor support (contributed by Stefan Haubenthal).
git-svn-id: svn://svn.cc65.org/cc65/trunk@3757 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
aa217e4535
commit
39f096b34e
2 changed files with 56 additions and 4 deletions
19
doc/pet.sgml
19
doc/pet.sgml
|
@ -145,7 +145,15 @@ No extended memory drivers are currently available for the PET.
|
||||||
|
|
||||||
<sect1>Joystick drivers<p>
|
<sect1>Joystick drivers<p>
|
||||||
|
|
||||||
No joystick drivers are currently available for the PET.
|
<descrip>
|
||||||
|
|
||||||
|
<tag><tt/pet-ptvjoy.joy/</tag>
|
||||||
|
Driver for the Protovision 4-player adapter contributed by Groepaz. See
|
||||||
|
<htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm"
|
||||||
|
name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
|
||||||
|
building instructions. Up to two joysticks are supported.
|
||||||
|
|
||||||
|
</descrip><p>
|
||||||
|
|
||||||
|
|
||||||
<sect1>Mouse drivers<p>
|
<sect1>Mouse drivers<p>
|
||||||
|
@ -191,6 +199,15 @@ The program return code (low byte) is passed back to BASIC by use of the
|
||||||
<tt/ST/ variable.
|
<tt/ST/ variable.
|
||||||
|
|
||||||
|
|
||||||
|
<sect1>Interrupts<p>
|
||||||
|
|
||||||
|
The runtime for the PET uses routines marked as <tt/.CONDES/ type 2 for
|
||||||
|
interrupt handlers. Such routines must be written as simple machine language
|
||||||
|
subroutines and will be called automatically by the interrupt handler code
|
||||||
|
when they are linked into a program. See the discussion of the <tt/.CONDES/
|
||||||
|
feature in the <htmlurl url="ca65.html" name="assembler manual">.
|
||||||
|
|
||||||
|
|
||||||
<sect1>Using extended memory<p>
|
<sect1>Using extended memory<p>
|
||||||
|
|
||||||
The extended memory at $9000 of the CBM 8x96 may be added to the heap by using
|
The extended memory at $9000 of the CBM 8x96 may be added to the heap by using
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _exit
|
.export _exit
|
||||||
.import initlib, donelib
|
.import initlib, donelib, callirq
|
||||||
.import zerobss, push0
|
.import zerobss, push0
|
||||||
.import callmain
|
.import callmain
|
||||||
.import CLRCH, BSOUT
|
.import CLRCH, BSOUT
|
||||||
|
.import __INTERRUPTOR_COUNT__
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "pet.inc"
|
.include "pet.inc"
|
||||||
|
@ -65,14 +66,40 @@ L1: lda sp,x
|
||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
|
; If we have IRQ functions, chain our stub into the IRQ vector
|
||||||
|
|
||||||
|
lda #<__INTERRUPTOR_COUNT__
|
||||||
|
beq NoIRQ1
|
||||||
|
lda IRQVec
|
||||||
|
ldx IRQVec+1
|
||||||
|
sta IRQInd+1
|
||||||
|
stx IRQInd+2
|
||||||
|
lda #<IRQStub
|
||||||
|
ldx #>IRQStub
|
||||||
|
sei
|
||||||
|
sta IRQVec
|
||||||
|
stx IRQVec+1
|
||||||
|
cli
|
||||||
|
|
||||||
; Push arguments and call main()
|
; Push arguments and call main()
|
||||||
|
|
||||||
jsr callmain
|
NoIRQ1: jsr callmain
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
_exit: pha ; Save the return code on stack
|
_exit: pha ; Save the return code on stack
|
||||||
jsr donelib ; Run module destructors
|
lda #<__INTERRUPTOR_COUNT__
|
||||||
|
beq NoIRQ2
|
||||||
|
lda IRQInd+1
|
||||||
|
ldx IRQInd+2
|
||||||
|
sei
|
||||||
|
sta IRQVec
|
||||||
|
stx IRQVec+1
|
||||||
|
cli
|
||||||
|
|
||||||
|
; Run module destructors
|
||||||
|
|
||||||
|
NoIRQ2: jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
|
@ -96,6 +123,13 @@ L2: lda zpsave,x
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
; The IRQ vector jumps here, if condes routines are defined with type 2.
|
||||||
|
|
||||||
|
IRQStub:
|
||||||
|
cld ; Just to be sure
|
||||||
|
jsr callirq ; Call the functions
|
||||||
|
jmp IRQInd ; Jump to the saved IRQ vector
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data
|
; Data
|
||||||
|
@ -103,6 +137,7 @@ L2: lda zpsave,x
|
||||||
.data
|
.data
|
||||||
|
|
||||||
zpsave: .res zpspace
|
zpsave: .res zpspace
|
||||||
|
IRQInd: jmp $0000
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue