Air Fortress

Air Fortress is a simple yet entertaining shoot-'em-up by HAL. WHERE IS MY LIGHTBRASNER?

Uncompiled ASM Code
The Japanese ROM contains several large portions of the uncompiled ASM source code, complete with comments from the programmer, as well as a couple of DOS file listings. These snippets were probably stray data on a developer's hard drive, which was used by the compiler to fill the empty spaces in the ROM. The American release was cleaned up significantly and recompiled, so it doesn't contain this data.

Data Locations
RESE90 = $C086 W2PART = $C08D MMOVR  = $C194 MMOVL  = $C1AD MMOVD  = $C1FC MMOVU  = $C219 SXYFDM = $C26A DSPMAP = $C28B IMDATH = $C311 IMDATV = $C318 SEBPOS = $C372 SEFDRC = $C3C5 SEBDRC = $C3DD EBMSSB = $C4C5 EBMSET = $C4D2 EBMS20 = $C4DC LBMSET = $C4FB EFBSET = $C50B CBMSET = $C518 BBMSET = $C545 MVEBM  = $C55C WEBM   = $C754 MVFBM  = $C808 WFBM   = $C832 SIRAPA = $C8E3 SETPLT = $C908 WPOSE  = $C9B6 OBJOBJ = $CA68 PAUSE  = $CA9C RQPOS  = $CAB6 OBJNBR = $CADB DSPEGY = $CB27 EGYADD = $CC0F EGYSUB = $CC3A MAXADD = $CC5A MAXSUB = $CC6A PUTPRT = $CC83 FADIN  = $CD92 FADINK = $CD94 FADOUT = $CDC9 FADOUK = $CDCB BASINI = $CE07 FORINI = $CE57 BASGAME = $CEE9 FORGAME = $CEFC GAMEOVR = $CF07 GOEND  = $CF0F ERROR  = $CF17 ALLLFT = $CF1A ALLRGT = $CF5D ALLDWN = $CF8D ALLUP  = $CFCE EVLONE = $D011 EVLON0 = $D013 EVRONE = $D047 EVRON0 = $D049 EVDONE = $D069 EVDON0 = $D06B EVUONE = $D08B EVUON0 = $D08D CMVSUB = $D0AF WSHUTR = $D136 QUAK90 = $D2E3 DNMI   = $D428 ENMI   = $D432 SYNC   = $D438 WRMMC0 = $D453 WRMMC1 = $D467 WRMMC2 = $D47B WRMMC3 = $D48F SETH   = $D4A3 SETV   = $D4A8 DISSCR = $D4AD ENASCR = $D4B8 VADRS  = $D4C0 FILVRM = $D514 WVRMP1 = $D51A WRTVRM = $D520 CLROBJ = $D73D SBIOS  = $D769 BSBIOS = $D853 SNFEDM = $0000 SNGON  = $0001 SNBKRT = $0002 SNBBM  = $0003 SNFBM  = $0004 SNEEXP = $0005 SNELV  = $0006 SNFDMG = $0007 SNEFBM = $0008 SNDOOR = $0009 SNWARP = $000A SNGRAV = $000B SNUFO  = $000C SNBEDM = $000D SNFFSI = $000E SNBFSI = $000F SNITEM = $0010 SNALLC = $0011 SNESCP = $0012 .END

Code (Display Routine?)
cpx    #yoko >       .ifn    kanji   < cpx    #yoko*2 >       bne     line_vmas20

ldx    #$20 lda    lineadrs+3      ; v.ram write address high beq    line_vmas80

sta    vrad            ; address high lda    lineadrs+2 sta    vrad            ; address low line_vmas30 lda    chrcode,x sta    vrdt            ; write !!! inx .ifn   kana.alpha      < cpx    #yoko+$20 >       .ifn    kanji   < cpx    #yoko*2+$20 >       bne     line_vmas30

.ife   line-2  < jmp    line_vmas80 >       ldx     #$40 lda    lineadrs+5      ; v.ram write address high beq    line_vmas80

sta    vrad            ; address high lda    lineadrs+4 sta    vrad            ; address low line_vmas40 lda    chrcode,x sta    vrdt            ; write !!! inx .ifn   kana.alpha      < cpx    #yoko+$40 >       .ifn    kanji   < cpx    #yoko*2+$40 >       bne     line_vmas40

line_vmas80 .ifn   kanji   < lda    atrbadrs+1 beq    line_vmas88

sta    vrad lda    atrbadrs sta    vrad ldx    #$00 ldy    #$08 line_vmas85 lda    atrbcode,x sta    vrdt inx dey bne    line_vmas85 > line_vmas88 lda    #$00 sta    lvmex pla pla jmp    nmi30

.ifn   kanji   < font_vmas lda    fvmex beq    font_vmas99
 * ---   font vmas       ---

LDA    CR0 AND    #$0FB STA    CTLR0 STA    CR0

lda    sttr

ldx    #$00 font_vmas10 lda    chrcode+1,x     ; v.ram write address high sta    vrad            ; address high inx lda    chrcode+1,x sta    vrad            ; address low inx font_vmas20 lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx lda    chrcode+1,x sta    vrdt            ; write !!! inx
 * ldy   #$08


 * dey
 * bne   font_vmas20

cpx    #$50 bcc    font_vmas10

lda    #$00 sta    fvmex pla pla jmp    nmi30 font_vmas99 rts >       .IFN    VRTRF < VRTR20 STA    VRAD INY LDA    (REG0),Y STA    VRAD INY LDA    (REG0),Y ASL    A        JSR     AUTINC          ; V-RL  AADDRESS AUTO INCREMENT SET ASL    A        ASL     A        LDA     (REG0),Y AND    #$03F TAX                    ; KOS
 * V-RAM TRANSER
 * V-RAM TRANSER
 * V-RAM TRANSER

Data Locations
0000 FMS               0001 MMC                0000 PPU0               0001 PPU1 0002 VSCROL            0003 HSCROL             0004 VSCRLH             0005 HSCRLH 0006 PPU1SV            0007 SYNCF              0008 KYSTAT             000A KYTRIG 000C RLSFLG            000E SEGMNT             000F P0                 0011 P1 0013 P2                 0015 W0                 0016 W1                 0017 W2 0018 W3                 0019 W4                 001A SAVEA              001B SAVEX 001C SAVEY             001D IP0                001F IW0                0020 IW1 0022 WRPNT             0023 RDPNT              0024 WRPNT1             0025 RDPNT1 0026 KWRPNT            0027 KRDPNT             0028 JIFFY              0029 RNDREG 002B XPOS              002C XPOSH              002D YPOS               002E DIGITS 002F EDTPTR            0030 LINBUF             0035 CUROBJ             0036 CURCOD 0037 WRST              0038 SNDPNT             003A WAITC              003B SSP 003C SSTACK            003E CHVA               003F CHVB               0040 CHVC 0041 OFSA              0042 OFSB               0043 OFSC               0044 SNDREG 005C SSWSAV            005E MODE               005F PRGBNK             0060 MAPBNK 0061 ROUND             0062 LEFT               0063 SCRENX             0065 SCRENY 0067 PNTSTO            0069 PNTMGL             006B PPOSEL             006D PPOSEH 006F PNT1              0071 PNT2               0073 PNT3               0075 PNTOBJ 0077 PNTSPE            0079 PPART1             007B PPART2             007D PPART3 007F PPART4            0081 PPARTA             0083 WORK               0083 WORK0 0084 WORK1             0085 WORK2              0086 WORK3              0087 WORK4 0088 WORK5             0089 WORK6              008A WORK7              008B WORK8 008C WORK9             008D WORKA              008E WORKB              008F WORKC 0090 WORKD             0091 WORKE              0092 WORKF              0093 SPBIGN 0093 GSXIW0            0094 SPEND              0094 GSXIW1             0095 SPNEGA

File Listing
. .. FE     EXE CONFE  EXE TXTCNV EXE TSCONV EXE GREP   EXE FE     CNF FE     HLP FE     HL2 CONFIG SYS FED    BAT READ   ME FE      BAK _E     $$$

Data Listings
8354 W1LINE            8363 W1LI21             836B W1LI20             836D W1LI00 8375 W1LI01            8392 W1LI10             83C1 W1LI90             83CD W1LI91 83E5 W1LI99            83F3 W1LI11             83F6 W1LI12             83FC STORYD 8815 STAFFD            8B0E FORTRS             8B61 FORT01             8B7E FORT00 8B88 FORT02            8B98 FORT10             8BA3 FORT20             8BAE FORT30 8BB5 FORT70            8BCA FORT80             8BD6 FORT81             8BE2 FORT82 8BEF DSPF90            8C23 DSPF97             8C57 DSPF98             8C8B DSPF91 8C93 DSPF92            8C9B DSPF93             8CB7 DSPF94             8CCB DSPF95 8CD3 DSPF96            8D17 DSPFA0             8D1B DSPFA1             8D2B DSPFA2 8D3B DSPFA3            8D4B DSPFA4             8D5B DSPFA5             8D5F DSPFA6 8D63 LXVEL             8D64 LYVEL              8D65 RXVEL              8D66 RYVEL 8D67 FTRTOB            8D93 FTRT00             8DA3 FTRT10             8DA7 FTRT11 8DF7 FTRT12            8E0C FTRT13             8E1B FTRT14             8E21 FTRT15 8E2C FTRT80            8E48 FTRT81             8E64 FTRT90             8ED4 TITLE 8EF0 TITL00            8EF8 TITL01             8F14 TITL20             8F17 TITL23 8F19 TITL21            8F2E TITL22             8F39 TITL24             8F49 TITL80 8F5B DSPTTL            8F8D WRTCUR             8FB1 WRTC10             8FBA WRTC90 8FBC DSPT90            8FD0 DSPT91             9008 DSPT94             9040 DSPT92 9049 DSPT95            9055 DSPT93             906F DSPTA0             9083 DSPTAU 9097 DSPTA1            909C DSPTA2             90B0 OSYNC              90B6 SETSTA 90C5 SETS00            90EC FLASTA             90EE FLAS00             9107 CLRV1 910E CLRV00            9124 CLRV10             9137 CLRV11             913C CLRV2 9146 RANDOM            914E RANDM1             916D RANDM2             9178 RANDM3 9179 OWRVRM            9182 OWRVR0             9186 OFIVRM             918F OFIVR0 9193 POSEL             0010 PNFTRB             91A4 POSEH              91B5 POSE00 91D8 POSE01            91FB POSE02             921E POSE03             9241 POSE04 9264 POSE05            926F POSE06             927A POSE07             9285 POSE08 9290 POSE09            929B POSE10             92A6 POSE11             92B1 POSE12 92BC POSE13            92C7 POSE14             92D2 POSE15             92D9 PSFTRB 92EC CLRSCR            930B CLRSC8             9310 CLRSC9             9315 OVERXX 934E OVER11            9374 OVER20             9377 OVER30             9386 OVER90 9394 OVER91            93A1 ALLMXX             93F4 ALLM01             9421 ALLM00 943C ALLM10            9453 ALLM20             9461 ALLM22             9481 ALLM23 94AC ALLM24            94BC ALLM25             94E0 ALLM30             94E9 ALLM31 94F9 ALLM50            9509 ALLM51             953F ALLM52             9543 ALLM53 9549 ALLM60            954A ALLMP1             955A ALLMP2             956A ALLMP3 957A ALLMP4            958A ALLMPA             959A ALLM90             95BA ALLM91 95C1 ALLM92            95C8 ALLM93             95CF ALLMA0             95D7 ALLMA1 95DF ALLMA4            95E3 ALLMA5             95E7 ALLMB0             95FE ALLMB1 9616 ALLMB2            9636 ALLMC0             9637 ALLMC1             9638 ALLMCA 965B ENDXX             9690 END001             96C1 END010             96EA END011 9718 END012            9734 END020             9744 END021             977D URAEND 97B0 END710            97B6 END700             97C6 END701             97D8 END702 97E0 NRMEND            97E8 END100             97F1 END102             97FE END101 9808 END103            9814 END112             981D END110             982A END111 983C END120            9841 END121             985C END130             9862 ENDMGL 9872 ENDMG0            9875 END900             9885 END901             98C9 END902 98D9 ENDSTA            98D9 END910             98EE END911             9905 END912 991F END913            993C END914             9955 END915             996D END916 998E END917            99AD END918             99C6 END919             99DD END920 99F7 END921            9A0B END922             9A14 END923             9A1E END924 9A25 END925            9A32 END926             9A39 END927             9A46 END928 9A46 ENDEND

Version number?
LC 3.00

Text strings from a program (hextobin)
Invalid stack size $Insufficient memory $Usage: hextobin [-(h|v|1) | [-a offset] hexfile | -o binfile]... | -f scriptfile No more memory .bin No more memory -f missing scriptfile No more memory fname expected missing outfile missing hexdigis %lx%s illegal hexdigis %s: bat option No more memory no hex file outputfile = %s filler = %s dojob: unexpected switch simpleconcat... withiwataheader... %08lx - %08lx : filecount = %d %08lx - %08lx : %s offset = %04lx %08lx - %08lx : %s length = %04lx dumphexfiles... %s: seekpos = %ld size=%ld %s: can't open %02x %04x %02x %d=c:c %02x %02x checksum =  %x %s,line %d checksum error %s,line %d too long %-12s : %04lx - %04lx %04lx %-12s : empty %s,line %d checksum error %08lx - seek error @ %s %s,line %d write error %s,line %d too long %08lx : binary image of %s fillfile: seek error
 * STACK OVERFLOW ***

Assembler messages
AIRBASE.X65 87-07-14 15:45:44......PAGE 0001

LINE# LOC   CODE       LINE

16 0000                     .LIB    MAIN 616 8000                     .END 617 8000                     .LIB    AIREQU 719 8000                     .END 720 8000                     .LIB    BASEQU 739 8000                     .END 740 8000                     .LIB    BASENEQU 780 8000                     .END 782 8000                     .LIB    BASTEST 1055 8202                     .END 1056 8202                     .LIB    BASENE1 1347 83C5                     .END 1348 83C5                     .LIB    BASENE2 2106 8878                     .END 2107 8878                     .LIB    BASENE3 2505 8A8F                     .END 2506 8A8F                     .LIB    BASATARI 2877 8CC3                     .END 2878 8CC3                     .LIB    BASENDAT 3181 8DBA                     .END 3182 8DBA                     .LIB    BASETC 3363 8EC6                     .END 3364 8EC6                     .LIB    BIKE 3852 91EF                     .END 3853 91EF                     .LIB    BASPOSE 4348 9584                     .END 4349 9584                     .LIB    BASPARTS 4507 9A34                     .END 4509 9A34                     .END No Errors

End of Assembly. TIME = 15:46:00

