martinpiper / BDD6502

Behaviour Driven Development with 6502 code
27 stars 2 forks source link

Can't send pull request #5

Closed oziphantom closed 8 years ago

oziphantom commented 8 years ago

I have a bunch of changes and enhancements for this on my machines, but I can't sync the branch or send you a pull request for it.

The update includes These new methods

_I have a simple overclocked 6502 system _- disables the delay that makes the 6502 1Mhz

That does fail on BRK - this will cause a test to fail if CPU hits a BRK, so you can put BRKs into code like an assert/check to see if the code enters no mans land

That does exit on BRK - just stops running as if it has rts'ed everything, this lets you put in artificial stops for extra checks.

I load bin “XXXX” at XXXX - lets you load any file ( sans PRG 2 byte header ) into RAM, useful for loading in test levels and other data

I enable trace - turn on trace in the middle of a feature, so you just get the code you want, and not a 100MB text file

I disable trace - turns it off again

I execute the procedure at XXXX until XXXX = XX(XX|XX) - runs code until a memory location(s) is a certain value, normally in code you have a Frame lock, that code waits for. For the test you can change that code to inc a Frame counter, then use this function to run the code for N frames. The XX(XX|XX) is Automagical expansion - if you ask for 200 at $600 it checks just $600, if you ask for a word like 1500 frames, from $600 it will check $600 and $601, if you ask for a long 100,000 frames it will check $600,$601 and $602

I expect to see XXXX less than XX I expect to see XXXX greater than XX check to see if memory is above or below a value

I expect to see register a|x|y|st to be less than XX I expect to see register a|x|y|st to be greater than XX check to see if register is above or below a value

Joystick 1|2 is NONE|U|D|L|R|FIRE|UFIRE|ULFIRE|URFIRE|DFIRE|DLFIRE|DRFIRE|LFIRE|RFIRE No more write $dc00 with X, this sets DC00 or DC01 with the "normal" values for this direction, as taken from BASIC without any modifications to the DCXX range

Enhancements 6502 can now be overclocked ( i.e no delay ) which made my 9seconds tests become 3 seconds so it is not the bottle neck but still a good boost

Trace functionality, I have removed the extra line and made it write out a label for the address

1B5F  E8        INX           A:00 X:01 Y:00 F:20 S:1FD [..-.....]
1B60  E8        INX           A:00 X:02 Y:00 F:20 S:1FD [..-.....]
1B61  20 70 10  JSR $1070     A:00 X:02 Y:00 F:20 S:1FB [..-.....]
convertXSingleByteEntX:
1070  BD 40 C0  LDA $C040,X   A:FF X:02 Y:00 F:A0 S:1FB [N.-.....]
1073  D0 07     BNE $07       A:FF X:02 Y:00 F:A0 S:1FB [N.-.....]
convertXSingleByteEntX__notMSB:
107C  BD 20 C0  LDA $C020,X   A:98 X:02 Y:00 F:A0 S:1FB [N.-.....]
107F  38        SEC           A:98 X:02 Y:00 F:A1 S:1FB [N.-....C]

New testing based Opcodes

$02 PAT - Push A Test
$12 PXT - Push X Test
$22 PYT - Push Y Test
$32 TTA - Test Test A
$42 TTX - Test Test X
$52 TTY - Test Test Y

P?T - this pushes the register onto a separate stack, a new stack is added per JSR level and if one was made it is removed upon RTS TT? - makes sure that the current value of ? matches what is in the current "stack frame" So you write some code and you make the subroutine not change X, and the code is fine, you make a bug fix or use the subroutine elsewhere 2 months later and make it change X. This breaks your old code and you might notice a bug you might not. These opcodes can be used to "assert" that it is true, and fail when it changes.

martinpiper commented 8 years ago

I've made you a collaborator. See if you can push updates now.

martinpiper commented 8 years ago

I don't see a fork of the BDD6502 project in your repositories list. So if you forked it maybe it's private in your repo? Or maybe you didn't fork my repo in the first place so github doesn't allow pull requests back into my repo?

Anyway, thank you for the large number of code changes. Let's try to get them merged in soon. :)

martinpiper commented 8 years ago

Merged :)