-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit_lem.asm
More file actions
57 lines (47 loc) · 934 Bytes
/
init_lem.asm
File metadata and controls
57 lines (47 loc) · 934 Bytes
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
; -----------------------
; Title: InitLem
; Author: Measter
; Date: 2013/10/29
; -----------------------
; Revisions
; 1 : Initial Release.
; 2 : Added macro.
.macro init_lem(fnt_ptr, pal_ptr, disp_ptr, port)
set push, fnt_ptr
set push, pal_ptr
set push, disp_ptr
set push, port
jsr init_lem_func
add sp, 4
.endmacro
; Initialises the LEM1802 at the given port.
; Input
; SP+3 : Memory address of the font buffer. Set to 0x0 for default.
; SP+2 : Memory address of the palette buffer. Set to 0x0 for default.
; SP+1 : Memory address of the display buffer.
; SP+0 : Port number of the LEM.
:init_lem_func
set push, z
set z, sp
add z, 2
set push, a
set push, b
set a, 0
set b, [z+1]
hwi [z]
ife [z+2], 0x0
set pc, .skip_palette
set a, 2
set b, [z+2]
hwi [z]
:.skip_palette
ife [z+3], 0x0
set pc, .end
set a, 1
set b, [z+3]
hwi [z]
:.end
set b, pop
set a, pop
set z, pop
set pc, pop