; this file needs to be assembled with: ; cl65 -o newtitle.xex -t none newtitle.s ; It contains only an init routine, no run address. .ifdef CART_TARGET origin = * .else .include "atari.inc" ; where our screen was loaded (see newtitle.pl) ;screendata = $2400 ; homebrew atari xex header .word $ffff .word origin .word end-1 ; .org $a800 .org origin .endif ; location sound code will look at to see whether sound ; is disabled (0 = enabled, !0 = disabled). If you ; change this here, change it in sounds.h also! sound_disabled = $03c0 ; since we're changing the font and colors, we'll save the old ; ones here. If you change these, change them in taipan.c ; also. fontsave = $03c1 color1save = $03c2 color2save = $003c3 version: .incbin "ver.dat" .ifdef CART_TARGET dl_ram = $7000 help_lms = dl_ram + 1 help = $7010 help_rom: .else help: .endif .incbin "help.dat" helphitbl: .byte >version .byte >help .byte >(help+32) .byte >(help+64) .byte >(help+96) .byte 0 helplotbl: .byte or FF (inverse) sounddisp = help + 78 ; executable code here start: .ifdef CART_TARGET lda #$42 ; finish display list. this part has to be in RAM. sta dl_ram lda #version sta help_lms+1 lda #$41 sta help_lms+2 lda #dlist sta help_lms+4 ldx #0 @hsloop: lda help_rom,x sta help,x inx cpx #help_size bne @hsloop .endif ; save old color registers and font addr. lda CHBAS sta fontsave lda COLOR1 sta color1save lda COLOR2 sta color2save ; setup color registers lda colorchoices sta COLOR2 ; text bg lda textchoices sta COLOR1 ; text fg ; turn off screen, in case vblank happens while we work lda #0 sta FR0 sta SDMCTL sta sound_disabled ; fix issue with sound not working with APE loader ; build our display list ; TODO, for now it's hardcoded (see 'dlist' below) ; wait for the next frame, to avoid graphics glitching jsr wait1jiffy ;; ; For use with explosion.s.pm: ;; ; set player/missiles. we don't use P/M here, it's for the explosion ;; ; sequence, but doing it here is "free" (it doesn't add to the size of ;; ; the main xex segment). also note that we don't enable ANTIC P/M DMA ;; ; (no SDMCTL or GRACTL bits set): the explosion routine writes directly ;; ; to the GRAFP/GRAFM registers. ;; ;; ; colors ;; lda #$0f ; bright white ;; sta PCOLR0 ;; sta PCOLR1 ;; sta PCOLR2 ;; sta PCOLR3 ;; ;; ; make sure they're not showing ;; lda #0 ;; sta GRAFP0 ;; sta GRAFP1 ;; sta GRAFP2 ;; sta GRAFP3 ;; sta GRAFM ;; ;; ; positions ;; lda #$30 ; text columns 0-1 ;; sta HPOSM3 ;; lda #$38 ; text columns 2-3 ;; sta HPOSM2 ;; lda #$40 ; 4-5 ;; sta HPOSM1 ;; lda #$48 ; 6-7 ;; sta HPOSM0 ;; lda #$50 ; 8-15 ;; sta HPOSP0 ;; lda #$70 ; 16-23 ;; sta HPOSP1 ;; lda #$90 ; 24-31 ;; sta HPOSP2 ;; lda #$B0 ; 32-39 ;; sta HPOSP3 ;; ;; ; priority ;; lda #8 ; PF 0,1 on top of players (then PF 2,3 on bottom) ;; sta GPRIOR ;; ;; ; width ;; lda #3 ;; sta SIZEP0 ; 3 = quad-width ;; sta SIZEP1 ;; sta SIZEP2 ;; sta SIZEP3 ;; lda #$FF ;; sta SIZEM ; FF = quad width, all missiles ; setup our display list lda SDLSTL sta FR0 lda SDLSTH sta FR0+1 lda #dlist sta SDLSTH ; switch to narrow playfield, enable screen lda #$21 sta SDMCTL ; clear any keypress that happened during loading lda #$ff sta CH ldx #0 ; X = index into bg color choices ldy #default_text ; Y = index into text color choices ; wait for user to press a key wait4key: lda colorchoices,x sta COLOR2 lda textchoices,y sta COLOR1 lda CH cmp #$ff beq wait4key cmp #28 ; Escape key bne not_esc ; show next line of help showhelp: stx FR1+1 ldx helpshowing inx loadhelp: lda helphitbl,x bne helpok ldx #0 beq loadhelp helpok: sta help_lms+1 lda helplotbl,x sta help_lms stx helpshowing ldx FR1+1 clc bcc x_ok not_esc: cmp #62 ; S key bne not_s jsr enable_disable_sound clc bcc showhelp not_s: cmp #21 ; B key bne not_b dex bpl x_ok ldx #colorcount bne x_ok not_b: cmp #45 ; T key bne keyok dey bpl x_ok ldy #textcount x_ok: lda #$ff sta CH bne wait4key keyok: lda CH cmp #33 ; space bar beq @done cmp #12 ; Enter bne x_ok @done: ; eat the keypress lda #$ff sta CH rts ; return to DOS (which loads the rest of the game) enable_disable_sound: lda #2 sta helpshowing lda sound_disabled eor #$01 sta sound_disabled beq now_on lda #166 ; inverse F screen code sta sounddisp sta sounddisp+1 rts now_on: lda #174 ; inverse N screen code sta sounddisp lda #128 ; inverse space screen code sta sounddisp+1 rts .out .sprintf("code ends at $%x", *) end: .ifndef CART_TARGET .word INITAD .word INITAD+1 .word start .endif