The SPC-700's bootloader is tricky to use. One aspect is that the first upload is documented as requiring different steps than later ones. Documentation states that the first time, you must write $CC to begin, and for later ones, increment a value by 2 (or 3 if it would become zero).
I found that this distinction can be eliminated by using an increment of $22 instead of 2. This is because the initial value you read back is $AA, which yields the proper $CC after adding $22. And later, the loader only needs a value that's at least 2 greater than the current value.
The above means that you can initiate the first AND later uploads by adding $22 to the first register (or $23 if it would be zero). Another benefit is that you can immediately start execution, without having to upload anything first.
I've written a test that verifies that this works in all cases. It starts an upload, uploads one byte, then verifies that another can be started or that execute works at that point. It then does the same, uploading two bytes instead. Repeat through 300 bytes and it covers all cases.
I found that this distinction can be eliminated by using an increment of $22 instead of 2. This is because the initial value you read back is $AA, which yields the proper $CC after adding $22. And later, the loader only needs a value that's at least 2 greater than the current value.
The above means that you can initiate the first AND later uploads by adding $22 to the first register (or $23 if it would be zero). Another benefit is that you can immediately start execution, without having to upload anything first.
I've written a test that verifies that this works in all cases. It starts an upload, uploads one byte, then verifies that another can be started or that execute works at that point. It then does the same, uploading two bytes instead. Repeat through 300 bytes and it covers all cases.