Initial Tiled tile animation export support

* Tiled tile animations read from TSX files
* Hooks for initialization generated by the tiled export tool
* Animated tiles implements with dynamic tiles backed by 2KB of direct
  page space in Bank 00
* Animation resolution limited to 1/60th incremenents

TODO
* Fix crasher in the _DoScriptSequ timer callback
* Fix single-line of garbage on the top line of the dynamic tiles
This commit is contained in:
Lucas Scharenbroich 2021-10-06 07:10:09 -05:00
parent 7d7a54a731
commit 87ded17e20
23 changed files with 7023 additions and 885 deletions

View File

@ -1,229 +1,220 @@
MoveLeft MoveLeft
clc clc
adc StartX ; Increment the virtual X-position adc StartX ; Increment the virtual X-position
jsl SetBG0XPos jsl SetBG0XPos
lda StartX lda StartX
lsr lsr
jsl SetBG1XPos jsl SetBG1XPos
jsl Render jsl Render
rts rts
MoveRight MoveRight
pha pha
lda StartX lda StartX
sec sec
sbc 1,s sbc 1,s
bpl *+5 bpl *+5
lda #0 lda #0
jsl SetBG0XPos jsl SetBG0XPos
lda StartX lda StartX
lsr lsr
jsl SetBG1XPos jsl SetBG1XPos
jsl Render jsl Render
pla pla
rts rts
MoveUp MoveUp
clc clc
adc StartY ; Increment the virtual Y-position adc StartY ; Increment the virtual Y-position
pha pha
lda #240 ; virtual play field height lda #240 ; virtual play field height
sec sec
sbc ScreenHeight sbc ScreenHeight
tax tax
cmp 1,s cmp 1,s
bcc *+4 bcc *+4
lda 1,s lda 1,s
jsl SetBG0YPos jsl SetBG0YPos
pla pla
; lda StartY ; lda StartY
; lsr ; lsr
; jsl SetBG1YPos ; jsl SetBG1YPos
jsl Render jsl Render
rts rts
MoveDown MoveDown
pha pha
lda StartY lda StartY
sec sec
sbc 1,s sbc 1,s
bpl *+5 bpl *+5
lda #0 lda #0
jsl SetBG0YPos jsl SetBG0YPos
; lda StartY ; lda StartY
; lsr ; lsr
; jsl SetBG1YPos ; jsl SetBG1YPos
jsl Render jsl Render
pla pla
rts rts
; Very simple, scroll as fast as possible ; Very simple, scroll as fast as possible
oldOneSecondCounter ds 2 oldOneSecondCounter ds 2
frameCount ds 2 frameCount ds 2
lastTick ds 2
Demo Demo
ldal OneSecondCounter ldal OneSecondCounter
sta oldOneSecondCounter sta oldOneSecondCounter
stz frameCount stz frameCount
; Every 3 ticks (20 fps) cycle some colors ; Every 3 ticks (20 fps) cycle some colors
lda #DoColorCycle ; lda #DoColorCycle
ldx #^DoColorCycle ; ldx #^DoColorCycle
ldy #3 ; ldy #3
jsl AddTimer ; jsl AddTimer
:loop :loop
PushLong #0 jsl DoTimers
_GetTick
pla
plx
cmp lastTick ; Throttle to 60 fps
beq :loop
tax ; Calculate the increment
sec
sbc lastTick
stx lastTick
; jsr _DoTimers
; lda #1 ; lda #1
; jsr MoveLeft ; jsr MoveLeft
jsr UpdateBG1Rotation jsr UpdateBG1Rotation
; jsr DoColorCycle ; jsr DoColorCycle
jsl Render jsl Render
inc frameCount inc frameCount
ldal KBD_STROBE_REG ldal KBD_STROBE_REG
bit #$0080 bit #$0080
beq :nokey beq :nokey
and #$007F and #$007F
cmp #'s' cmp #'s'
bne :nokey bne :nokey
rts rts
:nokey :nokey
ldal OneSecondCounter ldal OneSecondCounter
cmp oldOneSecondCounter cmp oldOneSecondCounter
beq :loop beq :loop
sta oldOneSecondCounter sta oldOneSecondCounter
lda ScreenWidth lda ScreenWidth
cmp #150 cmp #150
bcs :loop bcs :loop
lda #FPSStr lda #FPSStr
ldx #0 ; top-left corner ldx #0 ; top-left corner
ldy #$7777 ldy #$7777
jsr DrawString jsr DrawString
lda frameCount lda frameCount
ldx #4*4 ldx #4*4
jsr DrawWord jsr DrawWord
stz frameCount stz frameCount
bra :loop bra :loop
FPSStr str 'FPS' FPSStr str 'FPS'
; Move some colors around color (6 - 11) address 12 - 22 ; Move some colors around color (6 - 11) address 12 - 22
DoColorCycle DoColorCycle
ldal $E19E0C ldal $E19E0C
pha pha
ldal $E19E0E ldal $E19E0E
pha pha
ldal $E19E10 ldal $E19E10
pha pha
ldal $E19E12 ldal $E19E12
pha pha
ldal $E19E14 ldal $E19E14
pha pha
ldal $E19E16 ldal $E19E16
stal $E19E0C stal $E19E0C
pla pla
stal $E19E16 stal $E19E16
pla pla
stal $E19E14 stal $E19E14
pla pla
stal $E19E12 stal $E19E12
pla pla
stal $E19E10 stal $E19E10
pla pla
stal $E19E0E stal $E19E0E
rts rts
; Triggered timer to sway the background ; Triggered timer to sway the background
UpdateBG1Offset UpdateBG1Offset
lda BG1OffsetIndex lda BG1OffsetIndex
inc inc
inc inc
cmp #32 ; 16 entries x 2 for indexing cmp #32 ; 16 entries x 2 for indexing
bcc *+5 bcc *+5
sbc #32 sbc #32
sta BG1OffsetIndex sta BG1OffsetIndex
rts rts
AngleUp AngleUp
lda angle lda angle
inc inc
cmp #64 cmp #64
bcc *+5 bcc *+5
sbc #64 sbc #64
sta angle sta angle
jsr _ApplyAngle jsr _ApplyAngle
jsl Render jsl Render
rts rts
AngleDown AngleDown
lda angle lda angle
dec dec
bpl *+6 bpl *+6
clc clc
adc #64 adc #64
sta angle sta angle
jsr _ApplyAngle jsr _ApplyAngle
jsl Render jsl Render
rts rts
angle dw 0 angle dw 0
UpdateBG1Rotation UpdateBG1Rotation
jsr _ApplyAngle jsr _ApplyAngle
; Increment the angle ; Increment the angle
lda angle lda angle
inc inc
cmp #64 cmp #64
bcc *+5 bcc *+5
lda #0 lda #0
sta angle sta angle
rts rts
x_angles EXT x_angles EXT
y_angles EXT y_angles EXT
_ApplyAngle _ApplyAngle
lda angle ; debug with angle = 0 lda angle ; debug with angle = 0
asl asl
tax tax
ldal x_angles,x ; load the address of addressed for this angle ldal x_angles,x ; load the address of addressed for this angle
tay tay
phx phx
jsl ApplyBG1XPosAngle jsl ApplyBG1XPosAngle
plx plx
ldal y_angles,x ; load the address of addresses for this angle ldal y_angles,x ; load the address of addresses for this angle
tay tay
jsl ApplyBG1YPosAngle jsl ApplyBG1YPosAngle
rts rts

View File

