OpenVMS Source Code Demos

PEEK_BYTE_FUNCTION.MAR

;----------------------------------------------------------------------
; Peek_byte_function.mar
; Neil S. Rieck
; 1999.11.12
;
; 1. This MACRO function peeks (byte wise) into a memory location
; 2. It is meant to be called from BASIC (see peek_byte_demo.bas)
; 3. The default method of passing numeric data in BASIC is by reference
; 4. This example is fully annotated
;----------------------------------------------------------------------
    .entry  peek_byte_function,^M<> ; 1a. function name is PEEK_BYTE_FUNCTION
                                    ; 1b. entry mask is null
    clrq    r0                      ; 2a. clear both r0 + r1 (cuz q = 64 bit)
    movl    @4(ap),r2               ; 3a. stack parameter #1 is address of data
    movb    (r2),r0                 ; 4a. do an indirect byte fetch into r0
    ret                             ; 5a. return to BASIC
    .end

Back to Home
Neil Rieck
Waterloo, Ontario, Canada.