Code (password routine)
PASS   LDA     STACON BNE    PASS00 TAX JMP    PASS80 PASS00 LDA     PPU1 AND    #%11110111 STA    PPU1WT JSR    OSYNC LDY    #16*4-1 LDA    #$F0 PASS01 STA     OBJRAM,Y DEY BPL    PASS01 PASS10 JSR     CLRV1 JSR    OFIVRM .WORD  PSSC91 JSR    OWRVRM .WORD  PSSC90 LDX    #3 LDA    #'0' PASS11 STA     VDATA,X DEX BPL    PASS11 JSR    WRTPAS LDA    #0 STA    SCRENX STA    SCRENX+1 STA    SCRENY STA    SCRENY+1 LDA    PPU1 ORA    #%00001000 STA    PPU1WT JSR    OSYNC LDA    URAF BNE    PASS12 LDA    #0              ; clear URA pass counter. STA    UPACTR PASS12 LDA     #0 STA    PASSX PASS20 JSR     OSYNC LDA    KYSTAT          ; ZENKAI TO ONAJI ? CMP    OLDKSV BEQ    PASS21          ; yes. LDX    #8*4 BNE    PASS22          ; *BRA PASS21 DEC     KREPCT BEQ    PASS23 LDA    #0 BEQ    PASS24          ; *BRA PASS23 LDX     #8 PASS22 STX     KREPCT PASS24 STA     KEYSAV LDA    KYSTAT STA    OLDKSV LDA    KYTRIG AND    #KMASKL BEQ    PASS31 LDA    PASSX BEQ    PASS40 DEC    PASSX BPL    PASS40          ; *BRA PASS31 LDA     KYTRIG AND    #KMASKR BEQ    PASS40 LDA    PASSX CMP    #3 BEQ    PASS40 INC    PASSX PASS40 LDX     PASSX LDA    KEYSAV AND    #KMASKD BEQ    PASS45 DEC    VDATA,X LDA    VDATA,X CMP    #'0'-1 BNE    PASS41 LDA    #'Z'        BNE     PASS47          ; *BRA PASS41 CMP     #'A'-1 BNE    PASS48 LDA    #'9' BNE    PASS47          ; *BRA PASS45 LDA     KEYSAV AND    #KMASKU BEQ    PASS50 INC    VDATA,X LDA    VDATA,X CMP    #'9'+1 BNE    PASS46 LDA    #'A'        BNE     PASS47          ; *BRA PASS46 CMP     #'Z'+1 BNE    PASS48 LDA    #'0' PASS47 STA     VDATA,X PASS48 JSR     WRTPAS PASS50 LDA     #15*8-1 STA    OBJRAM LDA    #$58 STA    OBJRAM+1 LDA    #%01 STA    OBJRAM+2 LDA    PASSX ASL    A        ASL     A        ASL     A        ADC     #8*19 STA    OBJRAM+3 LDA    KYTRIG AND    #KMSKST BNE    PASS60 JMP    PASS20 PASS60 LDY     URAF LDA    PSSC9L,Y STA    PNT1 LDA    PSSC9H,Y STA    PNT1+1 LDX    #1 PASS61 LDY     #3 PASS62 LDA     VDATA,Y CMP    (PNT1),Y BNE    PASS63 DEY BPL    PASS62 BMI    PASSA0          ; collect pass word ! PASS63 LDA     PNT1 CLC ADC    #4 STA    PNT1 BCC    PASS64 INC    PNT1+1 PASS64 INX CPX    #11             ; password data NO KAZU BCC    PASS61
 * * loop
 * * loop
 * * check pass word
 * * check pass word
 * * illegal pass word.
 * * illegal pass word.

File listing
. .. FE     EXE CONFE  EXE TXTCNV EXE TSCONV EXE GREP   EXE FE     CNF FE     HLP FE     HL2 CONFIG SYS FED    BAT READ   ME FE      BAK _E     $$$

Intro
The intro was completely rewritten for the US version. Note that the text was carefully formatted to fit in the same number of lines as the Japanese version.

Ending
The Japanese and US versions have different endings. In the Japanese version, when you beat the game, it shows you returning to Farmel, you get a congratulatory message, and the game asks you to play "another Air Fortress". After beating the game a second time, it shows you returning to Farmel, and then you get the credits. In the US version, when you beat the game, it tells you that the Air Fortress has "recovered its function". After you beat the game a second time, you get a congratulatory message and the credits.

Other
The music was made quieter and cleaned up a bit in the US version.

In the Japanese version, pressing Start during the intro animation will sometimes cause the stars in the background to overlap the title logo and story text. This was corrected in the US version.

The CHR ROM was shrunk from 128 KB to a mere 32 KB for the US version. This was accomplished by removing the graphics for the planet Farmel (as seen in the aforementioned Japanese ending), changing all eight Air Fortresses to use the same two CHR banks, and making better use of free space in several banks.