@ -8,17 +8,15 @@
use EDS.GSOS.MACS.s use EDS.GSOS.MACS.s
use Tool222.Macs.s use Tool222.Macs.s
use Util.Macs.s use Util.Macs.s
use CORE.MACS.s
use ../../src/GTE.s use ../../src/GTE.s
use ../../src/Defs.s use ../../src/Defs.s
mx %00 mx %00
; External references
tiledata ext
; Feature flags ; Feature flags
NO_INTERRUPTS equ 1 ; turn off for crossrunner debugging NO_INTERRUPTS equ 0 ; turn off for crossrunner debugging
NO_MUSIC equ 1 ; turn music + tool loading off NO_MUSIC equ 1 ; turn music + tool loading off
; Typical init ; Typical init
phk phk
@ -26,60 +24,119 @@ NO_MUSIC equ 1 ; turn music + tool loading of
jsl EngineStartUp jsl EngineStartUp
lda #^MyPalette
ldx #MyPalette
ldy #0
jsl SetPalette
ldx #0 ldx #0
jsl SetScreenMode jsl SetScreenMode
; Set up our level data ; Set up our level data
; jsr BG0SetUp jsr BG0SetUp
; jsr BG1SetUp ; jsr BG1SetUp
jsr TileAnimInit
; Allocate room to load data ; Allocate room to load data
jsl AllocBank ; Alloc 64KB for Load/Unpack jsl AllocBank ; Alloc 64KB for Load/Unpack
sta BankLoad ; Store "Bank Pointer" sta BankLoad ; Store "Bank Pointer"
; jsr MovePlayerToOrigin ; Put the player at the beginning of the map jsr MovePlayerToOrigin ; Put the player at the beginning of the map
; lda #DIRTY_BIT_BG0_REFRESH ; Redraw all of the tiles on the next Render lda #DIRTY_BIT_BG0_REFRESH ; Redraw all of the tiles on the next Render
; ora #DIRTY_BIT_BG1_REFRESH ora #DIRTY_BIT_BG1_REFRESH
; tsb DirtyBits tsb DirtyBits
; lda #$FFFF lda #$FFFF
jsl Render jsl Render
EvtLoop EvtLoop
jsl ReadControl jsl ReadControl
and #$007F ; Ignore the buttons for now and #$007F ; Ignore the buttons for now
cmp #'q' cmp #'q'
bne :1 bne :1
brl Exit brl Exit
:1 cmp #'l' tcounter dw 0
tileIDs dw 168,170,172,174,168,170,172,174
dw 169,171,173,175,169,171,173,175
dw 208,210,212,214,208,210,212,214
dw 209,211,213,215,209,211,213,215
;tileIDs dw 1,1,1,1,1,1,1,5
; dw 2,2,2,2,2,2,2,6
; dw 3,3,3,3,3,3,3,7
; dw 4,4,4,4,4,4,4,8
:1
cmp #'r'
bne EvtLoop
jsl DoTimers
inc tcounter
lda tcounter
and #$0007
asl
tay
lda tileIDs,y
pha
lda tileIDs+16,y
pha
lda tileIDs+32,y
pha
ldx tileIDs+48,y
inx
ldy #3
jsl CopyTileToDyn
plx
inx
ldy #2
jsl CopyTileToDyn
plx
inx
ldy #1
jsl CopyTileToDyn
plx
inx
ldy #0
jsl CopyTileToDyn
jsl Render
brl EvtLoop
cmp #'l'
bne :1_1 bne :1_1
jsr DoLoadFG jsr DoLoadFG
bra EvtLoop brl EvtLoop
:1_1 cmp #'b' :1_1 cmp #'b'
bne :2 bne :2
jsr DoLoadBG1 jsr DoLoadBG1
bra EvtLoop brl EvtLoop
:2 cmp #'m' :2 cmp #'m'
bne :3 bne :3
jsr DumpBanks jsr DumpBanks
bra EvtLoop brl EvtLoop
:3 cmp #'f' ; render a 'f'rame :3 cmp #'f' ; render a 'f'rame
bne :4 bne :4
jsl Render jsl Render
bra EvtLoop brl EvtLoop
:4 cmp #'h' ; Show the 'h'eads up display :4 cmp #'h' ; Show the 'h'eads up display
bne :5 bne :5
jsr DoHUP jsr DoHUP
bra EvtLoop brl EvtLoop
:5 cmp #'1' ; User selects a new screen size :5 cmp #'1' ; User selects a new screen size
bcc :6 bcc :6
cmp #'9'+1 cmp #'9'+1
bcs :6 bcs :6
@ -95,7 +152,7 @@ EvtLoop
jsr DoTiles jsr DoTiles
brl EvtLoop brl EvtLoop
:7 cmp #$15 ; left = $08, right = $15, up = $0B, down = $0A :7 cmp #$15 ; left = $08, right = $15, up = $0B, down = $0A
bne :8 bne :8
lda #1 lda #1
jsr MoveRight jsr MoveRight
@ -146,18 +203,20 @@ Exit
bcs Fatal bcs Fatal
Fatal brk $00 Fatal brk $00
MyPalette dw $0E51,$0EDA,$0000,$068F,$0BF1,$00A0,$0EEE,$0777,$0FA4,$0F59,$0F31,$02E3,$09B9,$01CE,$0EE6
StartMusic StartMusic
pea #^MusicFile pea #^MusicFile
pea #MusicFile pea #MusicFile
_NTPLoadOneMusic _NTPLoadOneMusic
pea $0001 ; loop pea $0001 ; loop
_NTPPlayMusic _NTPPlayMusic
rts rts
; Position the screen with the botom-left corner of the tilemap visible ; Position the screen with the botom-left corner of the tilemap visible
MovePlayerToOrigin MovePlayerToOrigin
lda #0 ; Set the player's position lda #0 ; Set the player's position
jsl SetBG0XPos jsl SetBG0XPos
lda #0 lda #0
jsl SetBG1XPos jsl SetBG1XPos
@ -199,8 +258,8 @@ DoHUP
ldx #{160-12*4} ldx #{160-12*4}
ldy #$7777 ldy #$7777
jsr DrawString jsr DrawString
lda OneSecondCounter ; Number of elapsed seconds lda OneSecondCounter ; Number of elapsed seconds
ldx #{160-4*4} ; Render the word 4 charaters from right edge ldx #{160-4*4} ; Render the word 4 charaters from right edge
jsr DrawWord jsr DrawWord
lda #TicksStr lda #TicksStr
@ -221,7 +280,7 @@ DoTiles
:column equ 3 :column equ 3
:tile equ 5 :tile equ 5
pea $0000 ; Allocate local variable space pea $0000 ; Allocate local variable space
pea $0000 pea $0000
pea $0000 pea $0000
@ -251,7 +310,7 @@ DoTiles
cmp #26 cmp #26
bcc :rowloop bcc :rowloop
pla ; restore the stack pla ; restore the stack
pla pla
pla pla
rts rts
@ -284,7 +343,7 @@ DoLoadFG
ldx #FGName ldx #FGName
jsr LoadFile jsr LoadFile
ldx BankLoad ; Copy it into the code field ldx BankLoad ; Copy it into the code field
lda #0 lda #0
jsl CopyBinToField jsl CopyBinToField
rts rts
@ -292,10 +351,10 @@ DoLoadFG
; Load a simple picture format onto the SHR screen ; Load a simple picture format onto the SHR screen
DoLoadPic DoLoadPic
lda BankLoad lda BankLoad
ldx #ImageName ; Load+Unpack Boot Picture ldx #ImageName ; Load+Unpack Boot Picture
jsr LoadPicture ; X=Name, A=Bank to use for loading jsr LoadPicture ; X=Name, A=Bank to use for loading
ldx BankLoad ; Copy it into the code field ldx BankLoad ; Copy it into the code field
lda #0 lda #0
jsl CopyPicToField jsl CopyPicToField
rts rts
@ -336,43 +395,43 @@ DefaultPalette dw $0E51,$0EDB,$0000,$068F,$0BF1,$00A0,$0EEE,$0777,$
; Graphics helpers ; Graphics helpers
LoadPicture LoadPicture
jsr LoadFile ; X=Nom Image, A=Banc de chargement XX/00 jsr LoadFile ; X=Nom Image, A=Banc de chargement XX/00
bcc :loadOK bcc :loadOK
rts rts
:loadOK :loadOK
jsr UnpackPicture ; A=Packed Size jsr UnpackPicture ; A=Packed Size
rts rts
UnpackPicture sta UP_PackedSize ; Size of Packed Data UnpackPicture sta UP_PackedSize ; Size of Packed Data
lda #$8000 ; Size of output Data Buffer lda #$8000 ; Size of output Data Buffer
sta UP_UnPackedSize sta UP_UnPackedSize
lda BankLoad ; Banc de chargement / Decompression lda BankLoad ; Banc de chargement / Decompression
sta UP_Packed+1 ; Packed Data sta UP_Packed+1 ; Packed Data
clc clc
adc #$0080 adc #$0080
stz UP_UnPacked ; On remet a zero car modifie par l'appel stz UP_UnPacked ; On remet a zero car modifie par l'appel
stz UP_UnPacked+2 stz UP_UnPacked+2
sta UP_UnPacked+1 ; Unpacked Data buffer sta UP_UnPacked+1 ; Unpacked Data buffer
PushWord #0 ; Space for Result : Number of bytes unpacked PushWord #0 ; Space for Result : Number of bytes unpacked
PushLong UP_Packed ; Pointer to buffer containing the packed data PushLong UP_Packed ; Pointer to buffer containing the packed data
PushWord UP_PackedSize ; Size of the Packed Data PushWord UP_PackedSize ; Size of the Packed Data
PushLong #UP_UnPacked ; Pointer to Pointer to unpacked buffer PushLong #UP_UnPacked ; Pointer to Pointer to unpacked buffer
PushLong #UP_UnPackedSize ; Pointer to a Word containing size of unpacked data PushLong #UP_UnPackedSize ; Pointer to a Word containing size of unpacked data
_UnPackBytes _UnPackBytes
pla ; Number of byte unpacked pla ; Number of byte unpacked
rts rts
UP_Packed hex 00000000 ; Address of Packed Data UP_Packed hex 00000000 ; Address of Packed Data
UP_PackedSize hex 0000 ; Size of Packed Data UP_PackedSize hex 0000 ; Size of Packed Data
UP_UnPacked hex 00000000 ; Address of Unpacked Data Buffer (modified) UP_UnPacked hex 00000000 ; Address of Unpacked Data Buffer (modified)
UP_UnPackedSize hex 0000 ; Size of Unpacked Data Buffer (modified) UP_UnPackedSize hex 0000 ; Size of Unpacked Data Buffer (modified)
; Basic I/O function to load files ; Basic I/O function to load files
LoadFile LoadFile
stx openRec+4 ; X=File, A=Bank (high word) assumed zero for low stx openRec+4 ; X=File, A=Bank (high word) assumed zero for low
stz readRec+4 stz readRec+4
sta readRec+6 sta readRec+6
jsr ClearBankLoad jsr ClearBankLoad
@ -394,7 +453,7 @@ LoadFile
:closeFile _CloseGS closeRec :closeFile _CloseGS closeRec
clc clc
lda eofRec+4 ; File Size lda eofRec+4 ; File Size
rts rts
:openReadErr jsr :closeFile :openReadErr jsr :closeFile
@ -427,22 +486,22 @@ BG1AltDataFile strl '1/bg1b.bin'
ImageName strl '1/test.pic' ImageName strl '1/test.pic'
FGName strl '1/fg1.bin' FGName strl '1/fg1.bin'
openRec dw 2 ; pCount openRec dw 2 ; pCount
ds 2 ; refNum ds 2 ; refNum
adrl FGName ; pathname adrl FGName ; pathname
eofRec dw 2 ; pCount eofRec dw 2 ; pCount
ds 2 ; refNum ds 2 ; refNum
ds 4 ; eof ds 4 ; eof
readRec dw 4 ; pCount readRec dw 4 ; pCount
ds 2 ; refNum ds 2 ; refNum
ds 4 ; dataBuffer ds 4 ; dataBuffer
ds 4 ; requestCount ds 4 ; requestCount
ds 4 ; transferCount ds 4 ; transferCount
closeRec dw 1 ; pCount closeRec dw 1 ; pCount
ds 2 ; refNum ds 2 ; refNum
qtRec adrl $0000 qtRec adrl $0000
da $00 da $00
@ -454,6 +513,66 @@ qtRec adrl $0000
PUT gen/App.TileMapBG0.s PUT gen/App.TileMapBG0.s
PUT gen/App.TileMapBG1.s PUT gen/App.TileMapBG1.s
PUT gen/App.TileSetAnim.s

View File

@ -2,4 +2,36 @@
<tileset version="1.5" tiledversion="1.7.2" name="App.TileSet" tilewidth="8" tileheight="8" tilecount="1000" columns="40"> <tileset version="1.5" tiledversion="1.7.2" name="App.TileSet" tilewidth="8" tileheight="8" tilecount="1000" columns="40">
<transformations hflip="1" vflip="1" rotate="0" preferuntransformed="0"/> <transformations hflip="1" vflip="1" rotate="0" preferuntransformed="0"/>
<image source="../tilesets/smb-16.png" trans="6b8cff" width="320" height="200"/> <image source="../tilesets/smb-16.png" trans="6b8cff" width="320" height="200"/>
<tile id="168">
<animation>
<frame tileid="168" duration="256"/>
<frame tileid="170" duration="256"/>
<frame tileid="172" duration="256"/>
<frame tileid="174" duration="256"/>
</animation>
</tile>
<tile id="169">
<animation>
<frame tileid="169" duration="256"/>
<frame tileid="171" duration="256"/>
<frame tileid="173" duration="256"/>
<frame tileid="175" duration="256"/>
</animation>
</tile>
<tile id="208">
<animation>
<frame tileid="208" duration="256"/>
<frame tileid="210" duration="256"/>
<frame tileid="212" duration="256"/>
<frame tileid="214" duration="256"/>
</animation>
</tile>
<tile id="209">
<animation>
<frame tileid="209" duration="256"/>
<frame tileid="211" duration="256"/>
<frame tileid="213" duration="256"/>
<frame tileid="215" duration="256"/>
</animation>
</tile>
</tileset> </tileset>

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<export target="world_1-1.json" format="json"/> <export target="world_1-1.json" format="json"/>
</editorsettings> </editorsettings>
<tileset firstgid="1" source="Overworld.tsx"/> <tileset firstgid="1" source="Overworld.tsx"/>
<layer id="3" name="App.TileMapBG1" width="256" height="30" parallaxx="0.5" parallaxy="0.5"> <layer id="3" name="App.TileMapBG1" width="256" height="30" locked="1" parallaxx="0.5" parallaxy="0.5">
<data encoding="csv"> <data encoding="csv">
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
@ -38,7 +38,7 @@
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41
</data> </data>
</layer> </layer>
<layer id="1" name="App.TileMapBG0" width="256" height="30" visible="0" locked="1"> <layer id="1" name="App.TileMapBG0" width="256" height="30">
<data encoding="csv"> <data encoding="csv">
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
@ -64,8 +64,8 @@
41,41,41,41,57,58,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,57,58,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
41,41,41,56,21,62,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,56,21,62,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,11,12,13,14,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
41,41,56,21,21,21,21,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,57,2147483705,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,56,21,21,21,21,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,57,2147483705,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,15,16,17,18,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
41,56,21,62,21,21,62,21,59,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,43,42,43,42,43,41,41,41,56,21,62,2147483704,41,41,41,41,41,41,41,41,41,41,41,42,43,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,42,43,42,43,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,56,21,62,21,21,62,21,59,41,41,41,169,170,169,170,169,170,169,170,169,170,41,41,42,43,42,43,42,43,41,41,41,56,21,62,2147483704,41,41,41,41,41,41,41,41,41,41,41,42,43,41,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,41,42,43,42,43,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
56,21,21,21,21,21,21,21,21,59,41,41,41,41,41,41,41,41,41,41,41,41,41,44,45,45,45,45,45,45,46,41,56,21,21,21,21,2147483704,41,41,41,41,41,41,41,41,41,44,45,45,46,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,44,45,45,45,45,46,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 56,21,21,21,21,21,21,21,21,59,41,41,209,210,209,210,209,210,209,210,209,210,41,44,45,45,45,45,45,45,46,41,56,21,21,21,21,2147483704,41,41,41,41,41,41,41,41,41,44,45,45,46,41,41,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,19,20,21,22,41,41,41,44,45,45,45,45,46,41,41,41,19,20,21,22,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,
3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4, 3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,3,4,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -112,11 +112,11 @@ App_TileMapBG0
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1038,$0015,$003e,$0015,$0015,$003e,$0015,$103b,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102a,$102b,$102a,$102b,$102a,$102b,$1029,$1029,$1029,$1038,$0015,$003e,$1238,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102a,$102b,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029 dw $1029,$1038,$0015,$003e,$0015,$0015,$003e,$0015,$103b,$1029,$1029,$1029,$0800,$0801,$0800,$0801,$0800,$0801,$0800,$0801,$0800,$0801,$1029,$1029,$102a,$102b,$102a,$102b,$102a,$102b,$1029,$1029,$1029,$1038,$0015,$003e,$1238,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102a,$102b,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$102a,$102b,$102a,$102b,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$102a,$102b,$102a,$102b,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1038,$0015,$0015,$0015,$0015,$0015,$0015,$0015,$0015,$103b,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102c,$002d,$002d,$002d,$002d,$002d,$002d,$102e,$1029,$1038,$0015,$0015,$0015,$0015,$1238,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102c,$002d,$002d,$102e,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029 dw $1038,$0015,$0015,$0015,$0015,$0015,$0015,$0015,$0015,$103b,$1029,$1029,$0802,$0803,$0802,$0803,$0802,$0803,$0802,$0803,$0802,$0803,$1029,$102c,$002d,$002d,$002d,$002d,$002d,$002d,$102e,$1029,$1038,$0015,$0015,$0015,$0015,$1238,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$102c,$002d,$002d,$102e,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$102c,$002d,$002d,$002d,$002d,$102e,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$102c,$002d,$002d,$002d,$002d,$102e,$1029,$1029,$1029,$1013,$0014,$0015,$1016,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029
dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029 dw $1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029,$1029

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
TileAnimInit ENT
ldx #168
ldy #0
jsl CopyTileToDyn
ldx #169
ldy #1
jsl CopyTileToDyn
ldx #208
ldy #2
jsl CopyTileToDyn
ldx #209
ldy #3
jsl CopyTileToDyn
lda #TileAnim_168
ldx #^TileAnim_168
ldy #15
jsl StartScript
lda #TileAnim_169
ldx #^TileAnim_169
ldy #15
jsl StartScript
lda #TileAnim_208
ldx #^TileAnim_208
ldy #15
jsl StartScript
lda #TileAnim_209
ldx #^TileAnim_209
ldy #15
jsl StartScript
rts
TileAnim_168
dw $8006,168,0,0
dw $8006,170,0,0
dw $8006,172,0,0
dw $cd06,174,0,0
TileAnim_169
dw $8006,169,1,0
dw $8006,171,1,0
dw $8006,173,1,0
dw $cd06,175,1,0
TileAnim_208
dw $8006,208,2,0
dw $8006,210,2,0
dw $8006,212,2,0
dw $cd06,214,2,0
TileAnim_209
dw $8006,209,3,0
dw $8006,211,3,0
dw $8006,213,3,0
dw $cd06,215,3,0

