SCORE.S 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. ; SCORE.S
  2. ; THIS FILE CONTIANS THE ROUTINES WHICH UPDATE AND DISPLAY THE THREE SCORES--
  3. ; PLAYER 1, HIGH SCORE, AND PLAYER 2.
  4. ; THERE'S NO PLAYER 2 SCORE IF "PLAYNUM" IS FALSE.
  5. ; THIS ROUTINE USES A, X AND Y. THE X REGISTER CONTAINS AN INDEX INTO
  6. ; THE SCORE VALUE TABLES.
  7. GLBL ADDSCORE
  8. ADDSCORE STX STEMPX ; SAVE REGISTERS
  9. STY STEMPY
  10. LDA DOITOVER ; NO POINTS IN INSTANT REPLAY !
  11. BEQ ZSCONT01
  12. JMP SCOREBYE
  13. ZSCONT01 LDA CURRENT ; GET OFFSET FROM "PL0SCORE"
  14. ASL A ; IN Y
  15. ASL A
  16. TAY
  17. ZSCR010 SED ; DECIMAL MODE
  18. CLC
  19. LDA LOSCORE,X ; LOW TWO DIGITS OF POINTS
  20. ADC PL0SCORE+2,Y ; ADD TO THOUSANDS AND HUNDREDS
  21. STA PL0SCORE+2,Y
  22. LDA HISCORE,X ; NEXT TWO DIGITS OF SCORE
  23. ADC PL0SCORE+1,Y
  24. STA PL0SCORE+1,Y
  25. LDA #0
  26. ADC PL0SCORE,Y ; IF THERE'S A CARRY, ADD IT
  27. STA PL0SCORE,Y
  28. CLD ; DECIMAL OFF
  29. ; CHECK TO SEE IF THIS PLAYER RECEIVES AN EXTRA LIFE
  30. TYA
  31. SEC
  32. SBC #1
  33. TAX ; STARTING INDEX
  34. CLC
  35. ADC #5
  36. STA TEMP6 ; ENDING INDEX
  37. CKXTRA1 INX
  38. CPX TEMP6 ; COMPARE ALL 4 REGISTERS
  39. BEQ ANEXTRA equal to bonus-- give a life
  40. LDA PL0SCORE,X
  41. CMP PL0BONUS,X
  42. BEQ CKXTRA1 ; MIGHT BE HIGH SCORE
  43. BCC PUTSCORE ; IF HISCORE GREATER, CARRY IS CLEAR
  44. ; ELSE TIME FOR AN EXTRA LIFE !
  45. ANEXTRA LDA #27
  46. JSR TUNIN
  47. LDX CURRENT
  48. INC PL0LIVES,X
  49. INC PLLIVES
  50. TXA
  51. PHA
  52. TYA
  53. PHA
  54. JSR STATDISP ; DISPLAY THE EXTRA HEAD
  55. PLA
  56. TAY
  57. PLA
  58. TAX
  59. LDA PL0BONUS+1,Y
  60. CMP #02
  61. BEQ CKX001
  62. SED do this in decimal so that it
  63. ;carries appropriately to millions
  64. LDA PL0BONUS+1,Y ; ELSE, A MULTIPLE OF 100,000
  65. CLC
  66. ADC #$10
  67. STA PL0BONUS+1,Y
  68. LDA PL0BONUS,Y
  69. ADC #0
  70. STA PL0BONUS,Y
  71. CLD
  72. JMP PUTSCORE
  73. CKX001 LDA #$10 ; AFTER FIRST AWARDING
  74. STA PL0BONUS+1,Y
  75. LDA #0
  76. STA PL0BONUS+2,Y
  77. ; PUTSCORE -- THIS ROUTINE PUTS THE SCORE AT "SCORE" INTO "CMAP1"
  78. PUTSCORE
  79. TYA ; 0 OR 4
  80. ASL A ;CALCULATE OFFSET 0 OR 8
  81. TAX ; INDEX INTO CHARACTER MAPS
  82. TYA
  83. CLC ;COMPARE VALUE FOR TERMINATION
  84. ADC #4
  85. STA TEMP5
  86. SCORLOOP LDA PL0SCORE,Y ;GET NEXT BYTE OF SCORE
  87. LSR A
  88. LSR A
  89. LSR A
  90. LSR A ;GET HIGH NYBBLE
  91. BNE PUTHINUM ;IF NOT ZERO PUT NUMBER FROM HI NYBBLE
  92. JSR PUTBLANK ;IF ZERO PUT IN BLANK
  93. LDA PL0SCORE,Y
  94. AND #$F ;GET LO NYBBLE
  95. BNE PUTLONUM ;IF NOT ZERO PUT NUMBER FROM LO NYBBLE
  96. JSR PUTBLANK ;IF ZERO PUT IN BLANK
  97. INY
  98. CPY TEMP5 ;4 BYTES OF SCORE
  99. BMI SCORLOOP
  100. LDA #NUMCHAR ;PUT UP A ZERO IF NO POINTS YET
  101. DEX
  102. JSR WRTCHAR
  103. SCOREBYE LDX STEMPX
  104. LDY STEMPY
  105. RTS ; BYE BYE !
  106. ** PUTNUMS, ROUTINE TO PUT NUMBERS FROM PLAYERS SCORE INTO CHARACTER MAP **
  107. PUTNUMS
  108. LDA PL0SCORE,Y ;GET NEXT BYTE OF SCORE
  109. LSR A
  110. LSR A
  111. LSR A
  112. LSR A ;GET HI NYBBLE
  113. ** PUTHINUM, ROUTINE TO PUT HIGH BYTE NUMBERS INTO CHARACTER MAP **
  114. PUTHINUM
  115. ASL A
  116. CLC ;POINT TO NUMBER IN CHARS
  117. ADC #NUMCHAR
  118. JSR WRTCHAR ;WRITE CHAR IN CHARACTER MAP
  119. LDA PL0SCORE,Y
  120. AND #$F ;GET LO NYBBLE
  121. ** PUTLONUM, ROUTINE TO PUT LOW BYTE NUMBERS INTO CHARACTER MAP **
  122. PUTLONUM
  123. ASL A
  124. CLC ;POINT TO NUMBER IN CHARS
  125. ADC #NUMCHAR
  126. JSR WRTCHAR ;WRITE CHAR IN CHARACTER MAP
  127. INY
  128. CPY TEMP5 ;4 BYTE OF SCORE DATA
  129. BMI PUTNUMS
  130. JMP SCOREBYE
  131. ** PUTBLANK, ROUTINE TO PUT A BLANK SPACE INTO NEXT POS IN CMAP1 **
  132. PUTBLANK
  133. LDA #NULL2
  134. ; ACC MUST BE LOW BYTE OF CHARACTER
  135. WRTCHAR
  136. STA CMAP1,X ;PUT CHAR IN CHARACTER MAP
  137. INX
  138. RTS