File Location: The Atari Museum Archives

Date: 01/15/04 - Archival Log.

http://www.atarimuseum.com

 

 

* SHSC.S

*         HIGH SCORE CARD INTERFACE FOR THE 7800 GAME

*

*

*             POWER UP HIGH SCORE CARD INITIALIZATION

*                 THIS ROUTINE LOOKS FOR THE HIGH SCORE CARD (HSC) AND

*                 DISABLES ALL HSC SOFTWARE IF IT IS NOT FOUND.

*                 IF THE CARD IS PRESENT, A LIST IS FORMED TO IDENTIFY

*                 WHICH DIFFICULTY LEVELS HAVE HIGH SCORE TABLES ASSOCIATED

*                 WITH THEM.  THIS INFO IS GOTTEN FROM THE HSCSTAT ROUTINE.

*

*                 THE LIST IS REFERENCED DURING IDLE MODE TO DETERMINE WHICH

*                 TABLES SHOULD BE DISPLAYED.

*

*                     THIS PROCEDURE HAS NO ENTRY CONDITIONS

*                     AND TRASHES ALL REGISTERS

*

 

*         PUBLIC  SETUPARG

*         EXTRN   HSCIN,HSGAMDAT,DIFNAM,HSCSTAT,HSLSTEXP,GAMENAME,TEMPX

 

          ZERODEF

 

          RSEG    CODE6

 

MAXLEVEL  EQU     4                      ;MAX NO. OF DIFF LEVELS

 

*         DETERMINE IF THE HSC IS PRESENT

HSPOWNIT

          LDA     $3900                  ;IF (MAGIC MEMORY LOCATIONS 3900

          CMP     #$C6                   ;    AND 3904 DONT MATCH THE

          BNE     HSCNOTPT               ;    DEFINED VALUES)

          LDA     $3904

          CMP     #$FE

          BEQ     HSCHERE                ;  THEN

HSCNOTPT  LDA     #0                     ;    SET HSCIN FLAG TO ZERO,

          STA     HSCIN                  ;    INDICATING HSC IS NOT IN

HSTUNE    RTS                            ;  END PROC

 

HSCHERE                                  ;  ELSE

          LDA     #$FF                   ;    SET HSCIN FLAG TO NONZERO,

          STA     HSCIN                  ;    INDICATING HSC IS PRESENT

*                                           ENDIF

 

          JSR     SETUPARG               ;SET UP ARGUMENTS FOR HSC

          JSR     SETHSLST               ;SET UP LIST OF WHAT DIFFICULTY

*                                         LEVELS HAVE HS TABLES

 

          RTS                            ;END HSPOWNIT

 

 

 

*             THIS ROUTINE SETS UP HSC ARGUMENTS THAT DONT CHANGE

*             OR ARE SIMPLY DEFAULT SETTINGS

*

*                 NO ENTRY CONDITONS

*                 REG A IS TRASHED

*

 

SETUPARG  LDA     #0

          STA     HSGAMDAT               ;CART NUMBER

          STA     HSGAMDAT+1

 

          LDA     #1

          STA     HSGAMDAT+3             ;USE JOYSTICK CONTROLLERS

 

 

          LDA     #L(DIFNAM)             ;POINTER TO THE DIFFICULTY NAME FIELD

          STA     HSGAMDAT+6

          LDA     #H(DIFNAM)

          STA     HSGAMDAT+7

 

          LDA     #L(DLLIST)             ;SET UP POINTER TO THE DLL FOR THE

          STA     HSGAMDAT+10            ;LOGO

          LDA     #H(DLLIST)

          STA     HSGAMDAT+11

 

          LDA     #L(HSTUNE)             ;SET UP POINTER TO SOUND ROUTINE FOR

          STA     HSGAMDAT+12            ;2ND,3RD,4TH,& 5TH PLACES.  1ST

          LDA     #H(HSTUNE)             ;PLACE GETS A DIFFERENT TUNE.

          STA     HSGAMDAT+13

 

          LDA     #4                     ;WAIT 4 SECONDS DURING DISPLAY

          STA     HSGAMDAT+14            ;OF HS DATA

 

          JSR     INITLOGO               ;RTS FOLLOWING CAN BE A JUMP

          RTS                            ;END SETUPARG PROC

 

 

 

 

*             THIS ROUTINE SETS UP A LIST OF WHICH DIFFICULTY LEVELS HAVE

*             HS TABLES SET UP ON THE HSC.

*

*                 NO ENTRY CONDITIONS

*                 A,X,Y TRASHED

*

 

SETHSLST  EQU     *

          LDX     #MAXLEVEL

          LDA     #0

          STA     HSGAMDAT+14            ;HOLD FOR ZERO SECONDS

 

HSCLOOP1  TXA                            ;REPEAT

          ASL     A                      ;  MODIFY DIFFICULTY LEVEL SO IT

          ASL     A                      ;  CAN FIT IN THE UPPER 6 BITS

          STA     HSGAMDAT+2             ;  OF ITS ALLOCATED STORAGE.

          LDY     #H(HSGAMDAT)           ;HSC REQUIRES HIGH BYTE OF ARGUMENT

*                                         ADDRESS TO RESIDE IN Y REGISTER

 

          STX     TEMPX

 

          JSR     HSCSTAT                ;  CALL HSCSTAT(DIFLEVEL)

 

          LDX     TEMPX

          STA     HSLSTEXP-1,X           ;  PUT HS TABLE STATUS INTO THE FLAG

*                                           LIST. 0 = PRESENT

          DEX                            ;  X := X-1

          BNE     HSCLOOP1               ;UNTIL (X=0, I.E. ALL DIF LEVELS

*                                                     ARE CHECKED)

HSEND     RTS                            ;END SETHSLST PROC

*

 

*         TEMPORARY ROUTINE TO ENTER A FINISHED GAME ONTO THE

*         HIGH SCORE CARD

*

*                 NO ENTRY CONDITIONS

*                 A,X,Y TRASHED

 

*

*         EXTRN   HSCIN,SETUPARG,DIFCULTY,SETDFNAM,HSLSTEXP

*         EXTRN   HSGAMDAT,PLAYER1,PLAYER2,HSCENTER

 

HSGAMOVR

 

          LDA     HSCIN                  ;IF (HSCIN=0)

          BEQ     HSEND                  ;  THEN /* HSC IS NOT PRESENT */ RETURN

 

          JSR     SETUPARG               ;SET UP ARGUMENT TABLE FOR HSC

          LDA     #4                     ;CONVERT DESERT FALCONS FRONTWARDS

          SEC                            ;DIFF LEVEL CODE TO MY BACKWARDS

          SBC     DIFCULTY               ;ENCODING. 0=EXPERT, 3=NOVICE

 

          JSR     SETDFNAM               ;SET UP DIFFICULTY NAME

 

          TAX

 

          ASL     A                      ;MOVE DIFF LEVEL OVER 2 BITS

          ASL     A                      ;AND PUT IN ARG LIST

          STA     HSGAMDAT+2

 

          LDA     #0                     ;UPDATE OUR LIST OF WHICH DIFFICULTY

          STA     HSLSTEXP-1,X           ;LEVELS HAVE HS TABLES

 

 

*         SET UP POINTER TO THE SCORES

          LDY     #H(HSGAMDAT)

 

          LDA     #L(PL1SCORE)

          STA     HSGAMDAT+8

          LDA     #H(PL1SCORE)           ;ZERO

          STA     HSGAMDAT+9

 

          LDA     #0

          STA     HSGAMDAT+14

          JSR     HSCSTAT                ;TO RETURN PLACE IN TABLE

          BMI     NEWTABL

 

          LDA     HSGAMDAT+5             ;PLACE IN TABLE

          BMI     NOPLACE

 

          BNE     LOWERSC                ;NOT TOP SCORE

 

NEWTABL

          LDA     #HISCOR0

          JSR     TUNIN

 

          LDA     #HISCOR1

          JSR     TUNIN

 

          JMP     NOPLACE

 

LOWERSC

          LDA     #LOSCOR0

          JSR     TUNIN

 

          LDA     #LOSCOR1

          JSR     TUNIN

 

NOPLACE

 

          LDA     NUMPLYRS

          CMP     #1

          BNE     DISPLAY4

 

          LDA     #4                     ;ONE PLAYER GAME, DISPLAY TABLE FOR

          STA     HSGAMDAT+14            ;FOUR SECONDS AFTER ENTERING INITIALS

 

 

DISPLAY4

          LDY     #H(HSGAMDAT)

          JSR     HSCENTER

 

          LDA     NUMPLYRS

          CMP     #1

          BEQ     HSENDGO

 

          LDY     #H(HSGAMDAT)

 

          LDA     #L(PL2SCORE)

          STA     HSGAMDAT+8

          LDA     #H(PL2SCORE)

          STA     HSGAMDAT+9

          INC     HSGAMDAT+2             ;ADJUST FOR PLAYER 2

 

 

          JSR     HSCSTAT                ;TO RETURN PLACE IN TABLE

          BMI     NEWTABL1

 

          LDA     HSGAMDAT+5             ;PLACE IN TABLE

          BMI     NOPLACE1

 

          BNE     LOWERSC1               ;NOT TOP SCORE

 

NEWTABL1

          LDA     #HISCOR0

          JSR     TUNIN

 

          LDA     #HISCOR1

          JSR     TUNIN

 

          JMP     NOPLACE1

 

LOWERSC1

          LDA     #LOSCOR0

          JSR     TUNIN

 

          LDA     #LOSCOR1

          JSR     TUNIN

 

NOPLACE1

 

          LDA     #4                     ;TWO PLAYER GAME, DISPLAY TABLE FOR

          STA     HSGAMDAT+14            ;FOUR SECONDS AFTER ENTERING INITIALS

 

          LDY     #H(HSGAMDAT)

          JSR     HSCENTER

 

HSENDGO   RTS                            ;END HSGAMOV

 

 

 

*

*

*

 

*     HSDISP.S

*       THIS FILE CONTAINS THE FOLLOWING PROCEDURES

*

*

*

*

 

 

*             THIS ROUTINE IS CALLED BETWEEN DISPLAY OF THE TITLE PAGE

*             AND THE ATTRACT MODE.  IT DISPLAYS THE HIGH SCORES FROM EACH

*             DIFFICULTY LEVEL AS STORED ON THE HSC.

*

*                 NO ENTRY CONDITIONS

*                 A,X,Y TRASHED

*

 

*         PUBLIC  SETDFNAM

*         EXTRN   HSCIN,HSGAMDAT,HSLSTEXP,HSCATRCT

*         EXTRN   DIFNAM,DIFNAMAD,DFNMADAD,TEMPX

 

HSDISP

 

          LDA     HSCIN                  ;IF (HSCIN=0)

          BEQ     HSENDDIS               ;  THEN /*HSC IS NOT PRESENT */ RETURN

 

          JSR     SETUPARG

 

          LDX     #MAXLEVEL

HSCLOOP2  EQU     *                      ;REPEAT

          LDA     HSLSTEXP-1,X           ;  IF (A HS TABLE HAS BEEN CREATED

*                                               FOR THIS DIFFICULTY LEVEL)

          BNE     HSNOTAB                ;    THEN

 

          TXA

          JSR     SETDFNAM               ;      SET UP POINTER TO APPROPRIATE

*                                               DIFFICULTY NAME

          TAX                            ;      RESTORE X COUNTER

          ASL     A                      ;      MODIFY DIFF LEVEL TO FIT IN

          ASL     A                      ;      UPPER 6 BITS OF ARG STORAGE

          STA     HSGAMDAT+2             ;      PLAYER NO. DOESNT MATTER

          LDY     #H(HSGAMDAT)

          STX     TEMPX

 

          JSR     HSCATRCT               ;      DISPLAY HS TABLE

 

          LDX     TEMPX

