From: Greg King Date: Sat, 23 Aug 2014 18:05:36 +0000 (-0400) Subject: Refined the comments in the target start-up files. X-Git-Tag: V2.15~47^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F131%2Fhead;p=cc65 Refined the comments in the target start-up files. Fixed typo errors. Made the comments consistent across all those files. --- diff --git a/libsrc/apple2/crt0.s b/libsrc/apple2/crt0.s index a140a7249..4a7463b27 100644 --- a/libsrc/apple2/crt0.s +++ b/libsrc/apple2/crt0.s @@ -24,76 +24,76 @@ ldx #$FF txs ; Init stack pointer - ; Switch in LC bank 2 for W/O + ; Switch in LC bank 2 for W/O. bit $C081 bit $C081 - ; Set source start address + ; Set the source start address. lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__) ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__) sta $9B sty $9C - ; Set source last address + ; Set the source last address. lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__) ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__) sta $96 sty $97 - ; Set destination last address + ; Set the destination last address. lda #<__LC_LAST__ ldy #>__LC_LAST__ sta $94 sty $95 - ; Call into Applesoft Block Transfer Utility - which handles zero - ; sized blocks well - to move content of the LC memory area + ; Call into the Applesoft Block Transfer Utility -- which handles zero- + ; sized blocks well -- to move the content of the LC memory area. jsr $D396 ; BLTU + 3 - ; Set source start address + ; Set the source start address. lda #<__ZPSAVE_RUN__ ldy #>__ZPSAVE_RUN__ sta $9B sty $9C - ; Set source last address + ; Set the source last address. lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__) ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__) sta $96 sty $97 - ; Set destination last address + ; Set the destination last address. lda #<(__INIT_RUN__ + __INIT_SIZE__) ldy #>(__INIT_RUN__ + __INIT_SIZE__) sta $94 sty $95 - ; Call into Applesoft Block Transfer Utility - which handles moving - ; overlapping blocks upwards well - to move the INIT segment + ; Call into the Applesoft Block Transfer Utility -- which handles moving + ; overlapping blocks upwards well -- to move the INIT segment. jsr $D396 ; BLTU + 3 - ; Delegate all further processing to keep the STARTUP segment small + ; Delegate all further processing, to keep the STARTUP segment small. jsr init - ; Avoid re-entrance of donelib. This is also the _exit entry + ; Avoid a re-entrance of donelib. This is also the exit() entry. _exit: ldx #exit jsr reset ; Setup RESET vector - ; Switch in ROM in case it wasn't already switched in by a RESET + ; Switch in ROM, in case it wasn't already switched in by a RESET. bit $C082 - ; Call module destructors + ; Call the module destructors. jsr donelib - ; Restore the original RESET vector + ; Restore the original RESET vector. exit: ldx #$02 : lda rvsave,x sta SOFTEV,x dex bpl :- - ; Copy back the zero page stuff + ; Copy back the zero-page stuff. ldx #zpspace-1 : lda zpsave,x sta sp,x @@ -111,17 +111,17 @@ exit: ldx #$02 .segment "INIT" - ; Save the zero page locations we need + ; Save the zero-page locations that we need. init: ldx #zpspace-1 : lda sp,x sta zpsave,x dex bpl :- - ; Clear the BSS data + ; Clear the BSS data. jsr zerobss - ; Save the original RESET vector + ; Save the original RESET vector. ldx #$02 : lda SOFTEV,x sta rvsave,x @@ -135,58 +135,58 @@ init: ldx #zpspace-1 lda #>_exit jsr reset ; Setup RESET vector - ; Check for ProDOS + ; Check for ProDOS. ldy $BF00 ; MLI call entry point cpy #$4C ; Is MLI present? (JMP opcode) bne basic - - ; Check ProDOS system bit map + + ; Check the ProDOS system bit map. lda $BF6F ; Protection for pages $B8 - $BF cmp #%00000001 ; Exactly system global page is protected bne basic - ; No BASIC.SYSTEM so quit to ProDOS dispatcher instead + ; No BASIC.SYSTEM; so, quit to the ProDOS dispatcher instead. lda #quit sta done+1 stx done+2 - - ; No BASIC.SYSTEM so use addr of ProDOS system global page + + ; No BASIC.SYSTEM; so, use the addr of the ProDOS system global page. lda #<$BF00 ldx #>$BF00 bne :+ ; Branch always - ; Get highest available mem addr from BASIC interpreter + ; Get the highest available mem addr from the BASIC interpreter. basic: lda HIMEM ldx HIMEM+1 - ; Setup the C stack + ; Set up the C stack. : sta sp stx sp+1 - ; Enable interrupts as old ProDOS versions (i.e. 1.1.1) - ; jump to SYS and BIN programs with interrupts disabled + ; Enable interrupts, as old ProDOS versions (i.e. 1.1.1) + ; jump to SYS and BIN programs with interrupts disabled. cli - ; Call module constructors + ; Call the module constructors. jsr initlib - ; Switch in LC bank 2 for R/O + ; Switch in LC bank 2 for R/O. bit $C080 - ; Push arguments and call main() + ; Push the command-line arguments; and, call main(). jmp callmain .code - ; Setup RESET vector + ; Set up the RESET vector. reset: stx SOFTEV sta SOFTEV+1 eor #$A5 sta PWREDUP return: rts - ; Quit to ProDOS dispatcher + ; Quit to the ProDOS dispatcher. quit: jsr $BF00 ; MLI call entry point .byte $65 ; Quit .word q_param diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index f1c7b864e..0ea6e390f 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -32,8 +32,8 @@ .segment "STARTUP" rts ; fix for SpartaDOS / OS/A+ - ; they first call the entry point from AUTOSTRT and - ; then the load addess (this rts here). + ; They first call the entry point from AUTOSTRT; and + ; then, the load address (this rts here). ; We point AUTOSTRT directly after the rts. ; Real entry point: @@ -44,11 +44,11 @@ start: jsr sram_init .endif -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Setup the stack +; Set up the stack. tsx stx SP_save @@ -62,7 +62,7 @@ start: .else -; Report memory usage +; Report the memory usage. lda APPMHI sta APPMHI_save ; remember old APPMHI value @@ -73,60 +73,60 @@ start: lda MEMTOP sbc #<__RESERVED_MEMORY__ sta APPMHI ; initialize our APPMHI value - sta sp ; setup runtime stack part 1 + sta sp ; set up runtime stack part 1 lda MEMTOP+1 sbc #>__RESERVED_MEMORY__ sta APPMHI+1 - sta sp+1 ; setup runtime stack part 2 + sta sp+1 ; set up runtime stack part 2 .endif -; Call module constructors +; Call the module constructors. jsr initlib -; Set left margin to 0 +; Set the left margin to 0. lda LMARGN sta LMARGN_save ldy #0 sty LMARGN -; Set keyb to upper/lowercase mode +; Set the keyboard to upper-/lower-case mode. ldx SHFLOK stx SHFLOK_save sty SHFLOK -; Initialize conio stuff +; Initialize the conio stuff. dey ; Set Y to $FF sty CH ; remove keypress which might be in the input buffer -; Push arguments and call main +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: jsr donelib ; Run module destructors -; Restore system stuff +; Restore the system stuff. ldx SP_save txs ; Restore stack pointer -; Restore left margin +; Restore the left margin. lda LMARGN_save sta LMARGN -; Restore kb mode +; Restore the kb mode. lda SHFLOK_save sta SHFLOK -; Restore APPMHI +; Restore APPMHI. lda APPMHI_save sta APPMHI @@ -147,8 +147,8 @@ _exit: jsr donelib ; Run module destructors sta MEMTOP+1 -; Issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers) in -; order to restore screen memory to its defailt location just +; Issue a GRAPHICS 0 call (copied'n'pasted from the TGI drivers), in +; order to restore screen memory to its default location just ; before the ROM. jsr findfreeiocb @@ -169,7 +169,7 @@ _exit: jsr donelib ; Run module destructors lda #0 sta ICBLH,x jsr CIOV_org -; No error checking here, shouldn't happen(tm), and no way to +; No error checking here, shouldn't happen(TM); and, no way to ; recover anyway. lda #CLOSE @@ -178,12 +178,12 @@ _exit: jsr donelib ; Run module destructors .endif -; Turn on cursor +; Turn on the cursor. ldx #0 stx CRSINH -; Back to DOS +; Back to DOS. rts diff --git a/libsrc/atari5200/crt0.s b/libsrc/atari5200/crt0.s index a62d69703..7073bb2a7 100644 --- a/libsrc/atari5200/crt0.s +++ b/libsrc/atari5200/crt0.s @@ -17,29 +17,29 @@ start: -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; initialize data +; Initialize the data. jsr copydata -; setup the stack +; Set up the stack. lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) sta sp lda #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) sta sp+1 ; Set argument stack ptr -; Call module constructors +; Call the module constructors. jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: jsr donelib ; Run module destructors diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index cd104decd..9bfdca49f 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -22,21 +22,21 @@ Start: -; Switch to the second charset +; Switch to the second charset. lda #14 jsr BSOUT -; Before doing anything else, we have to setup our banking configuration. -; Otherwise just the lowest 16K are actually RAM. Writing through the ROM -; to the underlying RAM works, but it is bad style. +; Before doing anything else, we have to set up our banking configuration. +; Otherwise, just the lowest 16K are actually RAM. Writing through the ROM +; to the underlying RAM works; but, it is bad style. lda MMU_CR ; Get current memory configuration... pha ; ...and save it for later - lda #MMU_CFG_CC65 ; Bank0 with kernal ROM + lda #MMU_CFG_CC65 ; Bank0 with Kernal ROM sta MMU_CR -; Save the zero page locations we need +; Save the zero-page locations that we need. ldx #zpspace-1 L1: lda sp,x @@ -44,11 +44,11 @@ L1: lda sp,x dex bpl L1 -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Save system stuff and setup the stack +; Save some system stuff; and, set up the stack. pla ; Get MMU setting sta mmusave @@ -61,27 +61,27 @@ L1: lda sp,x lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp+1 ; Set argument stack ptr -; Call module constructors +; Call the module constructors. jsr initlib -; Set the bank for the file name to our execution bank. We must do this, -; *after* calling constructors, because some of them may depend on the -; original value of this register. +; Set the bank for the file name to our execution bank. We must do this +; *after* calling the constructors because some of them might depend on +; the original value of this register. lda #0 sta FNAM_BANK -; 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 on stack jsr donelib -; Copy back the zero page stuff +; Copy back the zero-page stuff. ldx #zpspace-1 L2: lda zpsave,x @@ -89,19 +89,19 @@ 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 -; Reset the stack and the memory configuration +; Reset the stack and the memory configuration. ldx spsave txs ldx mmusave stx MMU_CR -; Done, return to BASIC +; Done, return to BASIC. rts diff --git a/libsrc/c16/crt0.s b/libsrc/c16/crt0.s index 2875aff49..0180ad671 100644 --- a/libsrc/c16/crt0.s +++ b/libsrc/c16/crt0.s @@ -1,8 +1,8 @@ ; ; Startup code for cc65 (C16 version) ; -; Note: The C16 is actually the Plus/4 with just 16KB of memory. So many -; things are similar here, and we even use the plus4.inc include file. +; Note: The C16 is actually the Plus/4 with just 16KB of memory. So, many +; things are similar here; and, we even use the plus4.inc include file. ; .export _exit @@ -22,7 +22,7 @@ Start: -; Save the zero page locations we need +; Save the zero-page locations that we need. ldx #zpspace-1 L1: lda sp,x @@ -30,16 +30,16 @@ L1: lda sp,x dex bpl L1 -; Switch to second charset +; Switch to the second charset. lda #14 jsr BSOUT -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Save system stuff and setup the stack +; Save some system stuff; and, set up the stack. tsx stx spsave ; save system stk ptr @@ -53,20 +53,20 @@ L1: lda sp,x MemOk: stx sp sty sp+1 ; set argument stack ptr -; Call module constructors +; Call the module constructors. jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: pha ; Save the return code on stack jsr donelib ; Run module destructors -; Copy back the zero page stuff +; Copy back the zero-page stuff. ldx #zpspace-1 L2: lda zpsave,x @@ -74,17 +74,17 @@ L2: lda zpsave,x dex bpl L2 -; Store the return code into ST +; Store the return code into BASIC's status variable. pla sta ST -; Restore the stack pointer +; Restore the stack pointer. ldx spsave txs -; Back to BASIC +; Back to BASIC. rts diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index ab44e9033..24fe4376b 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -23,7 +23,7 @@ Start: -; Save the zero page locations we need +; Save the zero-page locations that we need. ldx #zpspace-1 L1: lda sp,x @@ -31,24 +31,24 @@ L1: lda sp,x dex bpl L1 -; Switch to second charset +; Switch to the second charset. lda #14 jsr BSOUT -; Switch off the BASIC ROM +; Switch off the BASIC ROM. lda $01 pha ; Remember the value and #$F8 - ora #$06 ; Enable kernal+I/O, disable basic + ora #$06 ; Enable Kernal+I/O, disable BASIC sta $01 -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Save system settings and setup the stack +; Save some system settings; and, set up the stack. pla sta mmusave ; Save the memory configuration @@ -61,20 +61,20 @@ L1: lda sp,x lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp+1 ; Set argument stack ptr -; 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 on stack jsr donelib -; Copy back the zero page stuff +; Copy back the zero-page stuff. ldx #zpspace-1 L2: lda zpsave,x @@ -82,19 +82,19 @@ 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 system stuff +; Restore the system stuff. ldx spsave txs ; Restore stack pointer ldx mmusave stx $01 ; Restore memory configuration -; Back to basic +; Back to BASIC. rts diff --git a/libsrc/cbm510/crt0.s b/libsrc/cbm510/crt0.s index 836038a06..86137b1ca 100644 --- a/libsrc/cbm510/crt0.s +++ b/libsrc/cbm510/crt0.s @@ -18,14 +18,14 @@ ; ------------------------------------------------------------------------ -; BASIC header and a small BASIC program. Since it is not possible to start +; The BASIC header and a small BASIC program. Since it isn't possible to start ; programs in other banks using SYS, the BASIC program will write a small -; machine code program into memory at $100 and start that machine code +; machine code program into memory at $100; and, start that machine code ; program. The machine code program will then start the machine language ; code in bank 0, which will initialize the system by copying stuff from ; the system bank, and start the application. ; -; Here's the basic program that's in the following lines: +; Here's the BASIC program that's in the following lines: ; ; 10 for i=0 to 4 ; 20 read j @@ -40,9 +40,9 @@ ; lda #$00 ; sta $00 <-- Switch to bank 0 after this command ; -; Initialization is not only complex because of the jumping from one bank -; into another. but also because we want to save memory, and because of -; this, we will use the system memory ($00-$3FF) for initialization stuff +; Initialization is complex not only because of the jumping from one bank +; into another, but also because we want to save memory; and because of +; that, we will use the system memory ($00-$3FF) for initialization stuff ; that is overwritten later. ; @@ -55,13 +55,15 @@ .byte $30,$2c,$31,$36,$39,$2c,$30,$2c,$31,$33,$33,$2c,$30,$00,$00,$00 ;------------------------------------------------------------------------------ -; A table that contains values that must be transfered from the system zero -; page into our zero page. Contains pairs of bytes; first one is the address -; in the system ZP, second one is our ZP address. The table goes into page 2, -; but is declared here because it is needed earlier. +; A table that contains values that must be transferred from the system zero- +; page into our zero-page. Contains pairs of bytes; first one is the address +; in the system ZP, second one is our ZP address. The table goes into page 2; +; but, is declared here because it is needed earlier. .SEGMENT "PAGE2" +; (We use .proc because we need both a label and a scope.) + .proc transfer_table .byte $9F, DEVNUM @@ -78,7 +80,7 @@ ; Page 3 data. This page contains the break vector and the bankswitch ; subroutine that is copied into high memory on startup. The space occupied by ; this routine will later be used for a copy of the bank 15 stack. It must be -; saved, since we're going to destroy it when calling bank 15. +; saved since we're going to destroy it when calling bank 15. .segment "PAGE3" @@ -92,7 +94,7 @@ BRKVec: .addr _exit ; BRK indirect vector entry: php pha - lda #$0F ; Bank 15 + lda #$0F ; Bank 15 sta IndReg txa pha @@ -115,7 +117,7 @@ entry: php tya sec sbc #7 - sta $1FF ; Save new sp + sta $1FF ; Save new sp tay tsx @@ -143,7 +145,7 @@ entry: php iny sta (sysp1),y - ldy $1FF ; Restore sp in bank 15 + ldy $1FF ; Restore sp in bank 15 lda #.hibyte(expull-1) sta (sysp1),y @@ -170,7 +172,7 @@ expull: pla rts .if (expull <> $FF26) -.error "Symbol expull must be aligned with kernal in bank 15" +.error "Symbol expull must be aligned with Kernal in bank 15" .endif .reloc @@ -180,15 +182,15 @@ expull: pla ;------------------------------------------------------------------------------ ; The code in the target bank when switching back will be put at the bottom ; of the stack. We will jump here to switch segments. The range $F2..$FF is -; not used by any kernal routine. +; not used by any Kernal routine. .segment "STARTUP" Back: sta ExecReg ; We are at $100 now. The following snippet is a copy of the code that is poked -; in the system bank memory by the basic header program, it's only for -; documentation and not actually used here: +; in the system bank memory by the BASIC header program; it's only for +; documentation, and not actually used here: sei lda #$00 @@ -196,23 +198,23 @@ Back: sta ExecReg ; This is the actual starting point of our code after switching banks for ; startup. Beware: The following code will get overwritten as soon as we -; use the stack (since it's in page 1)! We jump to another location, since +; use the stack (since it's in page 1)! We jump to another location since ; we need some space for subroutines that aren't used later. jmp Origin -; Hardware vectors, copied to $FFFA +; Hardware vectors, copied to $FFF6 .proc vectors sta ExecReg rts nop .word nmi ; NMI vector - .word 0 ; Reset - not used + .word 0 ; Reset -- not used .word irq ; IRQ vector .endproc -; Initializers for the extended zeropage. See extzp.s +; Initializers for the extended zero-page. See "extzp.s". .proc extzp .word $0100 ; sysp1 @@ -230,12 +232,12 @@ Back: sta ExecReg .word $ebd1 ; ktab4 .endproc -; Switch the indirect segment to the system bank +; Switch the indirect segment to the system bank. Origin: lda #$0F sta IndReg -; Initialize the extended zeropage +; Initialize the extended zero-page. ldx #.sizeof(extzp)-1 L1: lda extzp,x @@ -243,16 +245,16 @@ L1: lda extzp,x dex bpl L1 -; Save the old stack pointer from the system bank and setup our hw sp +; Save the old stack pointer from the system bank; and, set up our hw sp. tsx txa ldy #$FF sta (sysp1),y ; Save system stack point into $F:$1FF - ldx #$FE ; Leave $1FF untouched for cross bank calls + ldx #$FE ; Leave $1FF untouched for cross-bank calls txs ; Set up our own stack -; Copy stuff from the system zeropage to ours +; Copy stuff from the system zero-page to ours. lda #.sizeof(transfer_table) sta ktmp @@ -266,7 +268,7 @@ L2: ldx ktmp dec ktmp bne L2 -; Set the interrupt, NMI and other vectors +; Set the interrupt, NMI, and other vectors. ldx #.sizeof(vectors)-1 L3: lda vectors,x @@ -274,14 +276,14 @@ L3: lda vectors,x dex bpl L3 -; Setup the C stack +; Set up the C stack. lda #.lobyte(callbank15::entry) sta sp lda #.hibyte(callbank15::entry) sta sp+1 -; Setup the subroutine and jump vector table that redirects kernal calls to +; Set up the subroutine and jump vector table that redirects Kernal calls to ; the system bank. ldy #.sizeof(callbank15) @@ -290,10 +292,10 @@ L3: lda vectors,x dey bne @L1 -; Setup the jump vector table. Y is zero on entry. +; Set up the jump vector table. Y is zero on entry. - ldx #45-1 ; Number of vectors -@L2: lda #$20 ; JSR opcode + ldx #45-1 ; Number of vectors +@L2: lda #$20 ; JSR opcode sta $FF6F,y iny lda #.lobyte(callbank15::entry) @@ -305,13 +307,13 @@ L3: lda vectors,x dex bpl @L2 -; Set the indirect segment to bank we're executing in +; Set the indirect segment to the bank that we're executing in. lda ExecReg sta IndReg -; Zero the BSS segment. We will do that here instead calling the routine -; in the common library, since we have the memory anyway, and this way, +; Zero the BSS segment. We will do that here instead of calling the routine +; in the common library, since we have the memory anyway; and this way, ; it's reused later. lda #<__BSS_RUN__ @@ -321,18 +323,18 @@ L3: lda vectors,x lda #0 tay -; Clear full pages +; Clear full pages. ldx #>__BSS_SIZE__ beq Z2 Z1: sta (ptr1),y iny bne Z1 - inc ptr1+1 ; Next page + inc ptr1+1 ; Next page dex bne Z1 -; Clear the remaining page +; Clear the remaining page. Z2: ldx #<__BSS_SIZE__ beq Z4 @@ -343,12 +345,12 @@ Z3: sta (ptr1),y Z4: jmp Init ; ------------------------------------------------------------------------ -; We are at $200 now. We may now start calling subroutines safely, since +; We are at $200 now. We may now start calling subroutines safely since ; the code we execute is no longer in the stack page. .segment "PAGE2" -; Copy the character rom from the system bank into the execution bank +; Copy the character ROM from the system bank into the execution bank. Init: lda #<$C000 sta ptr1 @@ -362,7 +364,7 @@ Init: lda #<$C000 sta tmp1 ldy #$00 ccopy: lda #$0F - sta IndReg ; Access the system bank + sta IndReg ; Access the system bank ccopy1: lda (ptr1),y sta __VIDRAM_START__,y iny @@ -374,22 +376,22 @@ ccopy2: lda __VIDRAM_START__,y iny bne ccopy2 inc ptr1+1 - inc ptr2+1 ; Bump high pointer bytes + inc ptr2+1 ; Bump high pointer bytes dec tmp1 bne ccopy -; Clear the video memory. We will do this before switching the video to bank 0 +; Clear the video memory. We will do this before switching the video to bank 0, ; to avoid garbage when doing so. jsr _clrscr -; Reprogram the VIC so that the text screen and the character ROM is in the +; Reprogram the VIC so that the text screen and the character ROM are in the ; execution bank. This is done in three steps: - lda #$0F ; We need access to the system bank + lda #$0F ; We need access to the system bank sta IndReg -; Place the VIC video RAM into bank 0 +; Place the VIC video RAM into bank 0. ; CA (STATVID) = 0 ; CB (VICDOTSEL) = 0 @@ -400,7 +402,7 @@ ccopy2: lda __VIDRAM_START__,y ora #%10100000 sta (tpi1),y -; Set bit 14/15 of the VIC address range to the high bits of __VIDRAM_START__ +; Set bit 14/15 of the VIC address range to the high bits of __VIDRAM_START__. ; PC6/PC7 (VICBANKSEL 0/1) = 11 ldy #TPI::PRC @@ -422,12 +424,12 @@ ccopy2: lda __VIDRAM_START__,y ; ora #<(((>__VIDRAM_START__) << 2) & $F0) sta (vic),y -; Switch back to the execution bank +; Switch back to the execution bank. lda ExecReg sta IndReg -; Activate chained interrupt handlers, then enable interrupts. +; Activate the chained interrupt handlers; then, enable interrupts. lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount @@ -437,11 +439,11 @@ ccopy2: lda __VIDRAM_START__,y jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry and the default entry +; Call the module destructors. This is also the exit() entry and the default entry ; point for the break vector. _exit: pha ; Save the return code on stack @@ -449,12 +451,12 @@ _exit: pha ; Save the return code on stack lda #$00 sta irqcount ; Disable custom irq handlers -; Address the system bank +; Address the system bank. lda #$0F sta IndReg -; Switch back the video to the system bank +; Switch back the video to the system bank. ldy #TPI::CR lda vidsave+0 @@ -468,7 +470,7 @@ _exit: pha ; Save the return code on stack lda vidsave+2 sta (vic),y -; Copy stuff back from our zeropage to the systems +; Copy stuff back from our zero-page to the system's. .if 0 lda #.sizeof(transfer_table) @@ -484,13 +486,13 @@ _exit: pha ; Save the return code on stack bne @L0 .endif -; Place the program return code into ST +; Place the program return code into BASIC's status variable. pla ldy #$9C ; ST sta (sysp0),y -; Setup the welcome code at the stack bottom in the system bank. +; Set up the welcome code at the stack bottom in the system bank. ldy #$FF lda (sysp1),y ; Load system bank sp @@ -511,14 +513,14 @@ _exit: pha ; Save the return code on stack ; easier chaining, we do handle the IRQs in the execution bank (instead of ; passing them to the system bank). -; This is the mapping of the active irq register of the 6525 (tpi1): +; This is the mapping of the active IRQ register of the 6525 (tpi1): ; ; Bit 7 6 5 4 3 2 1 0 -; | | | | ^ 50 Hz +; | | | | ^ 50 Hz. ; | | | ^ SRQ IEEE 488 -; | | ^ cia +; | | ^ CIA ; | ^ IRQB ext. Port -; ^ acia +; ^ ACIA irq: pha txa @@ -528,41 +530,41 @@ irq: pha lda IndReg pha lda ExecReg - sta IndReg ; Be sure to address our segment + sta IndReg ; Be sure to address our segment tsx - lda $105,x ; Get the flags from the stack - and #$10 ; Test break flag + lda $105,x ; Get the flags from the stack + and #$10 ; Test break flag bne dobrk -; It's an IRQ +; It's an IRQ. cld -; Call chained IRQ handlers +; Call the chained IRQ handlers. ldy irqcount beq irqskip - jsr callirq_y ; Call the functions + jsr callirq_y ; Call the functions -; Done with chained IRQ handlers, check the TPI for IRQs and handle them +; Done with the chained IRQ handlers; check the TPI for IRQs, and handle them. irqskip:lda #$0F sta IndReg ldy #TPI::AIR - lda (tpi1),y ; Interrupt Register 6525 + lda (tpi1),y ; Interrupt Register 6525 beq noirq -; 50/60Hz interrupt +; 50/60Hz. interrupt - cmp #%00000001 ; ticker irq? + cmp #%00000001 ; ticker IRQ? bne irqend - jsr scnkey ; Poll the keyboard - jsr UDTIM ; Bump the time + jsr scnkey ; Poll the keyboard + jsr UDTIM ; Bump the time -; Done +; Done. irqend: ldy #TPI::AIR - sta (tpi1),y ; Clear interrupt + sta (tpi1),y ; Clear interrupt noirq: pla sta IndReg @@ -583,5 +585,3 @@ vidsave:.res 3 .bss irqcount: .byte 0 - - diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index cc59148cc..0ad343d7f 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -17,14 +17,14 @@ ; ------------------------------------------------------------------------ -; BASIC header and a small BASIC program. Since it is not possible to start +; The BASIC header and a small BASIC program. Since it isn't possible to start ; programs in other banks using SYS, the BASIC program will write a small -; machine code program into memory at $100 and start that machine code +; machine code program into memory at $100; and, start that machine code ; program. The machine code program will then start the machine language ; code in bank 1, which will initialize the system by copying stuff from ; the system bank, and start the application. ; -; Here's the basic program that's in the following lines: +; Here's the BASIC program that's in the following lines: ; ; 10 for i=0 to 4 ; 20 read j @@ -39,9 +39,9 @@ ; lda #$01 ; sta $00 <-- Switch to bank 1 after this command ; -; Initialization is not only complex because of the jumping from one bank -; into another. but also because we want to save memory, and because of -; this, we will use the system memory ($00-$3FF) for initialization stuff +; Initialization is complex not only because of the jumping from one bank +; into another. but also because we want to save memory; and because of +; that, we will use the system memory ($00-$3FF) for initialization stuff ; that is overwritten later. ; @@ -54,13 +54,15 @@ .byte $30,$2c,$31,$36,$39,$2c,$31,$2c,$31,$33,$33,$2c,$30,$00,$00,$00 ;------------------------------------------------------------------------------ -; A table that contains values that must be transfered from the system zero -; page into out zero page. Contains pairs of bytes, first one is the address -; in the system ZP, second one is our ZP address. The table goes into page 2, -; but is declared here, because it is needed earlier. +; A table that contains values that must be transferred from the system zero- +; page into our zero-page. Contains pairs of bytes, first one is the address +; in the system ZP, second one is our ZP address. The table goes into page 2; +; but, is declared here because it is needed earlier. .SEGMENT "PAGE2" +; (We use .proc because we need both a label and a scope.) + .proc transfer_table .byte $9F, DEVNUM @@ -76,7 +78,7 @@ ; Page 3 data. This page contains the break vector and the bankswitch ; subroutine that is copied into high memory on startup. The space occupied by ; this routine will later be used for a copy of the bank 15 stack. It must be -; saved, since we're going to destroy it when calling bank 15. +; saved since we're going to destroy it when calling bank 15. .segment "PAGE3" @@ -84,13 +86,13 @@ BRKVec: .addr _exit ; BRK indirect vector .proc callbank15 - excrts := $FF05 ; In bank 15 rom + excrts := $FF05 ; In bank 15 ROM .org $FECB entry: php pha - lda #$0F ; Bank 15 + lda #$0F ; Bank 15 sta IndReg txa pha @@ -113,7 +115,7 @@ entry: php tya sec sbc #7 - sta $1FF ; Save new sp + sta $1FF ; Save new sp tay tsx @@ -141,7 +143,7 @@ entry: php iny sta (sysp1),y - ldy $1FF ; Restore sp in bank 15 + ldy $1FF ; Restore sp in bank 15 lda #.hibyte(expull-1) sta (sysp1),y @@ -168,7 +170,7 @@ expull: pla rts .if (expull <> $FF2E) -.error "Symbol expull must be aligned with kernal in bank 15" +.error "Symbol expull must be aligned with Kernal in bank 15" .endif .reloc @@ -178,15 +180,15 @@ expull: pla ;------------------------------------------------------------------------------ ; The code in the target bank when switching back will be put at the bottom ; of the stack. We will jump here to switch segments. The range $F2..$FF is -; not used by any kernal routine. +; not used by any Kernal routine. .segment "STARTUP" Back: sta ExecReg ; We are at $100 now. The following snippet is a copy of the code that is poked -; in the system bank memory by the basic header program, it's only for -; documentation and not actually used here: +; in the system bank memory by the BASIC header program; it's only for +; documentation, and not actually used here: sei lda #$01 @@ -194,7 +196,7 @@ Back: sta ExecReg ; This is the actual starting point of our code after switching banks for ; startup. Beware: The following code will get overwritten as soon as we -; use the stack (since it's in page 1)! We jump to another location, since +; use the stack (since it's in page 1)! We jump to another location since ; we need some space for subroutines that aren't used later. jmp Origin @@ -206,11 +208,11 @@ Back: sta ExecReg rts nop .word nmi ; NMI vector - .word 0 ; Reset - not used + .word 0 ; Reset -- not used .word irq ; IRQ vector .endproc -; Initializers for the extended zeropage. See extzp.s +; Initializers for the extended zero-page. See "extzp.s". .proc extzp .word $0100 ; sysp1 @@ -228,12 +230,12 @@ Back: sta ExecReg .word $eb49 ; ktab4 .endproc -; Switch the indirect segment to the system bank +; Switch the indirect segment to the system bank. Origin: lda #$0F sta IndReg -; Initialize the extended zeropage +; Initialize the extended zero-page. ldx #.sizeof(extzp)-1 L1: lda extzp,x @@ -241,16 +243,16 @@ L1: lda extzp,x dex bpl L1 -; Save the old stack pointer from the system bank and setup our hw sp +; Save the old stack pointer from the system bank; and, set up our hw sp. tsx txa ldy #$FF sta (sysp1),y ; Save system stack point into $F:$1FF - ldx #$FE ; Leave $1FF untouched for cross bank calls + ldx #$FE ; Leave $1FF untouched for cross-bank calls txs ; Set up our own stack -; Copy stuff from the system zeropage to ours +; Copy stuff from the system zero-page to ours. lda #.sizeof(transfer_table) sta ktmp @@ -264,7 +266,7 @@ L2: ldx ktmp dec ktmp bne L2 -; Set the interrupt, NMI and other vectors +; Set the interrupt, NMI, and other vectors. ldx #.sizeof(vectors)-1 L3: lda vectors,x @@ -272,14 +274,14 @@ L3: lda vectors,x dex bpl L3 -; Setup the C stack +; Set up the C stack. lda #.lobyte(callbank15::entry) sta sp lda #.hibyte(callbank15::entry) sta sp+1 -; Setup the subroutine and jump vector table that redirects kernal calls to +; Set up the subroutine and jump vector table that redirects Kernal calls to ; the system bank. ldy #.sizeof(callbank15) @@ -288,10 +290,10 @@ L3: lda vectors,x dey bne @L1 -; Setup the jump vector table. Y is zero on entry. +; Set up the jump vector table. Y is zero on entry. - ldx #45-1 ; Number of vectors -@L2: lda #$20 ; JSR opcode + ldx #45-1 ; Number of vectors +@L2: lda #$20 ; JSR opcode sta $FF6F,y iny lda #.lobyte(callbank15::entry) @@ -303,13 +305,13 @@ L3: lda vectors,x dex bpl @L2 -; Set the indirect segment to bank we're executing in +; Set the indirect segment to the bank that we're executing in. lda ExecReg sta IndReg -; Zero the BSS segment. We will do that here instead calling the routine -; in the common library, since we have the memory anyway, and this way, +; Zero the BSS segment. We will do that here instead of calling the routine +; in the common library, since we have the memory anyway; and this way, ; it's reused later. lda #<__BSS_RUN__ @@ -319,18 +321,18 @@ L3: lda vectors,x lda #0 tay -; Clear full pages +; Clear full pages. ldx #>__BSS_SIZE__ beq Z2 Z1: sta (ptr1),y iny bne Z1 - inc ptr1+1 ; Next page + inc ptr1+1 ; Next page dex bne Z1 -; Clear the remaining page +; Clear the remaining page. Z2: ldx #<__BSS_SIZE__ beq Z4 @@ -341,12 +343,12 @@ Z3: sta (ptr1),y Z4: jmp Init ; ------------------------------------------------------------------------ -; We are at $200 now. We may now start calling subroutines safely, since +; We are at $200 now. We may now start calling subroutines safely since ; the code we execute is no longer in the stack page. .segment "PAGE2" -; Activate chained interrupt handlers, then enable interrupts. +; Activate the chained interrupt handlers; then, enable interrupts. Init: lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount @@ -356,11 +358,11 @@ Init: lda #.lobyte(__INTERRUPTOR_COUNT__*2) jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry and the default entry +; Call the module destructors. This is also the exit() entry and the default entry ; point for the break vector. _exit: pha ; Save the return code @@ -368,12 +370,12 @@ _exit: pha ; Save the return code lda #$00 sta irqcount ; Disable custom irq handlers -; Address the system bank +; Address the system bank. lda #$0F sta IndReg -; Copy stuff back from our zeropage to the systems +; Copy stuff back from our zero-page to the system's. .if 0 lda #.sizeof(transfer_table) @@ -389,13 +391,13 @@ _exit: pha ; Save the return code bne @L0 .endif -; Place the program return code into ST +; Place the program return code into BASIC's status variable. pla ldy #$9C ; ST sta (sysp0),y -; Setup the welcome code at the stack bottom in the system bank. +; Set up the welcome code at the stack bottom in the system bank. ldy #$FF lda (sysp1),y ; Load system bank sp @@ -416,14 +418,14 @@ _exit: pha ; Save the return code ; easier chaining, we do handle the IRQs in the execution bank (instead of ; passing them to the system bank). -; This is the mapping of the active irq register of the 6525 (tpi1): +; This is the mapping of the active IRQ register of the 6525 (tpi1): ; ; Bit 7 6 5 4 3 2 1 0 -; | | | | ^ 50 Hz +; | | | | ^ 50 Hz. ; | | | ^ SRQ IEEE 488 -; | | ^ cia +; | | ^ CIA ; | ^ IRQB ext. Port -; ^ acia +; ^ ACIA irq: pha txa @@ -433,41 +435,41 @@ irq: pha lda IndReg pha lda ExecReg - sta IndReg ; Be sure to address our segment + sta IndReg ; Be sure to address our segment tsx - lda $105,x ; Get the flags from the stack - and #$10 ; Test break flag + lda $105,x ; Get the flags from the stack + and #$10 ; Test break flag bne dobrk -; It's an IRQ +; It's an IRQ. cld -; Call chained IRQ handlers +; Call the chained IRQ handlers. ldy irqcount beq irqskip - jsr callirq_y ; Call the functions + jsr callirq_y ; Call the functions -; Done with chained IRQ handlers, check the TPI for IRQs and handle them +; Done with the chained IRQ handlers; check the TPI for IRQs, and handle them. irqskip:lda #$0F sta IndReg ldy #TPI::AIR - lda (tpi1),y ; Interrupt Register 6525 + lda (tpi1),y ; Interrupt Register 6525 beq noirq -; 50/60Hz interrupt +; 50/60Hz. interrupt - cmp #%00000001 ; ticker irq? + cmp #%00000001 ; ticker IRQ? bne irqend - jsr scnkey ; Poll the keyboard - jsr UDTIM ; Bump the time + jsr scnkey ; Poll the keyboard + jsr UDTIM ; Bump the time -; Done +; Done. irqend: ldy #TPI::AIR - sta (tpi1),y ; Clear interrupt + sta (tpi1),y ; Clear interrupt noirq: pla sta IndReg @@ -481,8 +483,7 @@ nmi: rti dobrk: jmp (BRKVec) ; ------------------------------------------------------------------------- -; Data area. +; Data area .bss irqcount: .byte 0 - diff --git a/libsrc/geos-common/system/crt0.s b/libsrc/geos-common/system/crt0.s index 0e82031af..47cec74f2 100644 --- a/libsrc/geos-common/system/crt0.s +++ b/libsrc/geos-common/system/crt0.s @@ -1,5 +1,5 @@ ; -; Startup code for geos +; Startup code for GEOS ; ; Maciej 'YTM/Elysium' Witkowiak ; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002 @@ -23,9 +23,9 @@ .segment "STARTUP" ; GEOS 64/128 initializes the screen before starting an application while -; Apple GEOS does not. In order to provide identical startup conditions -; we initialize the screen here on Apple GEOS. For the same reason we set -; the pattern and dispBufferOn even on GEOS 64/128 although we don't use +; Apple GEOS does not. In order to provide identical startup conditions, +; we initialize the screen here, on Apple GEOS. For the same reason, we set +; the pattern and dispBufferOn, even on GEOS 64/128, although we don't use ; them here. lda #2 ; Checkerboard pattern @@ -44,23 +44,23 @@ jsr zerobss -; Setup stack. +; Set up the stack. lda #<(__STACKADDR__ + __STACKSIZE__) ldx #>(__STACKADDR__ + __STACKSIZE__) sta sp stx sp+1 -; Call module constructors. +; Call the module constructors. jsr initlib -; Push arguments and call main(). +; Push the command-line arguments; and, call main(). cli jsr callmain -; Call module destructors. +; Call the module destructors. _exit: jsr donelib diff --git a/libsrc/lynx/crt0.s b/libsrc/lynx/crt0.s index 116b39f76..725f74ebd 100644 --- a/libsrc/lynx/crt0.s +++ b/libsrc/lynx/crt0.s @@ -9,9 +9,9 @@ ; ; *** ; -; Startup code for cc65 (Lynx version). Based on Atari 8-bit startup +; Startup code for cc65 (Lynx version). Based on the Atari 8-bit startup ; code structure. The C stack is located at the end of the RAM memory -; segment and grows downward. Bastian Schick's executable header is put +; segment, and grows downward. Bastian Schick's executable header is put ; on the front of the fully linked binary (see EXEHDR segment.) ; @@ -44,19 +44,19 @@ MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$2 .segment "STARTUP" -; set up system +; Set up the system. sei cld ldx #$FF txs -; init bank switching +; Init the bank switching. lda #$C sta MAPCTL ; $FFF9 -; disable all timer interrupts +; Disable all timer interrupts. lda #$80 trb TIM0CTLA @@ -67,24 +67,24 @@ MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$2 trb TIM6CTLA trb TIM7CTLA -; disable TX/RX IRQ, set to 8E1 +; Disable the TX/RX IRQ; set to 8E1. lda #%11101 sta SERCTL -; clear all pending interrupts +; Clear all pending interrupts. lda INTSET sta INTRST -; setup the stack +; Set up the stack. lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp+1 -; Init Mickey +; Init Mickey. ldx #.sizeof(MikeyInitReg)-1 mloop: ldy MikeyInitReg,x @@ -93,7 +93,7 @@ mloop: ldy MikeyInitReg,x dex bpl mloop -; these are RAM-shadows of read only regs +; These are RAM-shadows of read-only regs. ldx #$1b stx __iodat @@ -102,7 +102,7 @@ mloop: ldy MikeyInitReg,x ldx #$d stx __viddma -; Init Suzy +; Init Suzy. ldx #.sizeof(SuzyInitReg)-1 sloop: ldy SuzyInitReg,x @@ -115,19 +115,19 @@ sloop: ldy SuzyInitReg,x sta __sprsys cli -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Call module constructors +; Call the module constructors. jsr initlib -; Push arguments and call main +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: jsr donelib ; Run module destructors diff --git a/libsrc/nes/crt0.s b/libsrc/nes/crt0.s index 68b489dac..de874d363 100644 --- a/libsrc/nes/crt0.s +++ b/libsrc/nes/crt0.s @@ -70,7 +70,7 @@ start: -; setup the CPU and System-IRQ +; Set up the CPU and System-IRQ. sei cld @@ -90,40 +90,40 @@ start: inx bne @l -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; initialize data +; Initialize the data. jsr copydata -; setup the stack +; Set up the stack. lda #<(__SRAM_START__ + __SRAM_SIZE__) sta sp lda #>(__SRAM_START__ + __SRAM_SIZE__) sta sp+1 ; Set argument stack ptr -; Call module constructors +; Call the module constructors. jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: jsr donelib ; Run module destructors -; Reset the NES +; Reset the NES. jmp start ; ------------------------------------------------------------------------ -; System V-Blank Interupt -; updates PPU Memory (buffered) -; updates VBLANK_FLAG and tickcount +; System V-Blank Interrupt +; Updates PPU Memory (buffered). +; Updates VBLANK_FLAG and tickcount. ; ------------------------------------------------------------------------ nmi: pha @@ -141,13 +141,13 @@ nmi: pha @s: jsr ppubuf_flush - ; reset the video counter + ; Reset the video counter. lda #$20 sta PPU_VRAM_ADDR2 lda #$00 sta PPU_VRAM_ADDR2 - ; reset scrolling + ; Reset scrolling. sta PPU_VRAM_ADDR1 sta PPU_VRAM_ADDR1 diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index e828870ab..66aed0366 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -21,7 +21,7 @@ Start: -; Save the zero page locations we need +; Save the zero-page locations that we need. ldx #zpspace-1 L1: lda sp,x @@ -29,9 +29,9 @@ L1: lda sp,x dex bpl L1 -; Switch to second charset. The routine that is called by BSOUT to switch the -; character set will use FNLEN as temporary storage - YUCK! Since the -; initmainargs routine, which parses the command line for arguments needs this +; Switch to the second charset. The routine that is called by BSOUT to switch the +; character set will use FNLEN as temporary storage -- YUCK! Since the +; initmainargs routine, which parses the command line for arguments, needs that ; information, we need to save and restore it here. ; Thanks to Stefan Haubenthal for this information! @@ -43,11 +43,11 @@ L1: lda sp,x pla sta FNLEN ; Restore FNLEN -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Save system stuff and setup the stack +; Save some system stuff; and, set up the stack. tsx stx spsave ; Save the system stack ptr @@ -57,20 +57,20 @@ L1: lda sp,x lda MEMSIZE+1 sta sp+1 ; Set argument stack ptr -; Call module constructors +; Call the module constructors. jsr initlib -; Push arguments and call main() +; Push the command-line arguments; and, call main(). jsr callmain -; Call module destructors. This is also the _exit entry. +; Call the module destructors. This is also the exit() entry. _exit: pha ; Save the return code on stack jsr donelib -; Copy back the zero page stuff +; Copy back the zero-page stuff. ldx #zpspace-1 L2: lda zpsave,x @@ -78,17 +78,17 @@ L2: lda zpsave,x dex bpl L2 -; Store the program return code into ST +; Store the program return code into BASIC's status variable. pla sta ST -; Restore the stack pointer +; Restore the stack pointer. ldx spsave txs ; Restore stack pointer -; Back to basic +; Back to BASIC. rts diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 92faadf52..b732459e0 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -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 @@ -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 diff --git a/libsrc/supervision/crt0.s b/libsrc/supervision/crt0.s index 11d239277..d78bfeab5 100644 --- a/libsrc/supervision/crt0.s +++ b/libsrc/supervision/crt0.s @@ -28,7 +28,7 @@ _sv_nmi_counter: .byte 0 reset: jsr zerobss - ; initialize data + ; Initialize data. jsr copydata lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) @@ -63,12 +63,12 @@ not_dma: rti .endproc -; removing this segment gives only a warning +; Removing this segment gives only a warning. .segment "FFF0" .proc reset32kcode lda #(6<<5) sta sv_bank -; now the 32kbyte image can reside in the top of 64kbyte, 128kbyte roms +; Now, the 32Kbyte image can reside in the top of 64Kbyte and 128Kbyte ROMs. jmp reset .endproc diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index dae6424dd..e04881987 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -22,7 +22,7 @@ Start: -; Save the zero page locations we need +; Save the zero-page locations that we need. ldx #zpspace-1 L1: lda sp,x @@ -30,16 +30,16 @@ L1: lda sp,x dex bpl L1 -; Switch to second charset +; Switch to the second charset. lda #14 jsr BSOUT -; Clear the BSS data +; Clear the BSS data. jsr zerobss -; Save system stuff and setup the stack +; Save some system stuff; and, set up the stack. tsx stx spsave ; Save the system stack ptr @@ -49,20 +49,20 @@ L1: lda sp,x lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp+1 ; Set argument stack ptr -; 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 on stack jsr donelib -; Copy back the zero page stuff +; Copy back the zero-page stuff. ldx #zpspace-1 L2: lda zpsave,x @@ -70,17 +70,17 @@ 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 -; Back to basic +; Back to BASIC. rts