Advertisement
FoxCunning

RollEndCredits

Feb 12th, 2021 (edited)
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Bank $06
  2. *=$9900
  3. RollEndCredits:
  4.   JSR ResetScroll
  5.   JSR ClearScreen_B6
  6.   LDA $00
  7.   CLC
  8.   ADC #$40
  9. _WaitFrame:
  10.   CMP $00
  11.   BNE _WaitFrame
  12.   LDA #$1B ; Credits text pointer, low byte
  13.   STA $75
  14.   LDA #$9A ; Credits text pointer, high byte
  15.   STA $76
  16.   LDA #$00
  17.   STA $A6
  18. ; Clears the top screen row and starts reading a new line
  19. ; of text that will be rendered at the bottom
  20. _StartCreditsLine:
  21.   LDY #$00
  22. _ClrLineLoop:
  23.   LDA #$00
  24.   STA $0580,Y
  25.   INY
  26.   CPY #$1F
  27.   BNE _ClrLineLoop
  28.   LDA #$FF
  29.   STA $0580,Y
  30.   LDA #$01 ; Number of lines: 1
  31.   STA $2D
  32.   LDA #$20 ; Number of bytes/characters: 32 (fill row)
  33.   STA $2E
  34.   LDA #$01 ; Y: second row
  35.   STA $29
  36.   LDA #$00 ; X: first column
  37.   STA $2A
  38.   LDA #$FF ; Mode: uncompressed text in $580, write on all rows
  39.   STA $30
  40.   JSR DrawText
  41.   LDA $75
  42.   STA $29
  43.   LDA $76
  44.   STA $2A
  45.   LDY #$00
  46.   LDA ($29),Y
  47.   TAX   ; The first byte of each line is the X position where to start rendering text
  48.   INY
  49. _WriteCreditsLine:
  50.   LDA ($29),Y
  51.   CMP #$FD ; This special character ends the credits and locks the game in an endless loop
  52.   BEQ _EndlessLoop
  53.   STA $0580,X
  54.   INY
  55.   INX
  56.   CMP #$FF
  57.   BEQ _EndOfLine
  58.   JMP _WriteCreditsLine
  59. _EndOfLine:
  60.   LDA #$01
  61.   STA $2D
  62.   LDA #$20
  63.   STA $2E
  64.   TYA
  65.   CLC
  66.   ADC $75 ; Advance pointer to beginning of next line of text
  67.   STA $75
  68.   LDA #$00
  69.   ADC $76
  70.   STA $76
  71.   LDA #$1D ; Y: bottom row
  72.   STA $29
  73.   LDA #$00 ; X: first column
  74.   STA $2A
  75.   LDA #$FF
  76.   STA $30
  77.   JSR DrawText
  78.   LDA #$04
  79.   STA $0B
  80. _WaitScroll:
  81.   LDA $0B
  82.   BNE _WaitScroll
  83.   JMP _StartCreditsLine
  84. _EndlessLoop:
  85.   JMP _EndlessLoop
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement