-
Notifications
You must be signed in to change notification settings - Fork 10
/
pdp11gui_aux.mac
69 lines (61 loc) · 1.42 KB
/
pdp11gui_aux.mac
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
.title aux
; utilities
; memclr
; clears r0..r5
regclr:
clr r0
clr r1
clr r2
clr r3
clr r4
clr r5
return
; memclr
; clears R2 words from R0
; Return: R2 is 0, R0 is incremeneted
memclr:
1$:
tst r2 ; while(n) {
beq 2$
clr (r0)+ ; *dst++ = 0
dec r2 ; n--
br 1$ ; }
2$:
return
; memset
; fills memory with double-word pattern
; sets R3 words from R0 to value in R1,R2
; r3 must be even!
; Return: R3 is 0, R0 is incremented
; Speed is essential for RLE decoding
; Speed calculation: n*3 cycles
memset:
tst r3
beq 9$ ; already 0
1$:
mov r1,(r0)+ ; *dst++ = pattern_1
dec r3
mov r2,(r0)+ ; *dst++ = pattern_2
sob r3,1$
9$:
return
; memcpy
; copy R2 words from R0 to R1
; Return: R0, R1 are incremented, R2 is 0
memcpy:
1$:
tst r2 ; while(n) {
beq 2$
mov (r0)+,(r1)+ ; *dst++ = *src++
dec r2 ; n--
br 1$ ; }
2$:
return
; warte 64k cpu cycles
wait64k:
mov r0,-(sp)
mov #100000,r0 r0 ; loop hat 2 cycles: load with 32k
1$: dec r0
bne 1$
mov (sp)+,r0
return