Some insight on Bleepload Trigger

The “Bleepload Trigger” is an extra piece of data attached to the last “Bleepload” file in a chain that provides instructions on the data deciphering process and on the code to execute after such process completes.

So far TAPClean’s documentation wasn’t providing any further details about the structure of the 8 bytes in a trigger segment, so I just filled in those details:

2 bytes : Start address of cipher (LSBF)
2 bytes : Start address of RAM to decipher (LSBF)
2 bytes : End+1 address of RAM to decipher (LSBF)
2 bytes : Execution address (LSBF, CPU jumps here after block is deciphered)

Furthermore now TAPClean 0.37-pre9 decodes trigger blocks accordingly. As example, from “Bubble Bobble” we have:

---------------------------------
Seq. no.: 210
File Type: BLEEPLOAD TRIGGER
Location: $52AA7 -> $52AA7 -> $52ADF -> $532DE
LA: $0000 EA: $0000 SZ: 0
Pilot/Trailer Size: 0/2040
Read Errors: 0
Unoptimized Pulses: 0
CRC32: 00000000
 - Cipher Address : $0200
 - Start Address : $1F00
 - End Address : $7B00
 - Exe Address : $4800

For the time being, I am not extracting the contents of triggers to PRG files, hence not computing their CRC-32 value, in order not to change the overall CRC-32 value for known tape images. However, I shall do so at some point in future.
What I am doing at the moment is to also flag read errors if they occur in a trigger block, which wasn’t the case before the rewrite of the “Bleepload” scanner.

Finally, here’s some code from “Bubble Bobble” (within the last “Bleepload” file) that reads in the trigger and uses it for data deciphering and code execution:

*=$BF00

        LDY #$00      
BBF02   JSR S1DA6     ; Read byte
        STA $0073,Y   ; Store in zero page, $73-$7A
        INY           
        CPY #$08      
        BNE BBF02     ; Loop on all 8 bytes in a trigger

...

BBF38   LDA ($75),Y   
        EOR ($A8),Y   ; Use the first page of the loader to decrypt
        INC $A9       
        EOR ($A8),Y   ; And the second page too
        DEC $A9       

        STY $7B       ; Save Y

        PHA           
        TYA           
        AND #$3F      
        TAY           
        PLA           
        EOR ($73),Y   ; Use the cipher too

        LDY $7B       ; Restore Y
        STA ($75),Y   

        INY           
        BNE BBF38     

        INC $76       

        LDA $76       
        CMP $78       
        BNE BBF38     

... ; Loader's source code leftover

        CLI           

        JMP ($0079)   ; Use the execution address

BTW, it’s in between two segments of code in the above listing that I found some leftover of the loader’s source code the other day.

Happy days!

About luigidifraia

I am a Senior DevOps Engineer so I get to work with the latest technologies and open-source software. However, in my private time I enjoy retro-computing.
This entry was posted in Retrocomputing, Technical and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s