.SOMEPROT LDY #2 \ Set a counter in Y to go from 2 to 2 + protlen, so \ we copy bytes from do65202 to end65C02 into byte #2 \ onwards in the parameter block pointed to by OSSC .SMEPRTL LDA do65C02-2,Y \ Copy the Y-th byte of do65202 to the Y+2-th byte of STA (OSSC),Y \ the OSWORD parameter block INY \ Increment the loop counter CPY #protlen+2 \ Loop back to copy the next byte until we have copied BCC SMEPRTL \ the whole of do65202 to end65C02 to the OSWORD block, \ so it can be run by the parasite RTS \ Return from the subroutineName: SOMEPROT [Show more] Type: Subroutine Category: Copy protection Summary: Implement the OSWORD 249 command (some copy protection) Deep dive: 6502 Second Processor Tube communicationContext: See this subroutine in context in the source code References: This subroutine is called as follows: * OSWVECS calls SOMEPROT
This routine is run when the parasite sends an OSWORD 249 command with a parameter block at OSSC(1 0). The parameter block is empty when the command is sent, and this routine copies the code between do65202 and end65C02 to the parameter block, just after the two size bytes.
When the parasite sends an OSWORD command to the I/O processor (i.e. an OSWORD with A = 240 to 255), then the relevant handler routine in the I/O processor is called with OSSC(1 0) pointing to the OSWORD parameter block (i.e. OSSC(1 0) = (Y X) from the original call in the I/O processor)
Label SMEPRTL is local to this routine
Subroutine do65C02 (category: Copy protection)
Reverse the order of all bytes between the addresses in (1 0) and (3 2) and start the game
Configuration variable: protlen = end65C02 - do65C02