lcd_write_cmd_init			; CODE XREF: lcd_init+90p lcd_init+96p ...
LDR R2, =0xA167006E
LDR R1, =DBOP_TIMPOL_01
STR R2, [R1,#(DBOP_TIMPOL_23 - DBOP_TIMPOL_01)]
LDR R2, =DBOP_TIMPOL_01
ADDS R2, #(DBOP_DOUT - DBOP_TIMPOL_01)
STRB R0, [R2]

_ ; CODE XREF: lcd_write_cmd_init+10j
LDR R0, [R1,#(DBOP_STAT - DBOP_TIMPOL_01)]
LSLS R0, R0, #0x15
BPL _
LDR R0, =0xA167E06F
STR R0, [R1,#(DBOP_TIMPOL_23 - DBOP_TIMPOL_01)]
BX LR
; End of function lcd_write_cmd_init

; ---------------------------------------------------------------------------
dword_4088 DCD 0xA167006E ; DATA XREF: lcd_write_cmd_initr
off_408C DCD DBOP_TIMPOL_01 ; DATA XREF: lcd_write_cmd_init+2r
; lcd_write_cmd_init+6r
dword_4090 DCD 0xA167E06F ; DATA XREF: lcd_write_cmd_init+12r

; =============== S U B R O U T I N E =======================================


lcd_write_cmd ; CODE XREF: lcd_y_window+10p
; lcd_y_window+1Ap ...
LDR R1, =DBOP_CTRL
LDR R2, [R1,#(DBOP_CTRL - DBOP_CTRL)]
MOVLS R3, 0x2000
ORRS R2, R3
STR R2, [R1,#(DBOP_CTRL - DBOP_CTRL)]
LDR R2, [R1,#(DBOP_CTRL - DBOP_CTRL)]
LSRS R3, R3, #1
BICS R2, R3
STR R2, [R1,#(DBOP_CTRL - DBOP_CTRL)]
LDR R1, =DBOP_CTRL
LDR R2, =0xA167006E
SUBS R1, #8
STR R2, [R1,#(DBOP_TIMPOL_23+8 - DBOP_CTRL)]
STRH R0, [R1,#(DBOP_DOUT+8 - DBOP_CTRL)]

_ ; CODE XREF: lcd_write_cmd+22j
LDR R0, [R1,#(DBOP_STAT+8 - DBOP_CTRL)]
LSLS R0, R0, #0x15
BPL _
LDR R0, =0xA167E06F
STR R0, [R1,#(DBOP_TIMPOL_23+8 - DBOP_CTRL)]
BX LR
; End of function lcd_write_cmd

; ---------------------------------------------------------------------------
DCW 0
off_40C0 DCD DBOP_CTRL ; DATA XREF: lcd_write_cmdr
; lcd_write_cmd+14r
dword_40C4 DCD 0xA167006E ; DATA XREF: lcd_write_cmd+16r
dword_40C8 DCD 0xA167E06F ; DATA XREF: lcd_write_cmd+24r

; =============== S U B R O U T I N E =======================================


; int __cdecl lcd_y_window(__int16 y1, __int16 y2)
lcd_y_window ; CODE XREF: init_hardware+96p
PUSH {R4,LR}
ADDS R4, R1, #0
ADDS R0, #0x1A
LSLS R0, R0, #8
MOVS R1, #0x43 ; 'C' ; Y_ADDR_AREA
ORRS R0, R1
LSLS R0, R0, #0x10
ASRS R0, R0, #0x10
BL lcd_write_cmd
ADDS R4, #0x1A
LSLS R0, R4, #0x10
ASRS R0, R0, #0x10
BL lcd_write_cmd
POP {R4}
POP {R3}
BX R3
; End of function lcd_y_window


; =============== S U B R O U T I N E =======================================


; int __cdecl lcd_x_window(__int16 x1, __int16 x2)
lcd_x_window ; CODE XREF: init_hardware+8Cp
PUSH {R4,LR}
ADDS R4, R1, #0
MOVS R1, #0x42 ; 'B'
LSLS R0, R0, #8
ORRS R0, R1
LSLS R0, R0, #0x10
ASRS R0, R0, #0x10
BL lcd_write_cmd
LSLS R0, R4, #0x10
ASRS R0, R0, #0x10
BL lcd_write_cmd
POP {R4}
POP {R3}
BX R3
; End of function lcd_x_window


; =============== S U B R O U T I N E =======================================


; int __cdecl lcd_enable(int on)
lcd_enable ; CODE XREF: init_hardware+E0p
MOVS R1, #0x51 ; 'Q'
CMP R0, #0
PUSH {LR}
BNE write
MOVS R1, #0x50 ; 'P' ; off

write ; CODE XREF: lcd_enable+6j
LSLS R0, R1, #0x10
ASRS R0, R0, #0x10
BL lcd_write_cmd
POP {R3}
BX R3
; End of function lcd_enable

; ---------------------------------------------------------------------------
DCW 0

; =============== S U B R O U T I N E =======================================


; int __cdecl backlight(int onoff)
backlight ; CODE XREF: sub_2388+56p sub_2388+7Ep ...
LDR R1, =0x202E9
PUSH {R4}
LDRB R1, [R1]
CMP R1, #0
BNE ret
LDR R2, =0x202E8
MOVS R1, #0x20 ; ' ' ; A5
LDRB R2, [R2]
CMP R2, #0
BNE _
MOVS R1, #2 ; 1

_ ; CODE XREF: backlight+12j
LDR R4, =GPIOA_DIR

loc_4140
LDRB R3, [R4]
LSLS R2, R1, #0x18
LSRS R2, R2, #0x18
ORRS R3, R2
STRB R3, [R4]
LDR R4, =0x202E8
LDR R3, =GPIOA
LDRB R4, [R4]
CMP R4, #0
BNE loc_4158 ; 5
MOVS R4, #2
B loc_415A
; ---------------------------------------------------------------------------

loc_4158 ; CODE XREF: backlight+2Aj
MOVS R4, #0x20 ; ' ' ; 5

loc_415A ; CODE XREF: backlight+2Ej
LSLS R4, R4, #2
ADDS R3, R4, R3
CMP R0, #0
BEQ loc_4170
LDR R0, =unk_1CB71
LDRB R0, [R0]
CMP R0, #2
BLS ret
STRB R2, [R3]

ret ; CODE XREF: backlight+8j
; backlight+40j ...
POP {R4}
BX LR
; ---------------------------------------------------------------------------

loc_4170 ; CODE XREF: backlight+38j
MVNS R0, R1
STRB R0, [R3]
B ret
; End of function backlight

; ---------------------------------------------------------------------------
DCW 0
dword_4178 DCD 0x202E9 ; DATA XREF: backlightr
dword_417C DCD 0x202E8 ; DATA XREF: backlight+Ar
; backlight+22r
off_4180 DCD GPIOA_DIR ; DATA XREF: backlight:_r
off_4184 DCD GPIOA ; DATA XREF: backlight+24r
off_4188 DCD unk_1CB71 ; DATA XREF: backlight+3Ar

; =============== S U B R O U T I N E =======================================


; int __cdecl buttonlight(int on)
buttonlight ; CODE XREF: sub_2388+50p sub_2388+78p ...
LDR R1, =0x202E8
LDRB R1, [R1]
CMP R1, #0
BEQ toggle_a0
ADDS R3, R0, #0
MOVS R2, #0x80 ; '€'
CMP R3, #0
LDR R0, =0xC8020000
LDR R1, =GPIOD_PIN7
BEQ off
LDR R3, =unk_1CB71
LDRB R3, [R3]
CMP R3, #2
BLS ret
STRB R2, [R1] ; on
LDR R1, [R0]
ORRS R1, R2
B loc_41B8
; ---------------------------------------------------------------------------

off ; CODE XREF: buttonlight+12j
MOVS R3, #0
STRB R3, [R1]
LDR R1, [R0]
BICS R1, R2

loc_41B8 ; CODE XREF: buttonlight+22j
STR R1, [R0]

ret ; CODE XREF: buttonlight+1Aj
BX LR
; ---------------------------------------------------------------------------

toggle_a0 ; CODE XREF: buttonlight+6j
LDR R3, =GPIOA_DIR
LDRB R2, [R3]
MOVS R1, #1
ORRS R2, R1
STRB R2, [R3]
LDR R2, =GPIOA
CMP R0, #0
BEQ low
STRB R1, [R2,#4]
BX LR
; ---------------------------------------------------------------------------

low ; CODE XREF: buttonlight+3Ej
MOVS R0, #0b11111110
STRB R0, [R2,#4]
BX LR
; End of function buttonlight

; ---------------------------------------------------------------------------
DCW 0
dword_41D8 DCD 0x202E8 ; DATA XREF: buttonlightr
dword_41DC DCD 0xC8020000 ; DATA XREF: buttonlight+Er
off_41E0 DCD GPIOD_PIN7 ; DATA XREF: buttonlight+10r
off_41E4 DCD unk_1CB71 ; DATA XREF: buttonlight+14r
off_41E8 DCD GPIOA_DIR ; DATA XREF: buttonlight:toggle_a0r
off_41EC DCD GPIOA ; DATA XREF: buttonlight+3Ar

; =============== S U B R O U T I N E =======================================


toggle_matos ; CODE XREF: init_hardware+E6p
; sub_92EC+Ap ...
LDR R1, =0x2293C
PUSH {LR}
STRB R0, [R1]
CMP R0, #0
BEQ off
MOVS R0, #1 ; on
BL buttonlight
MOVS R0, #1 ; onoff
BL backlight
LDR R1, =0x204E0
MOVS R0, #0
STRB R0, [R1]

ret ; CODE XREF: toggle_matos+2Cj
POP {R3}
BX R3
; ---------------------------------------------------------------------------

off ; CODE XREF: toggle_matos+8j
MOVS R0, #0 ; on
BL buttonlight
MOVS R0, #0 ; onoff
BL backlight
B ret
; End of function toggle_matos

; ---------------------------------------------------------------------------
DCW 0
dword_4220 DCD 0x2293C ; DATA XREF: toggle_matosr
dword_4224 DCD 0x204E0 ; DATA XREF: toggle_matos+16r

; =============== S U B R O U T I N E =======================================


sub_4228 ; CODE XREF: sub_BD0+12Ap
; sub_BD0:loc_D74p ...
LDR R1, =0x1E968
PUSH {R4}
STRB R0, [R1]
LDR R1, =0x202E8
LDRB R1, [R1]
CMP R1, #0
BNE loc_424E
LDR R3, =0xC8020000
LDR R2, [R3]
MOVS R4, #0x80 ; '€'
BICS R2, R4
MOVS R1, #0xFF
CMP R0, #0
BNE loc_4246
MOVS R1, #0

loc_4246 ; CODE XREF: sub_4228+1Aj
LSLS R0, R1, #7
ANDS R0, R4
ORRS R0, R2
STR R0, [R3]

loc_424E ; CODE XREF: sub_4228+Cj
POP {R4}
BX LR
; End of function sub_4228

; ---------------------------------------------------------------------------
DCW 0
dword_4254 DCD 0x1E968 ; DATA XREF: sub_4228r
dword_4258 DCD 0x202E8 ; DATA XREF: sub_4228+6r
dword_425C DCD 0xC8020000 ; DATA XREF: sub_4228+Er

; =============== S U B R O U T I N E =======================================


sub_4260 ; CODE XREF: sub_64A8+84p sub_65D4+16p
PUSH {R4,LR}
LDR R4, =0x2293C
LDRB R0, [R4] ; on
BL buttonlight
LDRB R0, [R4] ; onoff
BL backlight
POP {R4}
POP {R3}
BX R3
; End of function sub_4260

; ---------------------------------------------------------------------------
DCW 0
dword_4278 DCD 0x2293C ; DATA XREF: sub_4260+2r

; =============== S U B R O U T I N E =======================================


; int __cdecl toggle_A1(int high)
toggle_A1 ; CODE XREF: lcd_init+44p
; sub_10B2C+7Ep ...
LDR R1, =0x202E9
LDRB R1, [R1]
CMP R1, #0
BEQ ret
LDR R1, =GPIOA
CMP R0, #0
BEQ off
MOVS R0, #2
B on
; ---------------------------------------------------------------------------

off ; CODE XREF: toggle_A1+Cj
MOVS R0, #0

on ; CODE XREF: toggle_A1+10j
STRB R0, [R1,#(GPIOA_PIN1 - GPIOA)]

ret ; CODE XREF: toggle_A1+6j
BX LR
; End of function toggle_A1

; ---------------------------------------------------------------------------
dword_4294 DCD 0x202E9 ; DATA XREF: toggle_A1r
off_4298 DCD GPIOA ; DATA XREF: toggle_A1+8r

; =============== S U B R O U T I N E =======================================


lcd_init ; CODE XREF: init_hardware+6Ep
PUSH {R4-R6,LR}
BL lcd_dbop_init
LDR R6, =GPIOB_DIR
LDRB R0, [R6]
MOVS R4, #0x40 ; '@' ; b6 out
ORRS R0, R4
ADDS R1, R6, #0
STRB R0, [R1]
LDR R5, =GPIOB_PIN6
MOVS R0, #0b10111111
STRB R0, [R5] ; = 0
LDR R0, =0x202E9
LDR R2, =GPIOA_DIR
LDRB R0, [R0]
CMP R0, #0
BEQ loc_42C4
LDRB R0, [R2]
MOVS R1, #0x32 ; '2'
B loc_42D4
; ---------------------------------------------------------------------------

loc_42C4 ; CODE XREF: lcd_init+20j
LDR R0, =0x202E8
LDRB R0, [R0]
CMP R0, #0
LDRB R0, [R2]
BEQ loc_42D2
MOVS R1, #0xB0 ; '°'
B loc_42D4
; ---------------------------------------------------------------------------

loc_42D2 ; CODE XREF: lcd_init+30j
MOVS R1, #0x13

loc_42D4 ; CODE XREF: lcd_init+26j lcd_init+34j
ORRS R0, R1
STRB R0, [R2]
MOVS R0, #1 ; low
BL toggle_A4
MOVS R0, #1 ; high
BL toggle_A1
LDRB R0, [R6]
MOVS R1, #0x20 ; ' '
ORRS R0, R1
STRB R0, [R6]
LDR R1, =GPIOB_PIN6
MOVS R0, #0b11011111 ; b5 low
SUBS R1, #0x80 ; '€'
STRB R0, [R1]
LDR R0, =0xC810000C ; ccu_io
LDR R1, [R0]
MOVS R2, #4
BICS R1, R2
STR R1, [R0]
LDR R1, [R0]
MOVS R2, #8
BICS R1, R2
STR R1, [R0]
LDR R0, =0x202E8
LDRB R1, [R0]
MOVS R0, #0x80 ; '€'
CMP R1, #0
BNE loc_4314
LDR R1, =GPIOD_PIN7
STRB R0, [R1]

loc_4314 ; CODE XREF: lcd_init+72j
LDR R2, =GPIOD_DIR
LDRB R1, [R2]
ORRS R0, R1
STRB R0, [R2]
MOVS R0, #1 ; microseconds
BL msleep_timer1
STRB R4, [R5]
MOVS R0, #1 ; microseconds
BL msleep_timer1
MOVS R0, #0 ; nop
BL lcd_write_cmd_init
MOVS R0, #0 ; nop
BL lcd_write_cmd_init
MOVS R0, #0x2C ; ',' ; standby_off
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #2 ; oscillation mode
BL lcd_write_cmd_init
MOVS R0, #1
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #0x26 ; '&' ; dcdc amp onoff
BL lcd_write_cmd_init
MOVS R0, #1
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #0x26 ; '&' ; dcdc amp on off
BL lcd_write_cmd_init
MOVS R0, #9
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #0x26 ; '&'
BL lcd_write_cmd_init
MOVS R0, #0xB
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #0x26 ; '&'
BL lcd_write_cmd_init
MOVS R0, #0xF
BL lcd_write_cmd_init
MOVS R0, #20 ; microseconds
BL msleep_timer1
MOVS R0, #0x10 ; driver output mode
BL lcd_write_cmd_init
MOVS R0, #0xC
BL lcd_write_cmd_init
MOVS R0, #0x20 ; ' ' ; dcdc set
BL lcd_write_cmd_init
MOVS R0, #3
BL lcd_write_cmd_init
MOVS R0, #0x2A ; '*' ; contrast ctrl
BL lcd_write_cmd_init
MOVS R0, #0x51 ; 'Q'
BL lcd_write_cmd_init
MOVS R0, #0x34 ; '4' ; n line inv
BL lcd_write_cmd_init
MOVS R0, #0xDF ; 'ß'
BL lcd_write_cmd_init
MOVS R0, #0x40 ; '@' ; entry mode
BL lcd_write_cmd_init
MOVS R0, #0x82 ; '‚'
BL lcd_write_cmd_init
POP {R4-R6}
POP {R3}
BX R3
; End of function lcd_init

; ---------------------------------------------------------------------------
DCW 0
off_43E0 DCD GPIOB_DIR ; DATA XREF: lcd_init+6r
off_43E4 DCD GPIOB_PIN6 ; DATA XREF: lcd_init+12r lcd_init+50r
dword_43E8 DCD 0x202E9 ; DATA XREF: lcd_init+18r
off_43EC DCD GPIOA_DIR ; DATA XREF: lcd_init+1Ar
dword_43F0 DCD 0x202E8 ; DATA XREF: lcd_init:loc_42C4r
; lcd_init+6Ar
dword_43F4 DCD 0xC810000C ; DATA XREF: lcd_init+58r
off_43F8 DCD GPIOD_PIN7 ; DATA XREF: lcd_init+74r
off_43FC DCD GPIOD_DIR ; DATA XREF: lcd_init:loc_4314r

; =============== S U B R O U T I N E =======================================


; int __cdecl dbop_write(__int16 val)
dbop_write ; CODE XREF: init_hardware+CAp
LDR R1, =DBOP_TIMPOL_01
STRH R0, [R1,#(DBOP_DOUT - DBOP_TIMPOL_01)]

_ ; CODE XREF: dbop_write+8j
LDR R0, [R1,#(DBOP_STAT - DBOP_TIMPOL_01)]
LSLS R0, R0, #0x15
BPL _
BX LR
; End of function dbop_write

; ---------------------------------------------------------------------------
off_440C DCD DBOP_TIMPOL_01 ; DATA XREF: dbop_writer

; =============== S U B R O U T I N E =======================================


dbop_write_2 ; CODE XREF: sub_3E2C+2p
; init_hardware+D4p
LDR R2, =DBOP_CTRL
LDR R0, [R2,#(DBOP_CTRL - DBOP_CTRL)]
MOVLS R1, 0x1000 ; 16 bits data_width
ORRS R0, R1
STR R0, [R2,#(DBOP_CTRL - DBOP_CTRL)]
LDR R0, =DBOP_CTRL
LDR R1, =0xE167E167
SUBS R0, #8
STR R1, [R0,#(DBOP_TIMPOL_01+8 - DBOP_CTRL)]
LDR R1, =0xE167006E
STR R1, [R0,#(DBOP_TIMPOL_23+8 - DBOP_CTRL)]
ASRS R1, R0, #30
STR R1, [R0,#(DBOP_DOUT+8 - DBOP_CTRL)]

_ ; CODE XREF: dbop_write_2+20j
LDR R1, [R0,#(DBOP_STAT+8 - DBOP_CTRL)]
LSLS R1, R1, #0x15
BPL _
LDR R1, =0x6E167
STR R1, [R0,#(DBOP_TIMPOL_01+8 - DBOP_CTRL)]
LDR R1, =0xA167E06F
STR R1, [R0,#(DBOP_TIMPOL_23+8 - DBOP_CTRL)]
BX LR
; End of function dbop_write_2

; ---------------------------------------------------------------------------
off_443C DCD DBOP_CTRL ; DATA XREF: dbop_write_2r
; dbop_write_2+Cr
dword_4440 DCD 0xE167E167 ; DATA XREF: dbop_write_2+Er
dword_4444 DCD 0xE167006E ; DATA XREF: dbop_write_2+14r
dword_4448 DCD 0x6E167 ; DATA XREF: dbop_write_2+22r
; seg000:off_11154o
dword_444C DCD 0xA167E06F ; DATA XREF: dbop_write_2+26r