download ZFX86.ASM
Language: Assembler
License: GPL
Copyright: (C) 1988-2000, Leif Ekblad
LOC: 225
Project Info
RDOS operating system(rdos)
Server: SourceForge
Type: cvs
SourceForge\r\rdos\rdos\bur\
   ad.cpp
   ad.def
   BOOT.ASM
   bur2bin.asm
   burload.cpp
   burload.def
   CFG2ROM.ASM
   CLEAN.BAT
   DEMO.CFG
   FLASH.ASM
   LCD.ASM
   MK.BAT
   SDRAM.ASM
   SHUTDOWN.ASM
   TEST.ASM
   TEST.DEF
   YMODEM.CPP
   YMODEM.H
   ZFX86.ASM

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; RDOS operating system
; Copyright (C) 1988-2000, Leif Ekblad
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. The only exception to this rule
; is for commercial usage in embedded systems. For information on
; usage in commercial embedded systems, contact embedded@rdos.net
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
;
; The author of this program may be contacted at leif@rdos.net
;
; ZFX86.ASM
; ZFX86 power-management module
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
						
		NAME zfx86

GateSize = 16

INCLUDE ..\os\system.def
INCLUDE ..\os\protseg.def
INCLUDE ..\os\user.def
INCLUDE ..\os\os.def
INCLUDE ..\os\os.inc
INCLUDE ..\os\user.inc
INCLUDE ..\os\driver.def

	.386p

WriteSIO    Macro index, data
    mov al,index
    out 2Eh,al
    mov al,data
    out 2Fh,al
        ENDM

ReadSIO    Macro index
    mov al,index
    out 2Eh,al
    in al,2Fh
        ENDM

WriteZflByte    Macro index, data
    mov al,index
    mov dx,218h
    out dx,al
    mov al,data
    inc dx
    out dx,al
                Endm

ReadZflByte Macro index
    mov al,index
    mov dx,218h
    out dx,al
    inc dx
    in al,dx
            Endm

WriteZflWord    Macro index, data
    mov al,index
    mov dx,218h
    out dx,al
    mov ax,data
    mov dx,21Ah
    out dx,ax
                Endm

ReadZflWord Macro index
    mov al,index
    mov dx,218h
    out dx,al
    mov dx,21Ah
    in ax,dx
            Endm

WriteZflDword   Macro index, data
    mov al,index
    mov dx,218h
    out dx,al
    mov eax,data
    mov dx,21Ah
    out dx,eax
                Endm

ReadZflDword    Macro index
    mov al,index
    mov dx,218h
    out dx,al
    mov dx,21Ah
    in eax,dx
                Endm  

code	SEGMENT byte public use16 'CODE'

	assume cs:code

PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StartComPort
;
;		DESCRIPTION:	start serial port
;
;		PARAMETERS:		AX		port #
;						DX		base
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

start_com_port_name	DB 'Start Com Port', 0

start_com_port	Proc far
	push ax
	push dx
;
	cmp dx,3F8h
	je start_com1
;
	cmp dx,2F8h
	je start_com2
;
	jmp start_com_done

start_com1:
    WriteSIO 7, 3
    WriteSIO 30h, 1
    WriteSIO 60h, dh
    WriteSIO 61h, dl
	jmp start_com_done

start_com2:
    WriteSIO 7, 2
    WriteSIO 30h, 1
    WriteSIO 60h, dh
    WriteSIO 61h, dl

start_com_done:
	pop dx
	pop ax
	ret
start_com_port	Endp

PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StopComPort
;
;		DESCRIPTION:	stop serial port
;
;		PARAMETERS:		AX		port #
;						DX		base
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

stop_com_port_name	DB 'Stop Com Port', 0

stop_com_port	Proc far
	push ax
	push dx
;
	cmp dx,3F8h
	je stop_com1
;
	cmp dx,2F8h
	je stop_com2
;
	jmp stop_com_done

stop_com1:
    WriteSIO 7, 3
    WriteSIO 30h, 0
	jmp stop_com_done

stop_com2:
    WriteSIO 7, 2
    WriteSIO 30h, 0

stop_com_done:
	pop dx
	pop ax
	ret
stop_com_port	Endp

PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StartKeyboard
;
;		DESCRIPTION:	start keyboard
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

start_keyboard_name	DB 'Start Keyboard', 0

start_keyboard	Proc far
    WriteSIO 7, 6
    WriteSIO 30h, 1
    WriteSIO 60h, 0
    WriteSIO 61h, 60h
    WriteSIO 62h, 0
    WriteSIO 63h, 64h
    WriteSIO 70h, 1
    WriteSIO 71h, 2
;
	cli
	mov al,0EDh
	out 60h,al

send_wait1:
	in al,64h
	test al,2
	jnz send_wait1
;
	mov al,6
	out 60h,al

send_wait2:
	in al,64h
	test al,2
	jnz send_wait2

wait_key:
	in al,64h
	test al,1
	jz wait_key
;
	in al,60h
	mov ah,al
	in al,64h
	mov si,ax
;
	in al,21h
	mov ah,al
	in al,20h
	mov di,ax
;	
	int 3
	ret
start_keyboard	Endp


PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StopKeyboard
;
;		DESCRIPTION:	stop keyboard
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

stop_keyboard_name	DB 'Stop Keyboard', 0

stop_keyboard	Proc far
    WriteSIO 7, 6
    WriteSIO 30h, 0
	ret
stop_keyboard	Endp

PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StartFloppy
;
;		DESCRIPTION:	start floppy
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

start_floppy_name	DB 'Start Floppy', 0

start_floppy	Proc far
    WriteSIO 7, 0
    WriteSIO 30h, 1
    WriteSIO 60h, 3
    WriteSIO 61h, 0F0h
    WriteSIO 70h, 6
    WriteSIO 71h, 3
	WriteSIO 74h, 2
	WriteSIO 75h, 4
	WriteSIO 0F0h, 24h
	WriteSIO 0F1h, 0
	ret
start_floppy	Endp

PAGE
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;	
;
;		NAME:			StopFloppy
;
;		DESCRIPTION:	stop floppy
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

stop_floppy_name	DB 'Stop Floppy', 0

stop_floppy	Proc far
    WriteSIO 7, 0
    WriteSIO 30h, 0
	ret
stop_floppy	Endp

PAGE

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;
;		NAME:			Init
;
;		DESCRIPTION:	Initialize module
;
;		PARAMETERS:		
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

init	Proc far
	push ds
	push es
	pusha
;
	mov bx,power_code_sel
	InitDevice
;
	mov ax,cs
	mov ds,ax
	mov es,ax
;
	mov si,OFFSET start_com_port
	mov di,OFFSET start_com_port_name
	mov ax,start_com_port_nr
	RegisterOsGate
;
	mov si,OFFSET stop_com_port
	mov di,OFFSET stop_com_port_name
	mov ax,stop_com_port_nr
	RegisterOsGate
;
	mov si,OFFSET start_keyboard
	mov di,OFFSET start_keyboard_name
	mov ax,start_keyboard_nr
	RegisterOsGate
;
	mov si,OFFSET stop_keyboard
	mov di,OFFSET stop_keyboard_name
	mov ax,stop_keyboard_nr
	RegisterOsGate
;
	mov si,OFFSET start_floppy
	mov di,OFFSET start_floppy_name
	mov ax,start_floppy_nr
	RegisterOsGate
;
	mov si,OFFSET stop_floppy
	mov di,OFFSET stop_floppy_name
	mov ax,stop_floppy_nr
	RegisterOsGate
;
	popa
	pop es
	pop ds
	ret
init	Endp

code	ENDS

	END init

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us