Re: A86: arg... sqrtKEY again...


[Prev][Next][Index][Thread]

Re: A86: arg... sqrtKEY again...




You have rst 20h and rst 10h mixed up.
Other than that, it is right. I would personally drop all the crappy _mm_ldir crap and do it
manually.
something like this maybe:

ld hl, $5A92                            ;name of sqrtkey program
rst 20h
rst 10h
jr c, memlock_compromised       ;if carry, then sqrtKEY doesn't exist.
ld  a,b
ex  de,hl
call _load_ram_ahl
ld  a,(6)
out (5),a
inc a
out (6),a
ld  de,-$4000+6
add hl,de
ld  de,id_tag_copy
ld  bc,6
ldir

oh, and make sure that you put rom page $0d back out port 5 if you are gonna do any rom calls.




Cassady Roop wrote:

> The following code should copy three bytes from the sixth byte of the
> sqrtKEY program variable to a location called id_tag_copy.  Once there,
> the three bytes are tested to see if they are appropriate values.  My
> problem is that the bytes never get copied; after the 'rst 20h', I check
> to see if the var even exists;  if it doesn't, it jumps to a routine
> called memlock_compromised.  THIS ALWAYS HAPPENS.  The emulator tells me
> there is a var called (sqrt)KEY, but _findsym apparently returns saying
> it doesn't exist.  Now, what's REALLY spooky, is that I changed the 'jr
> c,...' to 'jr nc,...' in case I had the _findsym output backwards in my
> head.  IT STILL MADE THE JUMP.  HOW?  WHY?  No matter what I do, it
> alwasy makes that jump, according to the emulator.  The bytes never get
> copied.  Can someone point out the probably obvious error I have made?
>
> Cassady Roop
>
> ld hl, $5A92                            ;name of sqrtkey program
> rst 10h                                 ;move to OP1
> rst 20h                                 ;_findsym
> jr c, memlock_compromised       ;if carry, then sqrtKEY doesn't exist.
> ld hl, $0006             ;adjust for the asm marker & size word, and jr
> instruction
> xor a                           ;adding two 24-bit values
> add hl,de                       ;add offset
> adc a,b                         ;incase it went off a RAM page
> call _SET_ABS_SRC_ADDR
> xor a
> ld hl, id_tag_copy              ;copy to a temp location
> call _SET_ABS_DEST_ADDR
> ld bc, $0003
> call _SET_MM_NUM_BYTES
> call _mm_ldir
> ld hl, id_tag_copy
> ld a, (hl)                      ;take a look at the id tag we ripped off the sqrtKEY
> program
> cp 'L'                          ;id tag of 'LDN' identifies it as lockdown's memlock module
> jr nz, memlock_compromised      ;if not L, then it was deleted by another
> prog
> inc hl
> ld a, (hl)
> cp 'D'
> jr nz, memlock_compromised
> inc hl
> ld a, (hl)
> cp 'N'
> jr nz, memlock_compromised



Follow-Ups: References: