`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`1
`;
`ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕͻ
`2
`;∫Move routines except for enemies ∫
`3
`;
`ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕͼ
`4
`
`5
`;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`6
`;≥GETFIRECLICK ≥
`7
`;≥ ≥
`8
`;≥Checks for the first frame where a firebutton is pressed ≥
`9
`;≥ ≥
`10 ;≥Parameters: - ≥
`11 ;≥Returns: Carry=1 if pressed ≥
`12 ;≥Modifies: A ≥
`13 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`14
`15 getfireclick: lda joystick
`16 and #JOY_FIRE
`17 beq gfc_not
`18 lda prevjoy
`19 and #JOY_FIRE
`20 bne gfc_not
`21 sec
`22 rts
`23 gfc_not: clc
`24 rts
`25
`26 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`27 ;≥GETCONTROLS ≥
`28 ;≥ ≥
`29 ;≥Takes controls from joystickport 2 ≥
`30 ;≥ ≥
`31 ;≥Parameters: - ≥
`32 ;≥Returns: - ≥
`33 ;≥Modifies: A ≥
`34 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`35
`36 getcontrols: lda #$ff
`37 sta $dc00
`38 lda joystick
`39 sta prevjoy
`40 lda $dc00
`41 eor #$ff
`
`Kendyl Román
`
`Ex. 1032
`0001
`
`1 of 37
`IBG 1043
`CBM of U.S. Patent No. 7,693,768
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`42 sta joystick
`43
`44 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`45 ;≥SCANKEYS ≥
`46 ;≥ ≥
`47 ;≥Reads keyboard. Ripped from Jukka TapanimÑki's C64 game programming guide. ≥
`48 ;≥ ≥
`49 ;≥Parameters: - ≥
`50 ;≥Returns: - ≥
`51 ;≥Modifies: A,X,Y ≥
`52 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`53
`54 scankeys: lda #$ff
`55 sta keyval
`56 ldy #$07
`57 sk_rowloop: lda rowbit,y
`58 sta $dc00
`59 ldx $dc01
`60 cpx #$ff
`61 bne sk_keyfound
`62 dey
`63 bpl sk_rowloop
`64 lda #$ff
`65 sta lastkey
`66 rts
`67 sk_keyfound: sty keytemp
`68 ldy #7
`69 sk_getcol: txa
`70 and colbit,y
`71 beq sk_colfound
`72 dey
`73 bpl sk_getcol
`74 sk_colfound: ldx keytemp
`75 tya
`76 clc
`77 adc rowval,x
`78 cmp lastkey
`79 beq sk_samekey
`80 sta keyval
`81 sta lastkey
`82 sk_samekey: rts
`83
`84 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`Ex. 1032
`Kendyl Román
`0002
`
`2 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`85 ;≥INITPLAYER ≥
`86 ;≥INITNEXTLIFE ≥
`87 ;≥ ≥
`88 ;≥Initializes player in different ways. INITPLAYER resets lives & score, ≥
`89 ;≥INITNEXTLIFE inits energy. ≥
`90 ;≥ ≥
`91 ;≥Parameters: - ≥
`92 ;≥Returns: - ≥
`93 ;≥Modifies: A ≥
`94 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`95
`96 initplayer: lda #$00
`97 ldx #prevscore-score-1
`98 initplayerloop: sta score,x
`99 dex
`100 bpl initplayerloop
`101 sta shpd
`102 lda #$05
`103 sta extracmp
`104 lda #$03
`105 sta lives
`106 jmp inl_maxpower
`107 initnextlife: lda #SHP_PLRRUN
`108 sta shpt
`109 ldx #$ff
`110 stx shporg
`111 inx
`112 stx shpf
`113 stx shpfd
`114 stx shpsy
`115 stx shpbits
`116 stx firedelay
`117 stx drunk
`118 lda #150 ;Immortality for 3 seconds
`119 sta shpimm
`120 inl_maxpower: lda #PLR_MAXPOWER
`121 sta shpp
`122 rts
`123
`124 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`125 ;≥CHECKDEATH ≥
`126 ;≥ ≥
`127 ;≥Initializes new life/ends game when out of lives. ≥
`Ex. 1032
`Kendyl Román
`0003
`
`3 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`128 ;≥ ≥
`129 ;≥Parameters: - ≥
`130 ;≥Returns: - ≥
`131 ;≥Modifies: A ≥
`132 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`133
`134 isdead: lda shpt
`135 beq dead
`136 cmp #SHP_PLRDEAD
`137 dead: rts
`138
`139 checkdeath: jsr isdead
`140 beq chd_noskip
`141 chd_notyet: rts
`142 chd_noskip: inc deadcnt ;Wait 200 frames after death
`143 lda deadcnt
`144 cmp #200
`145 bcc chd_notyet
`146 chd_livesdec: dec lives ;Decrease lives
`147 beq chd_gameover ;Go to gameover if out of them
`148 jsr leveltune_nocheck
`149 jsr initnextlife
`150 lda lastxl
`151 sta shpxl
`152 lda lastxh
`153 sta shpxh
`154 lda lastyl
`155 sta shpyl
`156 lda lastyh
`157 sta shpyh
`158 lda lastt
`159 sta shpt
`160 rts
`161 chd_gameover: pla ;Jump directly out of the main loop
`162 pla
`163 jmp gameover
`164
`165
`166 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`167 ;≥MOVPLR ≥
`168 ;≥ ≥
`169 ;≥Player move routines (running, jumping, ducking, climbing) ≥
`170 ;≥ ≥
`Ex. 1032
`Kendyl Román
`0004
`
`4 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`171 ;≥Parameters: X:actor number (0) ≥
`172 ;≥Returns: - ≥
`173 ;≥Modifies: A,Y ≥
`174 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`175
`176 movplr_drunk: lda drunk
`177 beq movplr_notdrunk
`178 dec drunkd
`179 bpl movplr_nodd
`180 lda #$08 ;If player character has
`181 sta drunkd ;drunk alcohol, use random
`182 dec drunk ;controls
`183 jsr random
`184 and #JOY_LEFT+JOY_RIGHT
`185 sta drunkrnd
`186 movplr_nodd: lda joystick
`187 beq movplr_notdrunk
`188 and #JOY_UP+JOY_DOWN+JOY_FIRE
`189 ora drunkrnd
`190 sta joystick
`191 movplr_notdrunk:rts
`192
`193 movplr_run: jsr movplr_drunk
`194 lda shpbits,x ;Player jumping?
`195 and #$01
`196 beq movplr_nofly
`197 jmp movplr_fly
`198 movplr_nofly: jsr getcharpos ;Get char position
`199 jsr getcharinfo
`200 tay
`201 and #CI_WALK ;Feet under ground?
`202 bne movplr_nofall ;If not, fall
`203 lda #2
`204 sta shpsy,x
`205 jmp movplr_fall
`206 movplr_nofall: lda joystick ;Ducking?
`207 and #JOY_DOWN
`208 beq movplr_noduck
`209 tya ;Ladder?
`210 and #CI_CLIMB
`211 bne movplr_initclimb
`212 lda #SHP_PLRDUCK
`213 sta shpt,x
`Kendyl Román
`
`Ex. 1032
`0005
`
`5 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`214 jsr movecharposup1 ;Drop guitar next to an
`215 jsr getcharinfo ;amplifier? (weird feature)
`216 and #$10
`217 beq movplr_dnogtr
`218 lda #ITEM_GUITAR
`219 jsr finditem
`220 bcc movplr_dnogtr
`221 jsr decammo2
`222 ldx #$00
`223 movplr_gtrloop: lda lvlshpt,x
`224 beq movplr_gtrempty
`225 inx
`226 cpx #NUM_LVLSHP
`227 bcc movplr_gtrloop
`228 jmp movplr_nopickup
`229 movplr_gtrempty:lda #SHP_GUITAR
`230 sta lvlshpt,x
`231 lda #$01
`232 sta lvlshpp,x
`233 lda charmapx
`234 sta lvlshpx,x
`235 lda charmapy
`236 clc
`237 adc #$01
`238 sta lvlshpy,x
`239 jmp movplr_nopickup
`240 movplr_dnogtr: jsr pickup ;Picking up an item?
`241 movplr_nopickup:ldx #$00
`242 txa
`243 sta shpf,x
`244 rts
`245 movplr_noduck: lda joystick ;Initiate jump?
`246 and #JOY_UP
`247 beq movplr_nojump
`248 jsr movecharposup1
`249 jsr getcharinfo ;Go inside a door?
`250 sta scrolltemp3
`251 dec charmapy
`252 jsr getcharinfo ;Ladder?
`253 and #CI_CLIMB
`254 php
`255 jsr movecharposdown1
`256 inc charmapy
`Kendyl Román
`
`Ex. 1032
`0006
`
`6 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`257 plp
`258 beq movplr_noclup
`259 movplr_initclimb:
`260 lda shpxl,x ;Set X-position in the middle
`261 and #$e0 ;of the ladder
`262 clc
`263 adc #$10
`264 sta shpxl,x
`265 lda shpyl,x ;Round Y-position to an even
`266 and #$fe ;number
`267 sta shpyl,x
`268 lda #SHP_PLRCLIMB
`269 sta shpt,x
`270 lda #$00
`271 sta shpf,x
`272 sta shpfd,x
`273 rts
`274 movplr_noclup: lda prevjoy ;Prevent continuous jumping
`275 and #JOY_UP
`276 bne movplr_nojump
`277 lda scrolltemp3 ;Door?
`278 and #CI_DOOR
`279 beq movplr_nodoor
`280 jmp doorsearch
`281 movplr_nodoor: lda #SFX_JUMP
`282 jsr playsfx
`283 lda #-2 ;Init jump
`284 sta shpsy,x
`285 movplr_fall: lda #0
`286 sta shpfd,x
`287 lda #7
`288 sta shpf,x
`289 lda shpbits,x ;Flying bit on
`290 ora #$01
`291 sta shpbits,x
`292 rts
`293 movplr_nojump: lda joystick ;Moving left?
`294 and #JOY_LEFT
`295 beq movplr_notleft
`296 lda #1
`297 sta shpd,x
`298 jsr movecharposleft1
`299 jsr movecharposup1
`Kendyl Román
`
`Ex. 1032
`0007
`
`7 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`300 jsr getcharinfo
`301 and #CI_OBSTACLE ;Can player go left?
`302 bne movplr_nomove
`303 ldy #-2
`304 jsr moveshpx
`305 jsr checkstairs
`306 jmp movplr_anim
`307 movplr_notleft: lda joystick ;Moving right?
`308 and #JOY_RIGHT
`309 beq movplr_nomove
`310 lda #0
`311 sta shpd,x
`312 jsr movecharposright1
`313 jsr movecharposup1
`314 jsr getcharinfo
`315 and #CI_OBSTACLE ;Can player go right?
`316 bne movplr_nomove
`317 ldy #2
`318 jsr moveshpx
`319 jsr checkstairs
`320 jmp movplr_anim
`321 movplr_nomove: lda #6 ;No movement, set "standing"
`322 sta shpf,x ;frame
`323 lda #3
`324 sta shpfd,x
`325 rts
`326 movplr_anim: lda #$00
`327 inc shpfd,x ;Running animation
`328 ldy shpfd,x
`329 cpy #5
`330 bcc movplr_done ;New frame on every fifth
`331 sta shpfd,x ;frame
`332 inc shpf,x
`333 ldy shpf,x
`334 cpy #6
`335 bcc movplr_anot
`336 sta shpf,x
`337 tay
`338 movplr_anot: lda walksndtbl,y ;Footstep sound on every third
`339 beq movplr_done ;frame
`340 jsr playsfx
`341 movplr_done: rts
`342
`Kendyl Román
`
`Ex. 1032
`0008
`
`8 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`343 movplr_duck: jsr movplr_drunk
`344 lda joystick
`345 and #JOY_LEFT
`346 beq movplr_dnotl
`347 lda #1
`348 sta shpd,x
`349 jmp movplr_dcheck
`350 movplr_dnotl: lda joystick
`351 and #JOY_RIGHT
`352 beq movplr_dcheck
`353 lda #0
`354 sta shpd,x
`355 movplr_dcheck: lda joystick
`356 and #JOY_DOWN
`357 bne movplr_done
`358 lda #SHP_PLRRUN
`359 sta shpt,x
`360 jmp movplr_nomove
`361
`362 movplr_fly: jsr movplr_drunk
`363 inc shpfd,x
`364 ldy shpsy,x ;Motion in Y-direction
`365 jsr moveshpy
`366 jsr getcharpos ;Take charposition now
`367 ldy shpsy,x ;Going up or down?
`368 bpl movplr_fdown
`369 dec charmapy ;Move check position 4 chars up
`370 jsr getcharinfo
`371 inc charmapy
`372 and #CI_OBSTACLE ;Check obstacle at player's head
`373 beq movplr_fnohead
`374 lda #0 ;If an obstacle, zero y-speed
`375 sta shpsy,x ;(head bumped to ceiling)
`376 sta shpfd,x
`377 jmp movplr_fdown
`378 movplr_fnohead: lda joystick ;Player holding joystick up to
`379 and #JOY_UP ;prolong jump?
`380 beq movplr_fdown
`381 lda shpfd,x
`382 cmp #13
`383 bcc movplr_fno1
`384 jmp movplr_fincspd
`385 movplr_fdown: lda shpfd,x
`Kendyl Román
`
`Ex. 1032
`0009
`
`9 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`386 cmp #7
`387 bcc movplr_fno1
`388 movplr_fincspd: lda #0
`389 sta shpfd,x
`390 inc shpsy,x
`391 lda shpsy,x
`392 bmi movplr_fno1
`393 cmp #3 ;Y-speed must not be >2
`394 bcc movplr_fno1
`395 lda #2
`396 sta shpsy,x
`397 movplr_fno1: lda shpsy,x ;Check ground only if Y-speed
`398 bmi movplr_fside ;> 0
`399 beq movplr_fside
`400 jsr getcharinfo ;Ground under feet?
`401 and #CI_WALK
`402 bne movplr_flgrsfx
`403 movplr_fside: lda joystick ;Check for horizontal movement
`404 and #JOY_LEFT
`405 beq movplr_fnotl
`406 lda #1
`407 sta shpd,x
`408 jsr movecharposleft1
`409 jsr getcharinfo
`410 and #CI_OBSTACLE
`411 bne movplr_fgc
`412 ldy #-2
`413 jsr moveshpx
`414 jmp movplr_fgc
`415 movplr_fnotl: lda joystick
`416 and #JOY_RIGHT
`417 beq movplr_fgc
`418 lda #0
`419 sta shpd,x
`420 jsr movecharposright1
`421 jsr getcharinfo
`422 and #CI_OBSTACLE
`423 bne movplr_fgc
`424 ldy #2
`425 jsr moveshpx
`426
`427 movplr_fgc: jsr getcharpos
`428 lda shpsy,x
`Kendyl Román
`
`Ex. 1032
`0010
`
`10 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`429 bmi movplr_fngc
`430 beq movplr_fngc
`431 jsr getcharinfo
`432 and #CI_WALK
`433 beq movplr_fngc
`434 movplr_flgrsfx: lda #SFX_FOOTSTEP
`435 jsr playsfx
`436 movplr_flground:lda shpyl,x ;Player "landed", and Y-coord
`437 and #$f8 ;to "round" it on char boundary
`438 sta shpyl,x
`439 lda shpbits,x ;Zero the jumping bit
`440 and #$fe
`441 sta shpbits,x
`442 lda #0
`443 sta shpsy,x ;Zero Y-speed
`444 jmp movplr_nomove ;Set standing position
`445 movplr_fngc: rts
`446
`447 movplr_climb: jsr getcharpos
`448 lda joystick
`449 and #JOY_UP
`450 bne movplr_cup
`451 lda joystick
`452 and #JOY_DOWN
`453 bne movplr_cdown
`454 lda joystick ;Exit ladder to right?
`455 and #JOY_RIGHT
`456 beq movplr_crdone
`457 lda #0
`458 sta shpd,x
`459 jsr getcharinfo
`460 and #CI_WALK
`461 beq movplr_crdone
`462 lda #SHP_PLRRUN
`463 sta shpt,x
`464 jmp movplr_flground
`465 movplr_crdone: lda joystick ;Exit ladder to left?
`466 and #JOY_LEFT
`467 beq movplr_cdone
`468 lda #1
`469 sta shpd,x
`470 jsr getcharinfo
`471 and #CI_WALK
`Kendyl Román
`
`Ex. 1032
`0011
`
`11 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`472 beq movplr_cdone
`473 lda #SHP_PLRRUN
`474 sta shpt,x
`475 jmp movplr_flground
`476 movplr_cup: dec charmapy
`477 jsr movecharposup1
`478 jsr getcharinfo
`http://cadaver.homeftp.net/games/mwsrc.zip/p1ayer.s
`479 and #CI_CLIMB
`480 beq movplr_cdone
`beq
`movp;r_cdone
`481 ldy #-1
`lda
`#SHP_PLRRUN
`482 jsr moveshpy
`sta
`shpt,x
`483 jmp movplr_canim
`movp;r_flground
`jmp
`484 movplr_cdown: lda joystick
`dec
`movplr_cup:
`charmapy
`485 and #JOY_DOWN
`movecharposupl
`486 beq movplr_cdone
`getcharinfo
`487 jsr getcharinfo
`#CI_CLIM3
`488 and #CI_CLIMB
`movp;r_cdone
`489 beq movplr_cdone
`#—1
`490 ldy #1
`moveshpy
`491 jsr moveshpy
`movp;r_canim
`492 movplr_canim: inc shpfd,x ;Climbing animation
`movplr_cdown:
`joystick
`493 lda shpfd,x
`#JOY_DOWV
`494 cmp #4
`movp;r_cdone
`495 bcc movplr_cdone
`getcharinfo
`496 lda #0
`#CI_CLIM3
`497 sta shpfd,x
`movp;r_cdone
`498 lda shpf,x
`#1
`499 clc
`moveshpy
`500 adc #1
`shpfd,x
`movplr_canim:
`501 and #3
`shpfd,x
`502 sta shpf,x
`#4
`503 movplr_cdone: rts
`movplr_cdone
`504
`#0
`505 movplr_dead: inc shpfd,x
`shpfd,x
`506 lda shpfd,x
`shpf,x
`507 cmp #$05
`508 bne movplr_dead1
`#1
`509 lda #$00
`#3
`510 sta shpfd,x
`shpf,x
`511 lda shpsy,x
`movp;r_cdone:
`512 bmi movplr_dead2
`513 cmp #$04
`movp;r_dead:
`shpfd,x
`514 bcs movplr_dead1
`shpfd,x
`#$05
`Kendyl Román
`movplr_deadl
`#$00
`shpfd,x
`shpsy,x
`
`Ex. 1032
`0012
`
`;Climbing animation
`
`12 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`515 movplr_dead2: inc shpsy,x
`516 movplr_dead1: ldy shpsy,x
`517 jsr moveshpy
`518 rts
`519
`520 checkstairs: jsr getcharpos ;Walking into emptiness?
`521 jsr getcharinfo ;teen?
`522 and #CI_WALK
`523 bne stnot2 ;No, exit this routine!
`524 jsr movecharposup1 ;Check for stairs above and
`525 jsr getcharinfo ;below
`526 and #CI_WALK
`527 beq stnot1
`528 ldy #-8
`529 jsr moveshpy
`530 clc
`531 rts
`532 stnot1: ldy #2
`533 jsr movecharposdown
`534 jsr getcharinfo
`535 and #CI_WALK
`536 beq stempty
`537 ldy #8 ;Return carry 1 if no stairs
`538 jsr moveshpy ;found (initiate falling)
`539 stnot2: clc
`540 rts
`541 stempty: sec
`542 rts
`543
`544 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`545 ;≥MOVESHPX, MOVESHPY ≥
`546 ;≥ ≥
`547 ;≥Moves an actor. ≥
`548 ;≥ ≥
`549 ;≥Parameters: X:Actor number ≥
`550 ;≥ Y:Amount of movement in pixels ≥
`551 ;≥Returns: - ≥
`552 ;≥Modifies: A ≥
`553 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`554
`555 moveshpx: tya
`556 clc
`557 bmi mspx_neg
`Kendyl Román
`
`Ex. 1032
`0013
`
`13 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`558 adc shpxl,x
`559 sta shpxl,x
`560 lda shpxh,x
`561 adc #0
`562 sta shpxh,x
`563 rts
`564 mspx_neg: adc shpxl,x
`565 sta shpxl,x
`566 lda shpxh,x
`567 adc #$ff
`568 sta shpxh,x
`569 rts
`570
`571 moveshpy: tya
`572 clc
`573 bmi mspy_neg
`574 adc shpyl,x
`575 sta shpyl,x
`576 lda shpyh,x
`577 adc #0
`578 sta shpyh,x
`579 rts
`580 mspy_neg: adc shpyl,x
`581 sta shpyl,x
`582 lda shpyh,x
`583 adc #$ff
`584 sta shpyh,x
`585 donothing: rts
`586
`587 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`588 ;≥ITEMROUT ≥
`589 ;≥ ≥
`590 ;≥Item's move routine (falling) ≥
`591 ;≥ ≥
`592 ;≥Parameters: X:actor number ≥
`593 ;≥Returns: - ≥
`594 ;≥Modifies: A,Y ≥
`595 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`596
`597 itemrout: ldy shpsy,x
`598 beq itr_nomove
`599 jsr moveshpy
`600 inc shpfd,x
`Kendyl Román
`
`Ex. 1032
`0014
`
`14 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`601 lda shpfd,x
`602 cmp #$04
`603 bcc itr_not
`604 lda #$00
`605 sta shpfd,x
`606 inc shpsy,x
`607 lda shpsy,x
`608 cmp #$04
`609 bcc itr_not
`610 lda #$04
`611 sta shpsy,x
`612 itr_not: jsr getcharpos
`613 jsr getcharinfo
`614 and #CI_WALK
`615 bne itr_ground
`616 rts
`617 itr_ground: lda #$00
`618 sta shpsy,x
`619 lda shpyl,x
`620 and #$f8
`621 sta shpyl,x
`622 itr_nomove: rts
`623
`624 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`625 ;≥EXPLODE ≥
`626 ;≥ ≥
`627 ;≥Explosion animation routine. ≥
`628 ;≥ ≥
`629 ;≥Parameters: X:actor number ≥
`630 ;≥Returns: - ≥
`631 ;≥Modifies: A,Y ≥
`632 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`633
`634 explode: lda #$05
`635 sta explcheck+1
`636 explode2: inc shpfd,x
`637 lda shpfd,x
`638 cmp #$03
`639 bne exp_not
`640 lda #$00
`641 sta shpfd,x
`642 inc shpf,x
`643 ldy shpf,x
`Kendyl Román
`
`Ex. 1032
`0015
`
`15 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`644 explcheck: cpy #$05
`645 bne exp_not
`646 sta shpt,x
`647 exp_not: rts
`648 dblexpl: lda #$07
`649 sta explcheck+1
`650 bne explode2
`651
`652 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`653 ;≥SHRAPNEL ≥
`654 ;≥ ≥
`655 ;≥Shrapnel animation. ≥
`656 ;≥ ≥
`657 ;≥Parameters: X:actor number ≥
`658 ;≥Returns: - ≥
`659 ;≥Modifies: A,Y ≥
`660 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`661
`662 shrapnel: inc shpfd,x
`663 lda shpfd,x
`664 cmp #3
`665 bne shr_not
`666 lda #0
`667 sta shpfd,x
`668 inc shpf,x
`669 ldy shpf,x
`670 cpy #3
`671 bne shr_not
`672 sta shpt,x
`673 shr_not: rts
`674
`675 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒĿ
`676 ;≥BLOOD ≥
`677 ;≥ ≥
`678 ;≥Animation and movement of blood ≥
`679 ;≥ ≥
`680 ;≥Parameters: X:actor number ≥
`681 ;≥Returns: - ≥
`682 ;≥Modifies: A,Y ≥
`683 ;¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
`684
`685 blood: ldy #1
`686 jsr moveshpy
`Kendyl Román
`
`Ex. 1032
`0016
`
`16 of 37
`
`
`
`Ex. 1032
`http://cadaver.homeftp.net/games/mwsrc.zip/player.s
`
`687 inc shpfd,x
`688 lda shpfd,x
`689 cmp #3
`690 bne bld_not
`691 lda #0
`692 sta shpfd,x
`693 inc shpf,x
`694 ldy shpf,x
`695 cpy #2
`696 bne shr_not
`697 sta shpt,x
`698 bld_not: rts
`699
`700 ;⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