View File

@ -24,7 +24,7 @@
"build:assets-woz-fatbits": "node %npm_package_config_png2iigs% ./assets/woz-pixelated.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", "build:assets-woz-fatbits": "node %npm_package_config_png2iigs% ./assets/woz-pixelated.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin",
"build:assets-color-cycle": "node %npm_package_config_png2iigs% ./assets/rotopattern.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin", "build:assets-color-cycle": "node %npm_package_config_png2iigs% ./assets/rotopattern.png ./emu/bg1a.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/woz-shifted.png ./emu/bg1b.bin --start-index 6 && node %npm_package_config_png2iigs% ./assets/donut-plains-1-6-color.png ./emu/fg1.bin",
"build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --output-dir ./gen", "build:map": "node %npm_package_config_tiled2iigs% ./assets/tiled/world_1-1.json --output-dir ./gen",
"build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-16.png --as-tile-data --transparent-color-index 3 > ./gen/App.TileSet.s" "build:tiles": "node %npm_package_config_png2iigs% ./assets/tilesets/smb-16.png --max-tiles 224 --as-tile-data --transparent-color-index 3 > ./gen/App.TileSet.s"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -119,6 +119,15 @@ min mac
lda ]1 lda ]1
mout <<< mout <<<
; Macro to define script steps
ScriptStep MAC
IF #=]5
dw {]1+{{]5&#$000F}<<8}},]2,]3,]4
ELSE
dw ]1,]2,]3,]4
FIN
<<<
; Macros to use in the Masked Tile renderer ; Macros to use in the Masked Tile renderer
; ;
; ]1 : tiledata offset ; ]1 : tiledata offset
@ -174,3 +183,14 @@ transparent
sta: ]3+1,y sta: ]3+1,y
next next
eom eom

View File

