Skip to content

Commit 7a6d5a8

Browse files
committed
feat: add hMirror lib
1 parent 670c12a commit 7a6d5a8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
Function fastcall hMirror(number as uByte) as uByte
4+
Asm
5+
;17 bytes and 66 clock cycles
6+
ld b,a ;b=ABCDEFGH
7+
rrca ;a=HABCDEFG
8+
rrca ;a=GHABCDEF
9+
xor b
10+
and %10101010
11+
xor b ;a=GBADCFEH
12+
ld b,a ;b=GBADCFEH
13+
rrca ;a=HGBADCFE
14+
rrca ;a=EHGBADCF
15+
rrca ;a=FEHGBADC
16+
rrca ;a=CFEHGBAD
17+
xor b
18+
and %01100110
19+
xor b ;a=GFEDCBAH
20+
rrca ;a=HGFEDCBA
21+
End Asm
22+
End Function
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
#define hMirror(x) \
4+
Asm \
5+
mirror a \
6+
End Asm

0 commit comments

Comments
 (0)