1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Clear hw palette and set AUDIN low at startup

This commit is contained in:
Karri Kaksonen 2022-03-21 08:37:49 +02:00
parent 4cf7db1ef5
commit 79c243ccef

View File

@ -23,39 +23,55 @@
; .org $0200 ; .org $0200
; ;
; ; 1. force Mikey to be in memory ; ; 1. force Mikey to be in memory
; stz MAPCTL ; 9C F9 FF stz MAPCTL
;
; ; 2. clear palette
; A0 1F ldy #31
; A9 00 lda #0
; 99 A0 FD nextc: sta GCOLMAP, y
; 88 dey
; 10 FA bpl nextc
; ;
; ; 3. set ComLynx to open collector ; ; 3. set ComLynx to open collector
; lda #4 ; a = 00000100 ; A9 04 lda #4 ; a = 00000100
; sta SERCTL ; set the ComLynx to open collector ; 8D 8C FD sta SERCTL ; set the ComLynx to open collector
; ;
; ; 4. make sure the ROM is powered on ; ; 4. set AUDIN to output
; lda #8 ; a = 00001000 ; A9 1A lda #$1a ; audin = out, rest = out,
; sta IODAT ; set the ROM power to on ; ; noexp = in, cart addr = out, ext pwd = in
; 8D 8A FD sta IODIR
; ;
; ; 5. read in secondary exe + 8 bytes from the cart and store it in $f000 ; ; 5. set AUDIN to LOW
; ldx #0 ; x = 0 ; A9 0B lda #$0B ; Set AUDIN low
; ldy #$97 ; y = secondary loader size (151 bytes) ; 85 1A sta $1a ; Save local copy to ZP
;rloop1: lda RCART0 ; read a byte from the cart ; 8D 8B FD sta IODAT
; sta EXE,X ; EXE[X] = a
; inx ; x++
; dey ; y--
; bne rloop1 ; loops until y wraps
; ;
; ; 6. jump to secondary loader ; ; 6. read in secondary exe + 8 bytes from the cart
; jmp EXE ; run the secondary loader ; ; and store it in $f000
; A2 00 ldx #0 ; x = 0
; A0 97 ldy #$97 ; y = secondary loader size (151 bytes)
; AD B2 FC rloop1: lda RCART0 ; read a byte from the cart
; 9D 68 FB sta EXE,X ; EXE[X] = a
; E8 inx ; x++
; 88 dey ; y--
; D0 F6 bne rloop1 ; loops until y wraps
;
; ; 7. jump to secondary loader
; 4C 68 FB jmp EXE
; 00 00 00 00 ; spares
; 00 ; End of encrypted header mark
; ;
; .reloc ; .reloc
;********************************** ;**********************************
; After compilation, encryption and obfuscation it turns into this. ; After compilation, encryption and obfuscation it turns into this.
;********************************** ;**********************************
.byte $ff, $81, $ca, $33, $be, $80, $a2, $c4 .byte $ff, $b6, $bb, $82, $d5, $9f, $48, $cf
.byte $6d, $98, $fe, $8d, $bc, $66, $c0, $7a .byte $23, $37, $8e, $07, $38, $f5, $b6, $30
.byte $09, $50, $23, $28, $18, $c8, $06, $70 .byte $d6, $2f, $12, $29, $9f, $43, $5b, $2e
.byte $58, $4f, $1b, $e1, $c7, $90, $08, $cd .byte $f5, $66, $5c, $db, $93, $1a, $78, $55
.byte $1a, $6e, $5a, $45, $32, $d7, $6d, $c6 .byte $5e, $c9, $0d, $72, $1b, $e9, $d8, $4d
.byte $8a, $e5, $d8, $5c, $a0, $e8, $4f, $7a .byte $2f, $e4, $95, $c0, $4f, $7f, $1b, $66
.byte $5f, $73, $8d, $22 .byte $8b, $a7, $fc, $21
;********************************** ;**********************************
; Now we have the secondary loader ; Now we have the secondary loader