transformA:
push bc
ld c, 11h
sub c
jp nc, loc_4F03
or a
adc a, c
cp 0
jr z, loc_4F03
cp 1
jr z, loc_4F03
ld b, a
dec b
ld a, 2
loc_4EFA:
sla a
djnz loc_4EFA
ld b, 1
sub b
jr loc_4F05
loc_4F03:
ld a, 0
loc_4F05:
pop bc
ret
transformA:
push bc
ld c, 11h
sub c
jp nc, loc_4F03
or a
adc a, c
cp 0
jr z, loc_4F03
cp 1
jr z, loc_4F03
ld b, a
dec b
ld a, 2
loc_4EFA:
sla a
djnz loc_4EFA
ld b, 1
sub b
jr loc_4F05
loc_4F03:
ld a, 0
loc_4F05:
pop bc
ret
transformA:
or a
ret z
cp 11h
jr c, notOver17
xor a
ret
notOver17:
ld b, a ;b is trash anyways
ld a, 1
shiftLoop:
add a, a
djnz shiftLoop
dec a
ret
call getCertByte
loc_4E55:
push af
ld b, 9
sub b
jr c, loc_4E6B
pop af
ld b, 8
sub b
call transfromA
ld d, a
ld a, 8
call transformA
ld e, a
jr loc_4E72
loc_4E6B:
ld d, 0
pop af
call transformA
ld e, a
loc_4E72:
Another thing, sla a should probably be add a,a (and like you said, the programmer probably didn't know about add :P)
Most of the stuff here is stuff anyone would do if they had little experience,...but still: only TI does 'or a \ adc a, c'. Everyone that knows what a z80 is uses 'add a, c'.
Most of the stuff here is stuff anyone would do if they had little experience,...but still: only TI does 'or a \ adc a, c'. Everyone that knows what a z80 is uses 'add a, c'.
ld b, 9 ;Really? You have to load 9 into B to subtract it?
sub b
jr c, loc_4E6B
pop af
ld b, 8 ;Ok, so you already have 9 in b. The logical thing to do now would be dec b.
sub b ;Oh, but no, you do the same bloody thing again!!!
;I forgot to mention that this code is missing a ld a,a. :P
As for the add and adc, there seem to be quite a few programmers (not here, of course) who misused the add instruction. For example, the code for the Pac Man machine (yes, it was a z80 too.) has a lot of "ccf \ add b". They still have no excuse.
Actually, you'll notice that instead of doing the stupid subtraction with B, they should have just done CP 9 since they restore A :POh, lol. I didn't notice the push af in the beginning.
It is almost scary how good some of the programmers are, here. I think that if they all designed an OS, it would be ridiculously amazing and more stable (though the TI-OS is pretty stable).Agreed.
Maybe it's deliberately obfuscated code?Perhaps, but...
or make something called TI-NOspine that costs $230 that 'protects' it from all hardware hacks and development :PMaybe it's deliberately obfuscated code?Perhaps, but...
Actually, it seems just like TI to try and "protect" their code with something this stupid and heinous, but they don't seem smart enough to deliberately write bad code. I think they just produce things that make you give up all hope unintentionally. Or....
Maybe it's deliberately obfuscated code?They're shooting themselves in their feet, then. :P