Refined the comments in the target start-up files.
Fixed typo errors. Made the comments consistent across all those files.
This commit is contained in:
@@ -29,7 +29,7 @@ IRQInd = $500 ; JMP $0000 - used as indirect IRQ vector
|
||||
|
||||
Start:
|
||||
|
||||
; Save the zero page locations we need
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
sei ; No interrupts since we're banking out the ROM
|
||||
sta ENABLE_RAM
|
||||
@@ -41,13 +41,13 @@ L1: lda sp,x
|
||||
sta ENABLE_ROM
|
||||
cli
|
||||
|
||||
; Switch to second charset
|
||||
; Switch to the second charset.
|
||||
|
||||
lda #14
|
||||
jsr $FFD2 ; BSOUT
|
||||
|
||||
; Save system stuff and setup the stack. The stack starts at the top of the
|
||||
; usable RAM.
|
||||
; Save some system stuff; and, set up the stack. The stack starts at the top
|
||||
; of the usable RAM.
|
||||
|
||||
tsx
|
||||
stx spsave ; save system stk ptr
|
||||
@@ -57,7 +57,7 @@ L1: lda sp,x
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp+1
|
||||
|
||||
; Setup the IRQ vector in the banked RAM and switch off the ROM
|
||||
; Set up the IRQ vector in the banked RAM; and, switch off the ROM.
|
||||
|
||||
ldx #<IRQ
|
||||
ldy #>IRQ
|
||||
@@ -67,35 +67,35 @@ L1: lda sp,x
|
||||
sty $FFFF
|
||||
cli ; Allow interrupts
|
||||
|
||||
; Clear the BSS data
|
||||
; Clear the BSS data.
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Initialize irqcount, which means that from now own custom linked in IRQ
|
||||
; handlers (via condes) will be called.
|
||||
; Initialize irqcount, which means that, from now on, custom linked-in IRQ
|
||||
; handlers will be called (via condes).
|
||||
|
||||
lda #.lobyte(__INTERRUPTOR_COUNT__*2)
|
||||
sta irqcount
|
||||
|
||||
; Call module constructors
|
||||
; Call the module constructors.
|
||||
|
||||
jsr initlib
|
||||
|
||||
; Push arguments and call main()
|
||||
; Push the command-line arguments; and, call main().
|
||||
|
||||
jsr callmain
|
||||
|
||||
; Back from main (this is also the _exit entry). Run module destructors.
|
||||
; Back from main() [this is also the exit() entry]. Run the module destructors.
|
||||
|
||||
_exit: pha ; Save the return code
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Disable chained IRQ handlers
|
||||
; Disable the chained IRQ handlers.
|
||||
|
||||
lda #0
|
||||
sta irqcount ; Disable custom IRQ handlers
|
||||
|
||||
; Copy back the zero page stuff
|
||||
; Copy back the zero-page stuff.
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
@@ -103,28 +103,28 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Place the program return code into ST
|
||||
; Place the program return code into BASIC's status variable.
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Restore the stack pointer
|
||||
; Restore the stack pointer.
|
||||
|
||||
ldx spsave
|
||||
txs
|
||||
|
||||
; Enable the ROM and return to BASIC
|
||||
; Enable the ROM; and, return to BASIC.
|
||||
|
||||
sta ENABLE_ROM
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; IRQ handler. The handler in the ROM enables the kernal and jumps to
|
||||
; $CE00, where the ROM code checks for a BRK or IRQ and branches via the
|
||||
; IRQ handler. The handler in the ROM enables the Kernal, and jumps to
|
||||
; $CE00, where the ROM code checks for a BRK or IRQ, and branches via the
|
||||
; indirect vectors at $314/$316.
|
||||
; To make our stub as fast as possible, we skip the whole part of the ROM
|
||||
; handler and jump to the indirect vectors directly. We do also call our
|
||||
; own interrupt handlers if we have any, so they need not use $314.
|
||||
; handler, and jump to the indirect vectors directly. We do also call our
|
||||
; own interrupt handlers if we have any; so, they need not use $314.
|
||||
|
||||
.segment "LOWCODE"
|
||||
|
||||
@@ -139,7 +139,7 @@ IRQ: cld ; Just to be sure
|
||||
and #$10 ; Test for BRK bit
|
||||
bne dobreak
|
||||
|
||||
; It's an IRQ and RAM is enabled. If we have handlers, call them. We will use
|
||||
; It's an IRQ; and, RAM is enabled. If we have handlers, call them. We will use
|
||||
; a flag here instead of loading __INTERRUPTOR_COUNT__ directly, since the
|
||||
; condes function is not reentrant. The irqcount flag will be set/reset from
|
||||
; the main code, to avoid races.
|
||||
@@ -149,8 +149,8 @@ IRQ: cld ; Just to be sure
|
||||
jsr callirq_y ; Call the IRQ functions
|
||||
|
||||
; Since the ROM handler will end with an RTI, we have to fake an IRQ return
|
||||
; on stack, so we get control of the CPU after the ROM handler and can switch
|
||||
; back to RAM.
|
||||
; on the stack, so that we get control of the CPU after the ROM handler,
|
||||
; and can switch back to RAM.
|
||||
|
||||
@L1: lda #>irq_ret ; Push new return address
|
||||
pha
|
||||
@@ -161,7 +161,7 @@ IRQ: cld ; Just to be sure
|
||||
pha ; Push faked X register
|
||||
pha ; Push faked Y register
|
||||
sta ENABLE_ROM ; Switch to ROM
|
||||
jmp (IRQVec) ; Jump indirect to kernal irq handler
|
||||
jmp (IRQVec) ; Jump indirect to Kernal IRQ handler
|
||||
|
||||
irq_ret:
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
@@ -177,7 +177,7 @@ dobreak:
|
||||
beq nohandler
|
||||
jmp brk_jmp ; Jump to the handler
|
||||
|
||||
; No break handler installed, jump to ROM
|
||||
; No break handler installed, jump to ROM.
|
||||
|
||||
nohandler:
|
||||
sta ENABLE_ROM
|
||||
|
||||
Reference in New Issue
Block a user