You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we need a kind of test facility to use py65 for automatic testing of our code. how we want to achieve this?
the idea is to get mocks in place by adding "jsr hooks". currently such kind of callbacks are already there with the putc/getc memory observers. but we need a little more, we want to "fake" or mock some jsr to get tests in place.
think of this little example, where the tested code should run in simulator with a mocked sd_card instead of a real device.
lda...
adc..
jsr sd_card_read_block ; => this jsr we want to "hook" in and then let our mock run. which is not implemented in asm, but in python`
... more
before simulator start, a custom prepare is run
self.register_JSR_Hook("<symbol>" ) - ie. self.register_JSR_Hook("sd_card_read_block", sd_card_read_block_mock) => how to determine the adress from symbol?!?
sd_card_read_block is hooked with the current context of the mpu, means all regs, memory are available as usual.
def sd_card_read_block_mock(mpu): #mock funciton
if(mpu.WordAt(.... #dispatch behaviour upon mpu state
... _copy(test_data, mpu.memory[addr]).... # copy test data ie. sd blocks to mpu.memory and let the simulation go on
it does not make sense doing tests in this way. we found a solution by implementing our tests also in asm. the "opcode hook" is therefore not needed anymore.
hi,
we need a kind of test facility to use py65 for automatic testing of our code. how we want to achieve this?
the idea is to get mocks in place by adding "jsr hooks". currently such kind of callbacks are already there with the putc/getc memory observers. but we need a little more, we want to "fake" or mock some jsr to get tests in place.
think of this little example, where the tested code should run in simulator with a mocked sd_card instead of a real device.
before simulator start, a custom prepare is run
self.register_JSR_Hook("<symbol>" )
- ie.self.register_JSR_Hook("sd_card_read_block", sd_card_read_block_mock)
=> how to determine the adress from symbol?!?sd_card_read_block is hooked with the current context of the mpu, means all regs, memory are available as usual.
cheers,
https://steckschwein.de/
The text was updated successfully, but these errors were encountered: