Skip to content

Commit

Permalink
Prevent EntityTest common routines from changing DP
Browse files Browse the repository at this point in the history
  • Loading branch information
undisbeliever committed Oct 20, 2018
1 parent 946bf91 commit ee28469
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions unit_tests/src/tests/entity/_common.inc
Expand Up @@ -4,8 +4,8 @@

namespace EntityTest {

// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
// OUT: A = number of entities in free list
// MODIFIES: DP
a16()
i16()
code()
Expand All @@ -14,8 +14,8 @@ function _FreeListLength {
jmp Entity._CountEntitiesInListIndexX
}

// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
// OUT: A = number of entities in deactivated list
// MODIFIES: DP
a16()
i16()
code()
Expand All @@ -24,8 +24,8 @@ function _DeactivatedListLength {
jmp Entity._CountEntitiesInListIndexX
}

// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
// OUT: A = number of entities in the tryToActivateAgain list
// MODIFIES: DP
a16()
i16()
code()
Expand All @@ -35,8 +35,8 @@ function _TryToActivateAgainListLength {
}


// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
// OUT: A = number of entities in player list
// MODIFIES: DP
a16()
i16()
code()
Expand All @@ -51,8 +51,10 @@ function _FirstListLength {
// * deactivated lists have no metasprite data
// * active lists have metasprite data
// * total number of entities in all lists == Entity.N_ENTITIES
//
// REQUIRES: 16 bit A, 16 bit Index, DP = 0, DB = 0x7e
//
// OUT: C set if entity list OK
// MODIFIES: DP
a16()
i16()
code()
Expand Down Expand Up @@ -118,6 +120,10 @@ allocateTmpWord(tmp_count)
}


// restore DP
lda.w #0
tcd

jsr _FreeListLength
clc
adc.w tmp_count
Expand All @@ -135,9 +141,11 @@ Fail:

// Tests the entity list lengths against a
// list table.
//
// REQUIRES: 16 bit A, 16 bit Index, DP = 0, DB = 0x7e
//
// IN: X - address of list table (list of words, in rom0 data block)
// OUT: C set if entity list == table
// MODIFIES: DP
a16()
i16()
code()
Expand Down

0 comments on commit ee28469

Please sign in to comment.