-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNOISE.asm
More file actions
77 lines (76 loc) · 2.05 KB
/
NOISE.asm
File metadata and controls
77 lines (76 loc) · 2.05 KB
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
title "NOISE"
; list
;=====================================================
;
; NOISE PROGRAM FOR THE MODEL 68 MUSIC BOARD TEST ROUTINE
; THIS ROUTINE PRODUCES WHITE NOISE
; (FREQUENCY IS DEPENDING ON SYSTEM CLOCK)
;
; Modified by MATT SPENCE, SPENCEMA@HOTMAIL.COM in
; JUNE 2024 to learn how the assembler works.
; Also made it compatible with the AS09
; assembler.
;
; Memory map note:
; THIS PROGRAM CAN BE PLACED ANYWHERE
; THE I/O SLOT ADDRESS WILLDEPEND ON YOUR SYSTEM 8010 = SLOT 4 IN 6800
; E060 = SLOT 6 IN 6809, ETC
; hex code 4C B7 E060 20 FA
org $0100 ;define the start address of the code
ldu #tbl ;init envelope pointer
stx tblp ;
loop2 lda #$02 ;if envelope is
ldu tblp ;complete return.
cmpa ,x
beq exit
ldu tblp ;else inc. env. pointer
leax 1,x ;syntax error ***** inx 6800
stu tblp
lda dura ;output n random values
sta durat
loop1 lda freq ;delay according to
loop3 deca ;frequency parameter
bne loop3
bsr rndm ;get random number in a.
ldx tblp ;scale amplitudeaccording
anda ,x ;to env table.
sta mod68 ;output to music board.
dec durat
bne loop1
bra loop2 ;process next amplitude.
exit jmp mikbug ;your exit may differ!
; random number generator.
; generates 16 bit
; value in "NMBER". returns most significant
; byte in a.
rndm lda msb ;exclusive-or shift
rora ;register bits 15,14,12,3
eora msb ;15 & 14
rora
rora
eora msb ;12
rora
eora lsb ;3
rora
rora
anda #$01 ;mask bit 0.
asl lsb ;shift nmber left.
rol msb ;setting bit 0 according
adda lsb ;to exclusive-or calc.
sta lsb ;
rts
; * amplitude envelope specification:
tbl fcb $ff,$ff,$ff,$7f,$7f,$3F
fcb $3f,$1f,$0f,$07,$02
; *
freq fcb $30 ;noise band parameter
dura fcb $ff ;duration parameter
nmber fcb $01 ;shift register******mod
mod68 equ $E060 ;define the port address of the card
mikbug equ $F800 ;monitor re-entry
tblp rmb 2 ;envelope table pointer
durat rmb 1 ;temporary duration count
msb equ nmber ;random number routine
lsb equ nmber+1 ;"
nop
end