*                                             ENDIF

HSNOTAB   DEX                            ;  X := X-1

          BNE     HSCLOOP2               ;UNTIL (X=0, ALL LEVELS CHECKED)

 

HSENDDIS  RTS                            ;END HSDISP

 

 

*             THIS ROUTINE SETS UP THE FIELD CONTAINING THE NAME OF A

*             PARTICULAR DIFFICULTY LEVEL.  IT TAKES ADVANTAGE OF THE PREVIOUS

*             KNOWLEDGE THAT EACH NAME IS 8 CHARACTERS LONG (SOME ARE 6

*             PADDED WITH 2 BLANKS)

*

*                 ON ENTRY, REG A CONTAINS THE DIFFICULTY LEVEL

*                 IN BACKWARDS NOTATION ... I.E., 0 IS EXPERT, 3 IS NOVICE

*

*                 X,Y REG ARE TRASHED

*                 REG A IS KEPT INTACT !!!

*

 

SETDFNAM  EQU     *

          PHA                            ;SAVE THE PARAMETER IN A

 

*         FIRST BLANK OUT A 26 BYTE FIELD IN RAM

          LDX     #26

          LDA     #29                    ;WATKINS FUNNY NOTATION OF A BLANK

HSBLANK   EQU     *                      ;REPEAT

          STA     DIFNAM-1,X             ;  STORE A BLANK

          DEX                            ;  X := X-1

          BNE     HSBLANK                ;UNTIL (X=0, ENTIRE FIELD BLANKED)

 

          PLA                            ;NOW WE NEED THE PARAMETER

          PHA                            ;BUT WE MUST KEEP IT FOR THE CALLER

 

*         LOAD THE APPROPRIATE NAME INTO THE RAM FIELD

          ASL     A                      ;DOUBLE THE DIFFICULTY LEVEL SO IT

          TAX                            ;CAN SERVE AS A INDEX INTO A TABLE

*                                         WITH 2 BYTE LONG ENTRIES

 

          LDA     DIFNAMAD-2,X           ;INDEX INTO THE LIST OF ADDRESSES OF

*                                         DIFFICULTY NAMES

          STA     DFNMADAD               ;AND LOAD THIS ADDRESS INTO THE

*                                         ZERO-PAGE INDIRECT POINTER

          LDA     DIFNAMAD-1,X

          STA     DFNMADAD+1

 

          LDY     #8

 

HSLOOP3   EQU     *                      ;REPEAT

          LDA     (DFNMADAD),Y           ;  LOAD THE RAM BUFF WITH

          STA     DIFNAM+8,Y             ;  THE DIFF. NAME

          DEY                            ;  Y := Y-1

          BNE     HSLOOP3                ;UNTIL (Y=0, ENTIRE NAME IS LOADED)

 

          PLA                            ;RESTORE REG A

          RTS

 

*         THIS IS THE TEXT FOR THE NAME OF THE DIFFICULTY LEVEL

*         IT IS STORED IN WATKINS CODE, NOT ASCII (DARN!)

 

BEGTEXT   DB      29,13,14,21,8,2,4,29   ;' NOVICE '

STDTEXT   DB      18,19,0,13,3,0,17,3    ;'STANDARD'

ADVTEXT   DB      0,3,21,0,13,2,4,3      ;'ADVANCED'

EXPTEXT   DB      29,4,23,15,4,17,19,29  ;' EXPERT '

 

DIFNAMAD  DW      EXPTEXT-1,ADVTEXT-1,STDTEXT-1,BEGTEXT-1

 

GAMENAME  DB      29,29,29,29,29,29

          DB      3,4,18,4,17,19,29,5,0,11,2,14,13

          DB      29,29,29,29,29,29,29

 

          END