rev: tip vgmplay-msx/src/Device.asm -rw-r--r-- 1.6 KiB View raw Log this file
e8a0ea05ce5aLaurens Holst Added tag release-1.3 for changeset d53f33dc6397 4 months ago
                                                                                
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
115
;
; Sound device
;
Device: MACRO ?name, ?clock = 0
	name:
		dw ?name
	clock:
		dd ?clock
	ENDM

; ix = this
Device_Construct:
	res 6,(ix + Device.clock + 3)
	res 7,(ix + Device.clock + 3)
	ret

; ix = this
; dehl <- clock (Hz)
; a <- 0: clock is zero
; f <- z: clock is zero
Device_GetClock:
	ld de,Device.clock
	call Utils_GetDoubleWordIXOffset
	res 7,d  ; clear flag bits
	res 6,d
	ret

; ix = this
; dehl <- clock (Hz)
Device_SetClock:
	ld (ix + Device.clock),l
	ld (ix + Device.clock + 1),h
	ld (ix + Device.clock + 2),e
	ld (ix + Device.clock + 3),d
	ret

; ix = this
; f <- nz: set
Device_GetFlagBit6:
	bit 6,(ix + Device.clock + 3)
	ret

; ix = this
; f <- nz: set
Device_GetFlagBit7:
	bit 7,(ix + Device.clock + 3)
	ret

; ix = this
Device_SetFlagBit6:
	set 6,(ix + Device.clock + 3)
	ret

; ix = this
Device_SetFlagBit7:
	set 7,(ix + Device.clock + 3)
	ret

; ix = this
; hl <- name
Device_GetName:
	ld l,(ix + Device.name)
	ld h,(ix + Device.name + 1)
	ret

; hl = name
; ix = this
Device_SetName:
	ld (ix + Device.name),l
	ld (ix + Device.name + 1),h
	ret

; ix = this
Device_PrintInfo:
	call Device_GetName
	call System_Print
	ld hl,Device_infix
	call System_Print
	call Device_GetClock
	call System_PrintDecDEHL
	ld hl,Device_hz
	jp System_Print

; ix = this
; bc = offset
; de = other device
; hl = interface
; hl <- next interface
Device_ConnectInterfaceAgain:
	dec hl
	dec hl
Device_ConnectInterface:
	push hl
	push ix
	add ix,bc
	call Interface_GetAddress
	call Utils_DereferenceJump
	ld (ix),l
	ld (ix + 1),h
	pop ix
	pop hl
	inc hl
	inc hl
	ret

;
Device_infix:
	db ": ",0

Device_hz:
	db " Hz",13,10  ;,0

Device_noName:
	db 0