-
Notifications
You must be signed in to change notification settings - Fork 1
/
Emoji_200_v3.pbp
115 lines (104 loc) · 2.93 KB
/
Emoji_200_v3.pbp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
; This patch makes it possible to support
; Emoji characters in custom fonts.
; It remaps Emoji range (0x1F6xx) to Private Use Area part (0xF6xx).
; It uses a mapping table for remap
; (by default table changes nothing, change it according to your fonts).
; There are two tables, main and simple.
; Simple table will be used if patcher is called with -D simple
; and is intended to have fewer mappings,
; for lightweight font.
#ver 200
;!internal
2d e9 f0 41 0d 0c 2d 04 04 46 0f 46 16 46 {
proc text_resources_try_load_glyph_metadata
; was: PUSH.W R4-R8,LR
; here R1 is codep, R3-R8 are unused
B.W my_metadata
global cont_metadata
}
2d e9 f7 43 05 46 0e 46 91 46 {
proc text_resources_try_load_glyph_bitmap
; was: PUSH.W R0-R2,R4-R9,LR
; here R1 is codep, R3-R9 are unused
B.W my_bitmap
global cont_bitmap
}
; place our code instead of
;cmdShowLog:
01 20 08 b5 ?4 02 48 bd e8 08 40 ?4
00 bf ?4
;cmdWriteFlash:
?4
;cmdReadWord:
00 b5 8b b0 ?4 42 1c 03 46 03 d1 06 48
?4 06 e0 02 68 20 21 00 92 02 a8 03 4a
?4 0b b0 00 bd
?4 ?4
;cmdEraseFlash:
?4
;cmdFormatFlash:
?4
;cmdDumpFlash:
70 b5 a2 b0 0c 46 ?2 ?2 41 1c 05 46 01 d1
15 48 05 e0 20 46 ?2 ?2 04 46 18 b9 13 48
?4 1d e0 01 20 ?4 80 2c b4 bf
26 46 80 26 29 46 02 a8 32 46 ?4 00 20
4f 22 00 95 0a 49 0b 4b ?4 00 20 02 a9
32 46 ?4 a4 1b 35 44 e7 d1 20 46 ?2
?2 22 b0 70 bd
00 bf ?4 ?4 ?4 ?4
{
proc my_metadata
db 2d e9 f0 41 ; PUSH.W R4-R8,LR
MOV R4, 1
B.W begin
global my_bitmap
db 2d e9 f7 43 ; PUSH.W R0-R2,R4-R9,LR
MOV R4, 0
begin:
; here R1 is codep,
; R4 is tmp
LDR R3, emoji_base
CMP R1, R3
BCC cont ; if codep < emoji_base then pass thru; BCC = BLO = unsigned lesser-than
ADD R3, 0x4F ; emoji_count
CMP R1, R3
BHI cont ; if codep > emoji_max then pass thru (will terminate)
LDR R3, emoji_base ; restore base in R3
SUB R1, R3 ; now R1 is emoji-char number
; apply remap table...
ADR R3, remap_table
ADD R3, R1
LDRB R1, [R3] ; now R1 is remapped
LDR R3, new_base
ADD R1, R3
cont:
CMP R4, 1
BNE cont2
B.W cont_metadata
cont2:
B.W cont_bitmap
; data block:
ALIGN 4
emoji_base: DCD 0x1F600
new_base: DCD 0xF600 ; part of "Private Use Area"
; or for debug:
;new_base: DCD 0x28 ; "(" symbol
remap_table:
#ifdef simple
; simplified table, with lesser glyphs
; to use it, launch patcher with "-D simple" arg
db 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
db 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
db 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
db 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
db 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
#else
; full table, with maximum glyphs
db 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
db 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
db 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
db 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
db 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
#endif
}