aboutsummaryrefslogtreecommitdiff
path: root/bank7.s
blob: c86f8894cb82eabfefe85f6d4497f754ea8d5715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

 .include "atari.inc"

font = $9c00
CCNTL  = $d500
destptr = FR0
srcptr = FR1
codedest = $0400

cart_trailer = $bffa
 .org $a000 ; left cartridge

titledata:
 .incbin "titledata.dat"

dlist:

; copy 7680 bytes from $8000-$9dff to (destptr).
; on exit, destptr points to the next 7680 byte chunk.
copy_30_pages:
 lda #$0
 tay
 sta srcptr
 lda #$80
 sta srcptr+1
 ldx #$1e
@copypage:
 lda (srcptr),y
 sta (destptr),y
 dey
 bne @copypage
 inc srcptr+1
 inc destptr+1
 dex
 bne @copypage
init:
 rts

start:
; turn off ANTIC DMA to speed up copying to RAM
 lda #0
 sta SDMCTL
 sta DMACTL

; copy code to RAM
 lda #<codedest
 sta destptr
 lda #>codedest
 sta destptr+1
 lda #0    ; bank 0...
 sta CCNTL ; ...select it
 jsr copy_30_pages
 lda #1    ; bank 1...
 sta CCNTL ; ...select it
 jsr copy_30_pages
 lda #2    ; bank 2...
 sta CCNTL ; ...select it
 jsr copy_30_pages
 lda #3    ; bank 3...
 sta CCNTL ; ...select it
 jsr copy_30_pages

 ; 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

 .if * > cart_trailer
  .fatal "bank7 code too large"
 .endif

 .res cart_trailer - *, $ff
 .word start ; 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)