2 %include "WonderSwan.inc"
15 ; Set Maps and Sprite Table at the end of first part of ram
16 fgmap equ WSC_TILE_BANK1-MAP_SIZE
17 bgmap equ fgmap-MAP_SIZE
18 sprtable equ bgmap-SPR_TABLE_SIZE
24 ;PADDING 15 ; Pad 15 Sections
31 cli ; Disable Interrupts
32 cld ; Offset in Increment mode
34 xor ax,ax ; Clear all registers
40 mov ds,ax ; Clear Segments
43 mov bp,ax ; Setup stack
47 in al,IO_HARDWARE_TYPE ; Check Wonderswan Mono/Color
49 .mono: jz .mono ; We loop forever if Mono
51 mov sp,WSC_STACK ; New stack
67 or al,VMODE_16C_CHK | VMODE_CLEANINIT
80 mov al,BG_MAP(bgmap) | FG_MAP(fgmap)
83 mov al,SPR_TABLE(sprtable)
97 mov di,INTVEC_VBLANK_START
100 mov word [es:di],VBlank
101 mov word [es:di+0x2],MYSEGMENT
103 xor ax,ax ; Clear HBL & Timer
104 out IOw_HBLANK_FREQ,ax
110 mov al,INT_VBLANK_START ; Enable VBL Int
113 sti ; Enable Interrupts !
115 ;--------------------------------
117 ; Set Segments for Copy
118 mov ax,0x2000 ; ! note, try 0x2000, 0x4000, etc..
133 mov di,WSC_TILE_BANK1
134 mov cx,(TileGfxE-TileGfx)/2
148 mov ax,BG_CHR(0,0,0,0,0) ; Initial Tile, Pal 0, Bank 0
150 mov cx,MAP_TWIDTH*MAP_THEIGHT
155 out IO_DISPLAY_CTRL,al
162 mov al,KEYPAD_READ_BUTTONS
170 test al,PAD_A ; Press A for Audio
176 ;******************************************
187 in al,IO_BG_X ; Infinite Scroll
197 or al,INT_VBLANK_START
203 ;******************************************
207 TilePal: incbin "gfx/bgtile.pal"
208 TileGfx: incbin "gfx/bgtile.gfx"
211 ;******************************************
213 ;ROM_HEADER __end, MYSEGMENT, 0x42, RH_WS_COLOR, RH_ROM_8MBITS, RH_NO_SRAM, RH_HORIZONTAL
215 ;******************************************
219 ;start=0x0100 ; Keep space for Int Vectors
221 VBLcnt: resb 0 ; Our datas in RAM