Add some documentation
This commit is contained in:
1 parent
81d5612b64
commit
630d91485e
2 files changed
+37
-12
No files matched your search
@@ -1,8 +1,4 @@
|
||||
SEG.U dataSegment
|
||||
; Number of interrupt
|
||||
; Used as counter to be decremented to do some things less frequently
|
||||
irqn:
|
||||
BYTE
|
||||
|
||||
; Parameters for calcTileMem
|
||||
calcTileX:
|
||||
|
||||
+37
-8
@@ -49,10 +49,14 @@ start:
|
||||
lda #ST_INTRO0
|
||||
sta status
|
||||
|
||||
; Reset screen (and other parameters) to play intro
|
||||
; jsr introreset
|
||||
; Clear screen
|
||||
; jsr clearScreen
|
||||
|
||||
; counter = 0
|
||||
lda #0
|
||||
sta counter
|
||||
sta counter + 1
|
||||
|
||||
; Enable interrupts
|
||||
cli
|
||||
|
||||
@@ -60,7 +64,7 @@ menu SUBROUTINE
|
||||
.menu: ; Cycle here until SPACE or `Q` is pressed
|
||||
jsr $ffe4 ; GETIN
|
||||
cmp #$20 ; Is it SPACE?
|
||||
beq .intro0end ; if yes, go to intro0end and start game (see)
|
||||
beq .pressSpace ;
|
||||
#if DEBUG = 1
|
||||
cmp #$41 ; Is it A?
|
||||
beq .printCounter ; if yes, print current counter
|
||||
@@ -81,7 +85,7 @@ menu SUBROUTINE
|
||||
#endif
|
||||
|
||||
; Intro is finished, now it's time to start the proper game
|
||||
.intro0end:
|
||||
.pressSpace:
|
||||
; Are you sure? Maybe the demo-intro is not finished, yet
|
||||
; We do not want to actually start unless the demo is finished,
|
||||
; otherwise vertical raster line offset may be != 0
|
||||
@@ -104,7 +108,7 @@ menu SUBROUTINE
|
||||
; Main Raster Interrupt Handler
|
||||
; ----------------------------------------------------------------------
|
||||
irq SUBROUTINE
|
||||
; Things that must be done every interrupt (50Hz)
|
||||
; Things that must be done every interrupt (50Hz / 20ms)
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
; Acknoweledge IRQ
|
||||
dec $d019
|
||||
@@ -122,22 +126,45 @@ irq SUBROUTINE
|
||||
sta $d020
|
||||
#endif
|
||||
|
||||
; Play music first -> no audio skew if computations are slow
|
||||
; Play music first
|
||||
jsr sidtune + 3
|
||||
|
||||
#if DEBUG = 1
|
||||
; Change background to visually see the ISR timing
|
||||
; Change background to visually see how much time your game logic takes
|
||||
lda #2
|
||||
sta $d020
|
||||
#endif
|
||||
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
; PUT YOUR LOGIC HERE -- Start of Foo Logic
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
.fooLogicStartY
|
||||
ldy #1
|
||||
.fooLogicStartX:
|
||||
ldx #$0
|
||||
.fooLogic:
|
||||
dex
|
||||
cpx #0
|
||||
bne .fooLogic
|
||||
|
||||
dey
|
||||
cpy #0
|
||||
bne .fooLogicStartX
|
||||
|
||||
inc counter
|
||||
bne .noIncCounter
|
||||
inc counter + 1
|
||||
.noIncCounter
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
; End of Foo Logic
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
#if DEBUG = 1
|
||||
; Change background back again to visally see ISR timing
|
||||
; Change background to visually show when we stopped
|
||||
; using the CPU during the interrupt routine
|
||||
; NOTE: at the end of this routine, we are still calling the
|
||||
; original system interrupt handler, which takes some time,
|
||||
; but it is not shown!
|
||||
lda #11
|
||||
sta $d020
|
||||
#endif
|
||||
@@ -150,4 +177,6 @@ irq SUBROUTINE
|
||||
pla
|
||||
|
||||
; Go to original system routine
|
||||
; Useful to have the kernal scan the keyboard for us
|
||||
jmp $ea31
|
||||
|
||||
Reference in new issue
Block a user