summaryrefslogtreecommitdiff
path: root/dviware/beebe/src/zerom.mac
diff options
context:
space:
mode:
Diffstat (limited to 'dviware/beebe/src/zerom.mac')
-rw-r--r--dviware/beebe/src/zerom.mac25
1 files changed, 25 insertions, 0 deletions
diff --git a/dviware/beebe/src/zerom.mac b/dviware/beebe/src/zerom.mac
new file mode 100644
index 0000000000..f61715c049
--- /dev/null
+++ b/dviware/beebe/src/zerom.mac
@@ -0,0 +1,25 @@
+ title ZEROM - C function to zero memory
+COMMENT #
+Zero a block of memory with a fast BLT instruction.
+
+Usage: (void)zerom(array,length);
+#
+ search $mdefs
+ twoseg $text
+ entry zerom
+
+define array <-1(p)> ;n-th arg always at -n(fp)
+define length <-2(p)> ;and here we have fp=p for speed
+
+zerom: skipg length
+ jrst done ;exit if length <= 0
+ hrl 1,array ;[array,,]
+ hlr 1,1 ;[array,,array]
+ hrrz 2,1 ;[0,,array]
+ setzm 0(2) ;array[0] = 0
+ add 2,length ;[0,,array+length]
+ addi 1,1 ;[array,,array+1] = BLT control word
+ blt 1,-1(2) ;clear the array up to array+length-1
+done:
+ popj p, ;return to caller
+ end