Save a few cycles by not reloading the last written byte between rounds.

This commit is contained in:
Stephen Heumann 2017-06-26 21:49:16 -05:00
parent 75aac0daa9
commit f04000c83d

View File

@ -31,7 +31,9 @@
macro
MixColumn &i,&A,&B,&C,&D,&state,&out
aif (&i=0).AND.(&round<>1),.skip
ldy &state+&D
.skip
lda Sbox,Y
pha
ldx &state+&A
@ -68,13 +70,20 @@
eor Xtime2Sbox,Y
eor rk+&round*16+&i+3
sta &out+&i+3
aif &i<>12,.skip2
tay
.skip2
mend
macro
FinalRound &round
FinalRoundStep 3,15,1
FinalRoundStep 15,11
FinalRoundStep 11,7
FinalRoundStep 7,3
FinalRoundStep 0,0
FinalRoundStep 4,4
FinalRoundStep 8,8
@ -90,18 +99,15 @@
FinalRoundStep 14,6
FinalRoundStep 6,14
FinalRoundStep 3,15
FinalRoundStep 15,11
FinalRoundStep 11,7
FinalRoundStep 7,3
mend
macro
FinalRoundStep &to,&from
FinalRoundStep &to,&from,&skipldy
aif C:&skipldy,.skip
ldy state2+&from
.skip
lda Sbox,Y
eor rk+&round*16+&to
sta state1+&to