@ -39,28 +39,12 @@ AnimatePath
; at a time . The slope of the lines are (X1 - X0) / Duration and (Y1 - Y0) / Duration. ; at a time . The slope of the lines are (X1 - X0) / Duration and (Y1 - Y0) / Duration.
; ;
; The tricky bit is that we *always* single-step in the "Y" direction (duration), so we ; The tricky bit is that we *always* single-step in the "Y" direction (duration), so we
; actaully need to use two differenct algorithms. ; actually need to use two differenct algorithms.
; ;
; If |X1 - X0| <= Duration, use a standard line-drawing approach (Bresenham's, DDA, etc.) ; If |X1 - X0| <= Duration, use a standard Bresenham's
; If |X1 - X0| > Duration, use the Run-Length Slice algorithm (https://www.phatcode.net/res/224/files/html/ch36/36-02.html) ; If |X1 - X0| > Duration, use the Run-Length Slice algorithm (https://www.phatcode.net/res/224/files/html/ch36/36-02.html)
lda AnimX1
lda AnimY lda AnimY
:stepx lda
cmp AnimDuration ; Handle the two cases cmp AnimDuration ; Handle the two cases

View File

@ -109,3 +109,13 @@ DIRTY_BIT_BG1_X equ $0004
DIRTY_BIT_BG1_Y equ $0008 DIRTY_BIT_BG1_Y equ $0008
DIRTY_BIT_BG0_REFRESH equ $0010 DIRTY_BIT_BG0_REFRESH equ $0010
DIRTY_BIT_BG1_REFRESH equ $0020 DIRTY_BIT_BG1_REFRESH equ $0020
; Script definition
YIELD equ $8000
JUMP equ $4000
SET_PALETTE_ENTRY equ $0002
SWAP_PALETTE_ENTRY equ $0004
SET_DYN_TILE equ $0006
CALLBACK equ $0010

View File

@ -7,12 +7,18 @@ EngineShutDown EXT
SetScreenMode EXT SetScreenMode EXT
ReadControl EXT ReadControl EXT
; Low-Level Functions
SetPalette EXT
GetVBLTicks EXT
; Tilemap functions
SetBG0XPos EXT SetBG0XPos EXT
SetBG0YPos EXT SetBG0YPos EXT
SetBG1XPos EXT SetBG1XPos EXT
SetBG1YPos EXT SetBG1YPos EXT
CopyBG0Tile EXT CopyBG0Tile EXT
CopyBG1Tile EXT CopyBG1Tile EXT
CopyTileToDyn EXT
Render EXT Render EXT
; Rotation ; Rotation
@ -40,3 +46,6 @@ ScreenAddr EXT
OneSecondCounter EXT OneSecondCounter EXT
BlitBuff EXT BlitBuff EXT

View File

@ -1,123 +1,153 @@
; Graphic screen initialization ; Graphic screen initialization
InitGraphics InitGraphics
jsr ShadowOn jsr _ShadowOn
jsr GrafOn jsr _GrafOn
lda #0 lda #0
jsr ClearToColor jsr _ClearToColor
lda #0 lda #0
jsr SetSCBs jsr _SetSCBs
ldx #DefaultPalette ldx #DefaultPalette
lda #0 lda #0
jsr SetPalette jsr _SetPalette
jsr _InitBG0 ; Initialize the background layers jsr _InitBG0 ; Initialize the background layers
jsr _InitBG1 jsr _InitBG1
lda #0 lda #0
jsr _ClearBG1Buffer jsr _ClearBG1Buffer
rts rts
DefaultPalette dw $0000,$007F,$0090,$0FF0 DefaultPalette dw $0000,$007F,$0090,$0FF0
dw $000F,$0080,$0f70,$0FFF dw $000F,$0080,$0f70,$0FFF
dw $0fa9,$0ff0,$00e0,$04DF dw $0fa9,$0ff0,$00e0,$04DF
dw $0d00,$078f,$0ccc,$0FFF dw $0d00,$078f,$0ccc,$0FFF
; Return the current border color ($0 - $F) in the accumulator ; Return the current border color ($0 - $F) in the accumulator
GetBorderColor lda #0000 _GetBorderColor lda #0000
sep #$20 sep #$20
ldal BORDER_REG ldal BORDER_REG
and #$0F and #$0F
rep #$20 rep #$20
rts rts
; Set the border color to the accumulator value. ; Set the border color to the accumulator value.
SetBorderColor sep #$20 ; ACC = $X_Y, REG = $W_Z SetBorderColor ENT
eorl BORDER_REG ; ACC = $(X^Y)_(Y^Z) jsr _SetBorderColor
and #$0F ; ACC = $0_(Y^Z) rtl
eorl BORDER_REG ; ACC = $W_(Y^Z^Z) = $W_Y
stal BORDER_REG _SetBorderColor sep #$20 ; ACC = $X_Y, REG = $W_Z
rep #$20 eorl BORDER_REG ; ACC = $(X^Y)_(Y^Z)
rts and #$0F ; ACC = $0_(Y^Z)
eorl BORDER_REG ; ACC = $W_(Y^Z^Z) = $W_Y
stal BORDER_REG
rep #$20
rts
; Clear to SHR screen to a specific color ; Clear to SHR screen to a specific color
ClearToColor ldx #$7D00 ;start at top of pixel data! ($2000-9D00) _ClearToColor
:clearloop dex ldx #$7D00 ;start at top of pixel data! ($2000-9D00)
dex :clearloop dex
stal SHR_SCREEN,x ;screen location dex
bne :clearloop ;loop until we've worked our way down to 0 stal SHR_SCREEN,x ;screen location
rts bne :clearloop ;loop until we've worked our way down to 0
rts
; Set a palette values ; Set a palette values
; A = palette number, X = palette address ; A = high word of palette data pointer, X = low word of palette data pointer, Y = palette number
SetPalette SetPalette ENT
and #$000F ; palette values are 0 - 15 and each palette is 32 bytes phb ; save old data bank
asl pha ; push 16-bit value
asl plb ; pop 8-bit bank register
asl tya
asl jsr _SetPalette
asl plb ; pop the other half og the 16-bit push off
txy plb ; restore the original data bank
tax rtl
]idx equ 0 ; A = palette number, X = palette address
lup 16 _SetPalette
lda: $0000+]idx,y and #$000F ; palette values are 0 - 15 and each palette is 32 bytes
stal SHR_PALETTES+]idx,x asl
]idx equ ]idx+2 asl
--^ asl
rts asl
asl
txy
tax
]idx equ 0
lup 16
lda: $0000+]idx,y
stal SHR_PALETTES+]idx,x
]idx equ ]idx+2
--^
rts
; Initialize the SCB ; Initialize the SCB
SetSCBs ldx #$0100 ;set all $100 scbs to A _SetSCBs
:scbloop dex ldx #$0100 ;set all $100 scbs to A
dex :scbloop dex
stal SHR_SCB,x dex
bne :scbloop stal SHR_SCB,x
rts bne :scbloop
rts
; Turn SHR screen On/Off ; Turn SHR screen On/Off
GrafOn sep #$20 _GrafOn
lda #$81 sep #$20
stal NEW_VIDEO_REG lda #$81
rep #$20 stal NEW_VIDEO_REG
rts rep #$20
rts
GrafOff sep #$20 _GrafOff
lda #$01 sep #$20
stal NEW_VIDEO_REG lda #$01
rep #$20 stal NEW_VIDEO_REG
rts rep #$20
rts
; Enable/Disable Shadowing. ; Enable/Disable Shadowing.
ShadowOn sep #$20 _ShadowOn
ldal SHADOW_REG sep #$20
and #$F7 ldal SHADOW_REG
stal SHADOW_REG and #$F7
rep #$20 stal SHADOW_REG
rts rep #$20
rts
_ShadowOff
sep #$20
ldal SHADOW_REG
ora #$08
stal SHADOW_REG
rep #$20
rts
_GetVBL
sep #$20
ldal VBL_HORZ_REG
asl
ldal VBL_VERT_REG
rol ; put V5 into carry bit, if needed. See TN #39 for details.
rep #$20
and #$00FF
rts
_WaitForVBL
sep #$20
:wait1 ldal VBL_STATE_REG ; If we are already in VBL, then wait
bmi :wait1
:wait2 ldal VBL_STATE_REG
bpl :wait2 ; spin until transition into VBL
rep #$20
rts
ShadowOff sep #$20
ldal SHADOW_REG
ora #$08
stal SHADOW_REG
rep #$20
rts
GetVBL sep #$20
ldal VBL_HORZ_REG
asl
ldal VBL_VERT_REG
rol ; put V5 into carry bit, if needed. See TN #39 for details.
rep #$20
and #$00FF
rts
WaitForVBL sep #$20
:wait1 ldal VBL_STATE_REG ; If we are already in VBL, then wait
bmi :wait1
:wait2 ldal VBL_STATE_REG
bpl :wait2 ; spin until transition into VBL
rep #$20
rts

View File

@ -86,13 +86,13 @@ _Render
; The code fields are locked in now and reder to be rendered ; The code fields are locked in now and reder to be rendered
jsr ShadowOff jsr _ShadowOff
; ldx #0 ; Blit the full virtual buffer to the screen ; ldx #0 ; Blit the full virtual buffer to the screen
; ldy #8 ; ldy #8
; jsr _BltRange ; jsr _BltRange
jsr ShadowOn jsr _ShadowOn
; ldx #0 ; Expose the top 8 rows ; ldx #0 ; Expose the top 8 rows
; ldy #8 ; ldy #8
@ -124,3 +124,4 @@ _Render
stz DirtyBits stz DirtyBits
rts rts

View File

@ -9,7 +9,7 @@
; ;
; The COMMAND word has its bits defined as: ; The COMMAND word has its bits defined as:
; ;
; bit 15 = 1 if the end of a sequece ; bit 15 = 1 if the end of a sequence
; bit 14 = 0 proceed to next action, 1 jump ; bit 14 = 0 proceed to next action, 1 jump
; bit 13 = 0 (Reserved) ; bit 13 = 0 (Reserved)
; bit 12 = 0 (Reserved) ; bit 12 = 0 (Reserved)
@ -22,6 +22,7 @@
; ----------------------------------------------------- ; -----------------------------------------------------
; $0002 SET_PALETTE_ENTRY ADDR COLOR ---- : Set the palette entry at ARG1 to the color in ARG2 ; $0002 SET_PALETTE_ENTRY ADDR COLOR ---- : Set the palette entry at ARG1 to the color in ARG2
; $0004 SWAP_PALETTE_ENTRY ADDR1 ADDR2 ---- : Swap the palette entries in ADDR1 <-> ADDR2 ; $0004 SWAP_PALETTE_ENTRY ADDR1 ADDR2 ---- : Swap the palette entries in ADDR1 <-> ADDR2
; $0006 SET_DYN_TILE TILE_ID DTILE_ID ---- : Copy data from TileData into Dynamic Tile Area
; $0010 CALLBACK LONG_ADDR PARAM : Call a user-defined function (JSL) with a parameter value in accumulator ; $0010 CALLBACK LONG_ADDR PARAM : Call a user-defined function (JSL) with a parameter value in accumulator
; Start a new script ; Start a new script
@ -37,16 +38,16 @@ StartScript ENT
phk phk
plb plb
phx ; Save the script array address phx ; Save the script array address
pha pha
lda #_DoScriptSeq ; Try to create a timer for this script lda #_DoScriptSeq ; Try to create a timer for this script
ldx #^_DoScriptSeq ldx #^_DoScriptSeq
clc clc
jsl AddTimer jsl AddTimer
bcs :err ; No timer slots available :( bcs :err ; No timer slots available :(
tax ; Initialize the UserData with the command pointer tax ; Initialize the UserData with the command pointer
pla pla
sta Timers+8,x sta Timers+8,x
pla pla
@ -56,117 +57,129 @@ StartScript ENT
rtl rtl
:err :err
pla ; Pop the values and return with the carry flag set pla ; Pop the values and return with the carry flag set
pla pla
plb plb
rtl rtl
; This routine executes script command until it encounters one with the STOP bit set. In some ; This routine executes script command until it encounters one with the STOP bit set. In some
; sense, the stop bit acts like a "yield" in high-levellanguages. ; sense, the stop bit acts like a "yield" in high-level languages.
_DoScriptSeq
phx ; save the timer index; will need to update user data at the end
phb ; save the current data bank
sep #$20 ; push the bank byte of the command list pointer on the stack ARG1 equ 2
ARG2 equ 4
ARG3 equ 6
_DoScriptSeq
phx ; save the timer index; will need to update user data at the end
phb ; save the current data bank
sep #$20 ; push the bank byte of the command list pointer on the stack
lda Timers+10,x lda Timers+10,x
pha pha
rep #$20 rep #$20
lda Timers+8,x ; get the current address of the command sequence lda Timers+8,x ; get the current address of the command sequence
tax tax
plb ; pop the bank plb ; pop the bank
; Now we are ready to process commands until reaching one with the STOP bit set. Each command ; Now we are ready to process commands until reaching one with the STOP bit set. Each command
; is 8 bytes, so we just have to do a very simple fetch/execute/increment loop. The only ; is 8 bytes, so we just have to do a very simple fetch/execute/increment loop. The only
; exception is handling the JUMP bit which requires moving the script pc stored in the ; exception is handling the JUMP bit which requires moving the script pc stored in the
; x-register. ; x-register.
:loop phx ; Save the command address _dss_loop phx ; Save the command address
txy ; Cache in the y-register
lda: 0,x ; Load the command word lda: 0,x ; Load the command word
pha ; Stash it pha ; Stash it
and #$001E ; Only have 16 built-in command. Use the _UserCallback and #$001E ; Only have 16 built-in commands. Use the _UserCallback
tax ; command for custom functionality tax ; command for custom functionality
jsr (:commands,x) jmp (_dss_commands,x)
lda 1,s ; Reload the command word _dss_commands dw _Null,_SetPalEntry,_SwapPalEntry,_SetDTile,_Null,_Null,_Null,_Null
dw _UserCallback,_Null,_Null,_Null,_Null,_Null,_Null,_Null
_dss_cmd_rtn
lda 1,s ; Reload the command word
; Move to the next instruction. If the JUMP bit is set, we move the address forward or ; Move to the next instruction. If the JUMP bit is set, we move the address forward or
; backward N commands (8 bytes at a time). If the JUMP bit is not set, then just move ; backward N commands (8 bytes at a time). If the JUMP bit is not set, then just move
; to the next entry. ; to the next entry.
bit #$4000 ; Just do a fall through and set the jump offset to bit #JUMP ; Just do a fall through and set the jump offset to
bne :move_addr ; a hard-coded value of 1 if the jump bit is not set bne :move_addr ; a hard-coded value of 1 if the jump bit is not set
:retry lda #$0100 :retry lda #$0100
:move_addr and #$0F00 ; mask out the number of commands to move :move_addr and #$0F00 ; mask out the number of commands to move
beq :retry ; Don't allow zeros; will cause infinite loop. Just advance by one. beq :retry ; Don't allow zeros; will cause infinite loop. Just advance by one.
xba ; put it in the low byte xba ; put it in the low byte
cmp #$0008 ; Sign-extend the 4-bit value cmp #$0008 ; Sign-extend the 4-bit value
bcc *+5 bcc *+5
ora #$FFF0 ora #$FFF0
asl ; multiply by 8 asl ; multiply by 8
asl asl
asl asl
clc clc
adc 3,s ; add it to the saved command address adc 3,s ; add it to the saved command address
sta 3,s sta 3,s
; Check to see if we stop on this instruction, or continue executing commands ; Check to see if we stop on this instruction, or continue executing commands
pla ; Reload the command word pla ; Reload the command word
plx ; Pop off the update command address plx ; Pop off the update command address
bit #$8000 ; If the stop bit is set, we're done with this sequence bit #YIELD ; If the stop bit is set, we're done with this sequence
beq :loop ; Otherwise, keep going and fetch the next command word beq _dss_loop ; Otherwise, keep going and fetch the next command word
txa ; save the current command address txa ; save the current command address
plb ; restore the data bank and the timer index plb ; restore the data bank and the timer index
plx plx
sta Timers+8,x ; store the command address back into the timer user data space sta Timers+8,x ; store the command address back into the timer user data space
rtl rtl
:commands dw _Null,_SetPalEntry,_SwapPalEntry,_Null,_Null,_Null,_Null,_Null
dw _UserCallback,_Null,_Null,_Null,_Null,_Null,_Null,_Null
ARG1 equ 2
ARG2 equ 4
ARG3 equ 6
; Implementation of the built-in commands ; Implementation of the built-in commands
_Null rts _Null brl _dss_cmd_rtn
_SetPalEntry _SetPalEntry
txy
ldx: ARG1,y ldx: ARG1,y
lda: ARG2,y lda: ARG2,y
stal SHR_PALETTES,x stal SHR_PALETTES,x
rts brl _dss_cmd_rtn
_SwapPalEntry txy _SwapPalEntry
ldx: ARG1,y ; Load palette values
ldx: ARG1,y ; Load palette values
ldal SHR_PALETTES,x ldal SHR_PALETTES,x
pha pha
ldx: ARG2,y ldx: ARG2,y
ldal SHR_PALETTES,x ldal SHR_PALETTES,x
ldx: ARG1,y ; and swap ldx: ARG1,y ; and swap
stal SHR_PALETTES,x stal SHR_PALETTES,x
ldx: ARG2,y ldx: ARG2,y
pla pla
stal SHR_PALETTES,x stal SHR_PALETTES,x
rts brl _dss_cmd_rtn
_UserCallback lda: ARG1,x _SetDTile
ldx: ARG1,y
lda: ARG2,y
tay
jsl CopyTileToDyn
brl _dss_cmd_rtn
_UserCallback
lda: ARG1,y
sta :dispatch+1 sta :dispatch+1
lda: ARG1+1,x lda: ARG1+1,y
sta :dispatch+2 sta :dispatch+2
lda: ARG3,x lda: ARG3,y
:dispatch jsl $000000 :dispatch jsl $000000
rts brl _dss_cmd_rtn

View File

@ -316,7 +316,7 @@ _UpdateBG0TileMap
; Handle fringe tiles -- if the fringe bit is set, then we need to get the fringe tile index ; Handle fringe tiles -- if the fringe bit is set, then we need to get the fringe tile index
; and merge the tiles before rendering ; and merge the tiles before rendering
bit #$TILE_FRINGE_BIT bit #TILE_FRINGE_BIT
beq :no_fringe beq :no_fringe
jsr _GetTileAddr jsr _GetTileAddr
tax tax
@ -675,3 +675,4 @@ _DrawRectBG1
pla pla
rts rts

View File

@ -29,6 +29,9 @@ TIMER_REC_SIZE equ 16
lastTick ds 2 lastTick ds 2
Timers ds TIMER_REC_SIZE*MAX_TIMERS Timers ds TIMER_REC_SIZE*MAX_TIMERS
GetVBLTicks ENT
jsr _GetVBLTicks
rtl
_GetVBLTicks _GetVBLTicks
PushLong #0 PushLong #0
_GetTick _GetTick
@ -150,6 +153,12 @@ DoTimers ENT
sec sec
sbc lastTick sbc lastTick
stx lastTick stx lastTick
; We don't want times to fire excessively. If the timer has nt been evaluated for over
; one second, then just skip processing and wait for the next call.
cmp #60
bcs :exit
jsr _DoTimers jsr _DoTimers
:exit plb :exit plb
@ -196,9 +205,9 @@ _DoTimers
:skip txa :skip txa
clc clc
adc #8 adc #TIMER_REC_SIZE
tax tax
cpx #8*MAX_TIMERS cpx #{TIMER_REC_SIZE*MAX_TIMERS}
bcc :loop bcc :loop
pla pla
@ -227,6 +236,24 @@ _DoTimers

View File

@ -118,7 +118,7 @@ SetScreenRect sty ScreenHeight ; Save the screen height
; Clear the SHR screen and then infill the defined field ; Clear the SHR screen and then infill the defined field
FillScreen lda #0 FillScreen lda #0
jsr ClearToColor jsr _ClearToColor
ldy ScreenY0 ldy ScreenY0
:yloop :yloop
@ -272,6 +272,48 @@ SetConst ; Need a blank line here,
sta: $0000,y sta: $0000,y
:bottom rts :bottom rts
; SetDPAddrs
;
; A = absolute address (largest)
; Y = offset
;
; Initializes a bank of direct page offsets
SetDPAddrs
lda #$0800
sta $F000,y
lda #$0700
sta $E000,y
lda #$0600
sta $D000,y
lda #$0500
sta $C000,y
lda #$0400
sta $B000,y
lda #$0300
sta $A000,y
lda #$0200
sta $9000,y
lda #$0100
sta: $8000,y
lda #$0800
sta $7000,y
lda #$0700
sta $6000,y
lda #$0600
sta $5000,y
lda #$0500
sta $4000,y
lda #$0400
sta $3000,y
lda #$0300
sta $2000,y
lda #$0200
sta $1000,y
lda #$0100
sta: $0000,y
rts
; SetAbsAddrs ; SetAbsAddrs
; ;
; A = absolute address (largest) ; A = absolute address (largest)
@ -361,11 +403,17 @@ BuildBank
plb plb
plb plb
lda #$F000+{TWO_LYR_ENTRY} ; Set the address from each line to the next ; Change the patched value to one of DP_ENTRY, TWO_LYR_ENTRY or ONE_LYR_ENTRY based on the capabilities
; that the engine needs.
lda #$F000+{DP_ENTRY} ; Set the address from each line to the next
ldy #CODE_EXIT+1 ldy #CODE_EXIT+1
ldx #15*2 ldx #15*2
jsr SetAbsAddrs jsr SetAbsAddrs
ldy #DP_ADDR
jsr SetDPAddrs
ldy #$F000+CODE_EXIT ; Patch the last line with a JML to go to the next bank ldy #$F000+CODE_EXIT ; Patch the last line with a JML to go to the next bank
lda #{$005C+{TWO_LYR_ENTRY}*256} lda #{$005C+{TWO_LYR_ENTRY}*256}
sta [:target],y sta [:target],y
@ -480,7 +528,7 @@ odd_entry jmp $0100 ; unconditionally jump in
r_is_jmp sep #$41 ; Set the C and V flags which tells a snippet to push only the low byte r_is_jmp sep #$41 ; Set the C and V flags which tells a snippet to push only the low byte
long_2 ldal entry_jmp+1-base long_2 ldal entry_jmp+1-base
long_3 stal *+5-base long_3 stal *+5-base
jmp $0000 ; Jumps into the exception code, which return to r_jmp_rtn jmp $0000 ; Jumps into the exception code, which returns to r_jmp_rtn
; The next labels are special, in that they are entry points into special subroutines. They are special ; The next labels are special, in that they are entry points into special subroutines. They are special
; because they are within the first 256 bytes of each code field, which allows them to be selectable ; because they are within the first 256 bytes of each code field, which allows them to be selectable
@ -530,7 +578,7 @@ odd_exit ldal l_is_jmp+1-base
sep #$20 sep #$20
long_6 ldal l_is_jmp+3-base ; get the high byte of the PEA operand long_6 ldal l_is_jmp+3-base ; get the high byte of the PEA operand
; Fall-through when we have to push a byte on the left edge. Must be 8-bit on entry. Optimize ; Fall-through when we have to push a byte on the left edge. Must be 8-bit on entry. Optimized
; for the PEA $0000 case -- only 19 cycles to handle the edge, so pretty good ; for the PEA $0000 case -- only 19 cycles to handle the edge, so pretty good
:left_byte :left_byte
pha pha
@ -580,7 +628,7 @@ epilogue_1 tsc
; a. Overflow set -> Low 8-bit write and return to the next code field operand ; a. Overflow set -> Low 8-bit write and return to the next code field operand
; b. Overflow clear -> High 8-bit write and exit the line ; b. Overflow clear -> High 8-bit write and exit the line
; c. Always clear the Carry flags. It's actually OK to leave the overflow bit in ; c. Always clear the Carry flags. It's actually OK to leave the overflow bit in
; its passed state, because having the carry bit clear prevent evaluation of ; its passed state, because having the carry bit clear prevents evaluation of
; the V bit. ; the V bit.
; ;
; Snippet Samples: ; Snippet Samples:
@ -637,3 +685,11 @@ snippets lup 82
]index equ ]index+1 ]index equ ]index+1
--^ --^
top top

