-
Notifications
You must be signed in to change notification settings - Fork 0
/
11.b.HalfSineWave.asm
70 lines (60 loc) · 1.26 KB
/
11.b.HalfSineWave.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
; 11.a. Design and develop an assembly language program to
; generate the Half Rectified Sine waveform using DAC interface (The output of the DAC is to be
; displayed on the CRO).
.model small
.stack
.data
exit macro
mov ah, 4ch
int 21h
endm
send macro port, val
mov dx, port
mov al, val
out dx, al
endm
kbhit macro
mov ah, 01h
int 16h
endm
pa equ 0dc50h
cwr equ 0dc53h
arr db 00h, 16h, 2bh, 40h, 52h, 61h, 6eh, 77h, 7dh, 7fh, 7dh, 77h, 6eh, 61h, 52h, 40h, 2bh, 16h
.code
mov ax, @data
mov ds, ax
send cwr, 80h
repeat:
mov cx, 18
lea si, arr
back1:
mov al, 7fh
add al, [si]
send pa, al
call delay
inc si
loop back1
mov cx, 18
lea si, arr
back2:
mov al, 7fh
send pa, al
call delay
inc si
loop back2
kbhit
jz repeat
exit
delay proc
push cx
mov cx, 0fffh
bck1:
mov bx, 0ffh
bck:
dec bx
jnz bck
loop bck1
pop cx
ret
delay endp
end