:Cheers:
OK had a lot of failed attempts today but this keyroll worked today on pure. (have left acouple of ?? for you to put in your own values)
may not be the best way but does work if a bit slow took 9 mins to update on pure tonight :banana:
Code below ______________________
;If the mask check above passed then we are going to do the following block of code to process
;a Type 7 Keyroll (Map call).
;
DOKEYROLL7:
; Key0 start address =0x2E
; Key1 start address=0x38
; bytes to xor =0x0A, 0X0C, 0x18, 0x1A (-0x79 offset) to give buffer byte location
; key roll address byte offset= +0x7d
; Do first Byte of key
LDI YH, high(MP) ;load Y with memory pointer
LDI YL, low( MP)
CLR R18 ;Clear R18
LDS R18,(MP + 0x??) ;Load R18 with Key Byte Offset from emm
SUBI R18,0x7d ;Subtract difference in memory position from offset to emm buffer byte
ADD R28,R18 ;Set Y to point to byte (r28=YL)
LD R16,Y ;load keyByte from emm position
LDS R17,(MP + 0x??) ;load xor value
EOR R16,R17 ;XOR byte
ST Y, R16 ;Write keyByte back to emm position
; Do second Byte of key
LDI YH, high(MP) ;load Y with memory pointer
LDI YL, low( MP)
CLR R18 ;Clear R18
LDS R18,(MP + 0x??) ;Load R18 with Key Byte Offset from emm
SUBI R18,0x7d ;Subtract difference in memory position from offset to emm buffer byte
ADD R28,R18 ;Set Y to point to calculated byte (r28=YL)
LD R16,Y ;load keyByte from emm position
LDS R17,(MP + 0x??) ;load xor value
EOR R16,R17 ;XOR byte
ST Y, R16 ;Write keyByte back to emm position