Re: to make a TSR
- From: Dirk Wolfgang Glomp <dirk@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 09:03:08 +0200
Am Sun, 27 Apr 2008 23:04:00 +0200 schrieb almas:
Hi,
Thanks for your answer.
I use port 61h.
I make a file b25 ( 25 bytes à and b12 ( 12 bytes )
B25 use mov ax, 0 A0 A3h B12 use mov al, 0 FFh
that is the most important modification.
When i do
B12 .... some times it is OK, sometimes, no noise
then i run B25 i have always a low frequency noise.
After it, i run again B12 and i have always a noise
Now, i use display byte 07 : the bell
i obtain a nusty noise... but it is a noise !
A sample from Data Beckers "PC Intern":
; --------------------------------------------------------------
; MOZART1.ASM
;
; Demonstriert Verwendung des Moduls SPEAKER.ASM
;
; --------------------------------------------------------------
..model tiny
..code
..286
extern Sound: near
extern NoSound: near
extern Delay: near
; --------------------------------------------------------------
; Codebereich
; --------------------------------------------------------------
org 100h
@Start:
lea bx, LiedData
xor si, si
@1:
push word ptr [bx+si]
call Sound
push word ptr [bx+si+02]
call Delay
call NoSound
push 25
call Delay
add si, 4
cmp si, AnzToene
jc @1
@Ende:
.exit
; --------------------------------------------------------------
; Datenbereich
; --------------------------------------------------------------
LiedData word 1046, 250
word 1174, 250
word 1328, 250
word 1396, 250
word 1567, 500
word 1567, 500
word 1760, 250
word 1760, 250
word 1760, 250
word 1760, 250
word 1567, 500
word 1760, 250
word 1760, 250
word 1760, 250
word 1760, 250
word 1567, 500
word 1396, 250
word 1396, 250
word 1396, 250
word 1396, 250
word 1328, 500
word 1328, 500
word 1567, 250
word 1567, 250
word 1567, 250
word 1567, 250
word 1046, 500
AnzToene = $-LiedData
end @Start
; --------------------------------------------------------------
; --------------------------------------------------------------
; SPEAKER.ASM (c) S.L.
;
; Modul stellt Routinen zur Programmierung des Lautsprechers
; bereit
; --------------------------------------------------------------
..model tiny
..code
..286
public Sound
public NoSound
public Delay
; --------------------------------------------------------------
; Routine Sound
; --------------------------------------------------------------
Sound proc near
enter 0,0 ; Stack-Frame
mov al, 0B6h
out 43h, al ; Zeitgeber vorbereiten
mov dx, 12h
mov ax, 34DCh ; Konstante 1.193.180
cmp word ptr [bp+04], 19 ; Mindestens 19 Hz
jnc @FreqOk
mov word ptr [bp+04], 19
@FreqOk:
div word ptr [bp+04] ; Zähler jetzt in AX
out 42h, al ; Zähler nach 42h
mov al, ah
out 42h, al
in al, 61h ; 61h einlesen
or al, 3 ; Bits 0 und 1 setzen
out 61h, al ; Lautsprecher ein
leave
retn 2 ; Stack-Frame auflösen
Sound endp
; --------------------------------------------------------------
; Routine NoSound
; --------------------------------------------------------------
NoSound proc near
in al, 61h ; 61h einlesen
and al, 0FCh ; Bits 0 und 1 löschen
out 61h, al ; Lautsprecher aus
ret
NoSound endp
; --------------------------------------------------------------
; Routine Delay
; --------------------------------------------------------------
Delay proc near
enter 0,0
mov ax, 1000
mul word ptr [bp+04] ; in Microsekunden
mov cx, dx ; Hi-Wort nach CX
mov dx, ax ; Lo-Wort nach DX
mov ah, 86h
int 15h ; Warten
leave
retn 2
Delay endp
end
; --------------------------------------------------------------
i did not succed to stay resident the program.
;---------------------------------------------------------------
START: jmp short INIT
; resident part
Transient Label word
INIT: ; check if this TSR allrady started before
;---------------------
; routine to terminate and remove this TSR
;---------------------
lea dx, Transient
shr dx, 4
inc dx
mov ah, 31h
int 21h
;---------------------------------------------------------------
RBIL->inter61b.zip->Interrup.f
--------D-2131-------------------------------
INT 21 - DOS 2+ - TERMINATE AND STAY RESIDENT
AH = 31h
AL = return code
DX = number of paragraphs to keep resident
Return: never
Notes: the value in DX only affects the memory block containing the PSP;
additional memory allocated via AH=48h is not affected
the minimum number of paragraphs which will remain resident is 11h
for DOS 2.x and 06h for DOS 3.0+
most TSRs can save some memory by releasing their environment block
before terminating (see #01378 at AH=26h,AH=49h)
any open files remain open, so one should close any files which will
not be used before going resident; to access a file which is left
open from the TSR, one must switch PSP segments first (see AH=50h)
SeeAlso: AH=00h,AH=4Ch,AH=4Dh,INT 20,INT 22,INT 27
---------------------------------------------
Dirk
.
- Follow-Ups:
- Re: to make a TSR
- From: almas
- Re: to make a TSR
- References:
- to make a TSR
- From: almas
- Re: to make a TSR
- From: Dirk Wolfgang Glomp
- Re: to make a TSR
- From: almas
- to make a TSR
- Prev by Date: Re: Algorithms In Assembly Language
- Next by Date: Re: require encoding
- Previous by thread: Re: to make a TSR
- Next by thread: Re: to make a TSR
- Index(es):
Relevant Pages
|