View File

@ -48,7 +48,7 @@ TILE_CTRL_MASK equ $1E00 ; Deliberatel
; Low-level function to take a tile descriptor and return the address in the tiledata ; Low-level function to take a tile descriptor and return the address in the tiledata
; bank. This is not too useful in the fast-path because the fast-path does more ; bank. This is not too useful in the fast-path because the fast-path does more
; incremental calculations, but it is handy for other utilitiy function ; incremental calculations, but it is handy for other utility functions
; ;
; A = tile descriptor ; A = tile descriptor
; ;
@ -58,7 +58,7 @@ _GetTileAddr
bit #2*TILE_HFLIP_BIT ; Check if the horizontal flip bit is set bit #2*TILE_HFLIP_BIT ; Check if the horizontal flip bit is set
beq :no_flip beq :no_flip
inc ; Set the LSB inc ; Set the LSB
:no_flip and #$02FF ; Mask out non-id bits :no_flip and #TILE_ID_MASK ; Mask out non-id bits
asl ; x4 asl ; x4
asl ; x8 asl ; x8
asl ; x16 asl ; x16
@ -529,7 +529,24 @@ DynamicTile
rep #$20 rep #$20
rts rts
; Helper function to copy tile data to the appropriate location in Bank 0 ; Helper functions to copy tile data to the appropriate location in Bank 0
; X = tile ID
; Y = dynamic tile ID
CopyTileToDyn ENT
txa
jsr _GetTileAddr
tax
tya
and #$001F ; Maximum of 32 dynamic tiles
asl
asl ; 4 bytes per page
adc BlitterDP ; Add to the bank 00 base address
adc #$0100 ; Go to the next page
tay
jsr CopyTileDToDyn ; Copy the tile data
rtl
; X = address of tile ; X = address of tile
; Y = tile address in bank 0 ; Y = tile address in bank 0
CopyTileDToDyn CopyTileDToDyn
@ -681,7 +698,8 @@ dynamic
pla pla
asl asl
asl asl
xba ; Undo the x128 we just need x2 asl
xba ; Undo the x128 we just need x4
plx plx
brl DynamicTile brl DynamicTile
@ -824,3 +842,21 @@ _CopyBG1Tile
plx ; pop the x-register plx ; pop the x-register
plb ; restore the data bank and return plb ; restore the data bank and return
rts rts

