forked from redcode/SpecEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TVNoiseRenderer.asm
73 lines (52 loc) · 1.73 KB
/
TVNoiseRenderer.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
ASSUME ESI: PTR SpectrumGfx
PrepTVNoise:
mov [esi].ScreenVector, OFFSET TVNoiseScanline
mov [esi].TVNoiseLines, 24+192+24 ; 48+192+56
PrepNextTVNoise:
mov [esi].UDCnt, DIBWidth/8 ; 44
Align 16
TVNoiseScanline:
mov byte ptr [ebp], 1
mov byte ptr [ebp+1], 1
mov byte ptr [ebp+2], 1
add ebp, 3
mov [esi].FrameChanged, TRUE
.data
even
TVN_NoiseVals db CLR_SPECBASE+0, CLR_SPECBASE+15
.code
TVN_ScanLp: mov edx, 8
@@: call TVNoiseBit
mov al, [TVN_NoiseVals][eax]
mov [edi], al
add edi, 1
dec edx
jnz @B
dec [esi].UDCnt
jnz TVN_ScanLp
NEXTSCANLINEADDR
mov eax, [esi].ScanTState
add eax, MACHINE.ScanlineCycles
mov [esi].ScanTState, eax
mov [esi].WaitTState, eax
mov edx, [esi].ScanTState
add edx, MACHINE.ScanlineCycles
mov [esi].ScanTState, edx
mov [esi].WaitTState, edx
dec [esi].TVNoiseLines
jnz PrepNextTVNoise
mov [esi].ScreenVector, OFFSET UScrExit
mov [esi].WaitTState, 180000
ret
ASSUME ESI:NOTHING
.code
align 16
TVNoiseBit: mov eax, TVRandomSeed
test eax, 1
.if !ZERO?
xor eax, 24000h
.endif
shr eax, 1
mov TVRandomSeed, eax
and eax, 1
ret