Skip to content
Browse files

Add new init routine

  • Loading branch information...
1 parent 12a162d commit 19f88237d050f8fb98e65d3c88518f803f4665cd Tobias Pflug committed
Showing with 17 additions and 23 deletions.
  1. +1 −1 sfckit/lib/Makefile
  2. +16 −22 sfckit/lib/init.asm
View
2 sfckit/lib/Makefile
@@ -1,6 +1,6 @@
include ../snes.rules
-all: io.o swc.o serial.o dma.o joy.o debug.o snesmod.o assert.o
+all: io.o swc.o serial.o dma.o joy.o debug.o snesmod.o assert.o init.o
clean:
-rm -rf *.lst *.o .cpp* >/dev/null
View
38 sfckit/lib/init.asm
@@ -7,33 +7,28 @@
.global init_snes
.a8
-.i8
+.i16
.smart
.segment "CODE"
;----------------------------------------------------------------------
.proc init_snes
;----------------------------------------------------------------------
- pha
- phx
- phy
- php
- phd
- sei ; disable interrupts
+ .smart
+ sei ; disable interrupts
clc ; switch to native mode
xce ;
- rep #38h ; mem/A/X/Y = 16bit
- ; decimal mode off
-
- ldx #1FFFh ; setup stack pointer
+ rep #38h ; mem/A/X/Y = 16bit / decimal mode off
+ ldx #1FFFh ; setup stack pointer
txs ;
- lda #0000h ; direct page = 0000h
+ lda #0000h ; direct page = 0000h
tcd ;
- sep #20h ; 8bit A/mem
- lda #80h ; data bank = 80h
+ sep #20h ; 8bit A/mem
+ lda #80h ; data bank = 80h
pha ;
plb ;
+
lda $FFD5 ; get map mode
lsr ; 21/31 jump to bank C0
bcs :+ ; 20/30 jump to bank 80
@@ -43,7 +38,7 @@
;----------------------------------------------------------------------
histart:
;----------------------------------------------------------------------
-
+
lda $FFD5 ; if map_mode & 10h
bit #10h ; switch to hi-speed mode
beq :+ ;
@@ -205,13 +200,12 @@ _empty_data_segment: ;
rep #$38 ;
sep #$20 ; 8bit accu / 16bit index
- pld
- plp
- ply
- plx
- pla
-
- rts
+;
+; all hardware setup is done at this point
+;
+ ;
+ jmp main ; jump to main code entry point
+ ;
wram_fill_byte:
.byte $00

0 comments on commit 19f8823

Please sign in to comment.
Something went wrong with that request. Please try again.