aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-09 22:44:51 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-09 22:44:51 -0500
commitb001b2c00d72ea28e9272c30a53fcf83e21c9249 (patch)
tree4cec3077d88fbb052e38d658e2626f59bf406ebe
parentce772f39231647cf7a5558d94f542f4ebcdc7025 (diff)
downloadtaipan-b001b2c00d72ea28e9272c30a53fcf83e21c9249.tar.gz
cart image works now
-rw-r--r--Makefile17
-rw-r--r--bank7.s29
-rw-r--r--help.txt2
-rw-r--r--newtitle.s72
-rw-r--r--taipan.c2
5 files changed, 85 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 36f950f..12c595a 100644
--- a/Makefile
+++ b/Makefile
@@ -254,7 +254,7 @@ mkcart: mkcart.c
# via "JSR $0400".
romable_taimain.raw: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS)
rm -f taimain.xex
- $(MAKE) TAIMAIN_ADDR=0x3ff EXTRACFLAGS="-Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1" taimain.xex
+ $(MAKE) FONT_ADDR=0x9c00 TAIMAIN_ADDR=0x3ff EXTRACFLAGS="-Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1" taimain.xex
tail -c+2 taimain.xex > romable_taimain.raw
rm -f taimain.xex
@@ -270,10 +270,13 @@ fill512:
blankbank:
perl -Mbytes -e 'print chr(0xff) x 8192' > blankbank
-splitrom.raw.0:
-splitrom.raw.1:
-splitrom.raw.2:
-splitrom.raw.3:
+splitrom.raw.0: splitrom.raw.3
+
+splitrom.raw.1: splitrom.raw.3
+
+splitrom.raw.2: splitrom.raw.3
+
+splitrom.raw.3: romable_taimain.raw
split -b 7680 -a 1 -d romable_taimain.raw splitrom.raw.
bank0: splitrom.raw.0 fill512
@@ -288,7 +291,7 @@ bank2: splitrom.raw.2 fill512
bank3: splitrom.raw.3 bank3.s taifont
cl65 -l bank3.lst -m bank3.map -t none -o bank3 bank3.s
-bank7: bank7.s titledata.dat
+bank7: bank7.s titledata.dat ver.dat help.dat newtitle.s
cl65 -l bank7.lst -m bank7.map -t none -o bank7 bank7.s
taipan.rom: bank0 bank1 bank2 bank3 bank7 blankbank
@@ -312,7 +315,7 @@ taipan.cart: taipan.rom mkcart
# Obligatory clean and distclean rules.
clean:
- rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr ver.dat help.dat tags cartmsg.dat
+ rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr ver.dat help.dat tags cartmsg.dat splitrom.raw.* taipan.rom taipan.cart bank[0-9] fill512 blankbank romable_taimain.raw
distclean: clean
rm -f *~ core .*.swp 1.* 2.* 1 2 3 map map.* *.map a b c foo bar baz comptitle.s comptitle.dat
diff --git a/bank7.s b/bank7.s
index c86f889..3459aa0 100644
--- a/bank7.s
+++ b/bank7.s
@@ -10,10 +10,12 @@ codedest = $0400
cart_trailer = $bffa
.org $a000 ; left cartridge
-titledata:
+screendata:
.incbin "titledata.dat"
-dlist:
+ .res $44, $ff ; fudge factor, keep the DL from crossing a 1K boundary
+CART_TARGET = 1
+ .include "newtitle.s"
; copy 7680 bytes from $8000-$9dff to (destptr).
; on exit, destptr points to the next 7680 byte chunk.
@@ -36,7 +38,7 @@ copy_30_pages:
init:
rts
-start:
+cartstart:
; turn off ANTIC DMA to speed up copying to RAM
lda #0
sta SDMCTL
@@ -63,23 +65,22 @@ start:
; leave bank 3 enabled, as it has our custom font in it
; set up display list
- lda #34
- sta SDMCTL
- lda #>font
- sta CHBAS
- ;lda $ff
- ;sta CH
-;@wait4key:
- ;cmp CH
- ;beq @wait4key
- jsr $0400
+ ;lda #34
+ ;sta SDMCTL
+ ;lda #>font
+ ;sta CHBAS
+ lda #1
+ sta COLDST ; System Reset = reboot
+ jsr start ; from newtitle.s
+ jsr $0400 ; run the game (romable_taimain)
+ jmp cartstart ; redisplay title screen if "play again? N"
.if * > cart_trailer
.fatal "bank7 code too large"
.endif
.res cart_trailer - *, $ff
- .word start ; entry point
+ .word cartstart ; entry point
.byte 0 ; 0 = cartridge present
.byte 4 ; init and run the cart, don't boot the disk, non-diagnostic
.word init ; init address (just an RTS)
diff --git a/help.txt b/help.txt
index 0e1da9d..79c08fb 100644
--- a/help.txt
+++ b/help.txt
@@ -1,4 +1,4 @@
\B:Change BG Color \E\s\c:more
\T:Change Text Color \E\s\c:more
-\S:Sound [now \O\N ] \E\s\c:more
+\S:Sound (now \O\N ) \E\s\c:more
\S\p\a\c\e/\R\e\t\u\r\n:Start Game \E\s\c:more
diff --git a/newtitle.s b/newtitle.s
index 798320d..5fdf37e 100644
--- a/newtitle.s
+++ b/newtitle.s
@@ -2,8 +2,23 @@
; 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!
@@ -16,21 +31,17 @@ fontsave = $03c1
color1save = $03c2
color2save = $003c3
- ; 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
-
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:
@@ -49,6 +60,11 @@ helplotbl:
.byte <(help+96)
.byte 0
+ .ifdef CART_TARGET
+help_size = * - help_rom
+ .out .sprintf("help_size == %x", help_size)
+ .endif
+
colorchoices:
.byte $c0,$10,$00
colorcount = (*-colorchoices)-1
@@ -78,7 +94,7 @@ filler:
totalscanlines = 184 ; aka image size / $20
topscanlines = (($1000 - (screendata .mod $1000)) / $20)
-bottomscanlines = totalscanlines - topscanlines
+bottomscanlines = (totalscanlines - topscanlines)
.out .sprintf("topscanlines = %d", topscanlines)
.out .sprintf("bottomscanlines = %d", bottomscanlines)
@@ -116,12 +132,16 @@ dlist:
.endrepeat
dl3byte $0f | $40, screendata+(topscanlines * $20) ; Hit 4K boundary, LMS again
- .repeat bottomscanlines
+ .repeat bottomscanlines - 1
dlbyte $0f ; 55 more scanlines of mode 8
.endrepeat
+ .ifdef CART_TARGET
+ dl3byte $01, dl_ram ; DL is mainly in ROM, jump to RAM (extra scanline)
+ .else
dl3byte $02 | $40, version ; LMS, 1 line of GR.0 for the version
help_lms = * - 2
dl3byte $41, dlist ; JVB, jump & wait for vblank
+ .endif
.out .sprintf("dl start $%x, end $%x, size %d", dlist, *, (* - dlist) + 1)
@@ -134,6 +154,30 @@ 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
+ lda #>version
+ sta help_lms+1
+ lda #$41
+ sta help_lms+2
+ lda #<dlist
+ sta help_lms+3
+ 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
@@ -326,6 +370,8 @@ now_on:
.out .sprintf("code ends at $%x", *)
end:
+ .ifndef CART_TARGET
.word INITAD
.word INITAD+1
.word start
+ .endif
diff --git a/taipan.c b/taipan.c
index 4e042ee..9380d1d 100644
--- a/taipan.c
+++ b/taipan.c
@@ -122,7 +122,6 @@ extern void __fastcall__ clear_lorcha(int which);
/* used to set the background/text colors here, but now the
title screen does it (newtitle.s) */
void atari_text_setup() {
-#ifndef CART_TARGET
jsleep(1);
POKE(560, PEEK(212)); // restore the
POKE(561, PEEK(213)); // display list
@@ -130,7 +129,6 @@ void atari_text_setup() {
POKE(559, 34); // turn on the screen (normal playfield)
jsleep(1);
POKE(756, FONT_ADDR / 256); // use our custom font
-#endif
POKE(731, 1); // disable keyclick on XL/XE (does nothing on 400/800)
}