View File

@ -133,6 +133,7 @@ async function main(argv) {
startIndex = getArg(argv, '--start-index', x => parseInt(x, 10), 0); startIndex = getArg(argv, '--start-index', x => parseInt(x, 10), 0);
asTileData = getArg(argv, '--as-tile-data', null, 0); asTileData = getArg(argv, '--as-tile-data', null, 0);
maxTiles = getArg(argv, '--max-tiles', x => parseInt(x, 10), 64);
transparentColor = getArg(argv, '--transparent-color-index', x => parseInt(x, 10), -1); transparentColor = getArg(argv, '--transparent-color-index', x => parseInt(x, 10), -1);
transparentIndex = transparentColor; transparentIndex = transparentColor;
@ -175,7 +176,7 @@ async function main(argv) {
if (buff && argv[1]) { if (buff && argv[1]) {
if (asTileData) { if (asTileData) {
writeToTileDataSource(buff, png.width / 2); writeToTileDataSource(buff, png.width / 2, maxTiles);
} }
else { else {
console.log(`; Writing to output file ${argv[1]}`); console.log(`; Writing to output file ${argv[1]}`);
@ -355,14 +356,12 @@ function buildMerlinCodeForTiles(tiles, label='tiledata') {
return sb.toString(); return sb.toString();
} }
function writeToTileDataSource(buff, width) { function writeToTileDataSource(buff, width, MAX_TILES = 64) {
console.log('tiledata ENT'); console.log('tiledata ENT');
console.log(); console.log();
console.log('; Reserved space (tile 0 is special...'); console.log('; Reserved space (tile 0 is special...');
console.log(' ds 128'); console.log(' ds 128');
const MAX_TILES = 64;
let count = 0; let count = 0;
for (let y = 0; ; y += 8) { for (let y = 0; ; y += 8) {
for (let x = 0; x < width; x += 4, count += 1) { for (let x = 0; x < width; x += 4, count += 1) {

View File

@ -102,7 +102,7 @@ function writeTileAnimations(filename, animations) {
// Create code to copy it into the dynamic tile index location // Create code to copy it into the dynamic tile index location
init.appendLine(' ldx #' + firstTileId); init.appendLine(' ldx #' + firstTileId);
init.appendLine(' ldy #' + animation.dynTileId); init.appendLine(' ldy #' + animation.dynTileId);
init.appendLine(' jsr CopyTileToDyn'); init.appendLine(' jsl CopyTileToDyn');
} }
// Next, create the scripts to change the tile data based on the configured ticks delays. // Next, create the scripts to change the tile data based on the configured ticks delays.
@ -122,13 +122,30 @@ function writeTileAnimations(filename, animations) {
init.appendLine(` ldy #${numTicks}`); init.appendLine(` ldy #${numTicks}`);
init.appendLine(` jsl StartScript`); init.appendLine(` jsl StartScript`);
scripts.appendLine(label); // bit 15 = 1 if the end of a sequence
for (let i = 0; i < frames.length ; i += 1) { // bit 14 = 0 proceed to next action, 1 jump
const last = (i === (frames.length - 1)); // bit 13 = 0 (Reserved)
const command = 'YIELD+SET_DYN_TILE' + (last ? '+JUMP' : ''); // bit 12 = 0 (Reserved)
const jump = last ? `,-${frames.length - 1}` : ''; // bit 11 - 8 = signed jump displacement F = -1, E = -2, D = -3, C = -4, B = -5, A = -6, 9 = -7, 8 = -8, 7 = 7, 6 = 6, ....
// bit 8 - 0 = command number
const YIELD = 0x8000;
const JUMP = 0x4000;
const SET_DYN_TILE = 0x0006; // Command number
scripts.appendLine(` dw ${command},${frames[i].tileId},${animation.dynTileId}${jump}`); scripts.appendLine(label);
const lastValidIndex = frames.length - 1;
for (let i = 0; i < frames.length ; i += 1) {
const isLast = (i === lastValidIndex);
let command = YIELD | SET_DYN_TILE;
if (isLast) {
command |= JUMP;
const offset = ((0x0010 - lastValidIndex) & 0x000F) * 256;
command |= offset;
}
command = '$' + toHex(command, 4);
// scripts.appendLine(` ScriptStep #${command};#${frames[i].tileId};#${animation.dynTileId};#0`);
scripts.appendLine(` dw ${command},${frames[i].tileId},${animation.dynTileId},0`);
} }
} }
@ -242,11 +259,11 @@ async function main(argv) {
console.log(`Writing tiles to ${outputFilename}`); console.log(`Writing tiles to ${outputFilename}`);
writeTiles(outputFilename, tiles); writeTiles(outputFilename, tiles);
console.log(`Writing complete`); console.log(`Writing complete`);
// Look for tiles with animation sequences. If found, this information need to be propagated // Look for tiles with animation sequences. If found, this information need to be propagated
// to the tilemap export to mark those tile IDs as Dynamic Tiles. // to the tilemap export to mark those tile IDs as Dynamic Tiles.
// //
// Exporting the "animations" actually created two code stubs; one to copy the first // Exporting the "animations" actually creates two code stubs; one to copy the first
// tile of the animation into the dynamic tile space during initialization and a second // tile of the animation into the dynamic tile space during initialization and a second
// that created the timer callbacks that replace the tile data based on the time animation // that created the timer callbacks that replace the tile data based on the time animation
// rate. We only have a VBL timer, so the animation time is rounded to the nearest // rate. We only have a VBL timer, so the animation time is rounded to the nearest
@ -257,7 +274,12 @@ async function main(argv) {
writeTileAnimations(animationFilename, animations); writeTileAnimations(animationFilename, animations);
console.log(`Writing complete`); console.log(`Writing complete`);
// Modify the entries in the tileset that are animated
for (const animation of animations) {
tiles[animation.tileId].animation = animation;
}
} }
bg0TileSet = tiles; bg0TileSet = tiles;
} }
@ -351,6 +373,7 @@ function emitLayerData(sb, layer, tileset) {
*/ */
function convertTileID(tileId, tileset) { function convertTileID(tileId, tileset) {
const GTE_MASK_BIT = 0x1000; const GTE_MASK_BIT = 0x1000;
const GTE_DYN_BIT = 0x0800;
const GTE_VFLIP_BIT = 0x0400; const GTE_VFLIP_BIT = 0x0400;
const GTE_HFLIP_BIT = 0x0200; const GTE_HFLIP_BIT = 0x0200;
const TILED_VFLIP_BIT = 0x40000000; const TILED_VFLIP_BIT = 0x40000000;
@ -375,5 +398,16 @@ function convertTileID(tileId, tileset) {
// because a special zero tile is inserted, but we have to manually adjust here // because a special zero tile is inserted, but we have to manually adjust here
const mask_bit = !tileset[tileIndex - 1].isSolid; const mask_bit = !tileset[tileIndex - 1].isSolid;
return (tileId & 0x1FFFFFFF) + (mask_bit ? GTE_MASK_BIT : 0) + (hflip ? GTE_HFLIP_BIT : 0) + (vflip ? GTE_VFLIP_BIT : 0); // Build up a partial set of control bits
let control_bits = (mask_bit ? GTE_MASK_BIT : 0) + (hflip ? GTE_HFLIP_BIT : 0) + (vflip ? GTE_VFLIP_BIT : 0);
// Check if this is an animated tile. If so, substitute the index of the animation slot for
// the tile ID
if (tileset[tileIndex - 1].animation) {
const animation = tileset[tileIndex - 1].animation;
tileId = animation.dynTileId;
control_bits = GTE_DYN_BIT;
}
return (tileId & 0x1FFFFFFF) + control_bits;
} }