S
S
sovsemobezumel2015-06-15 22:09:55
Programming
sovsemobezumel, 2015-06-15 22:09:55

TASM: how to "wrap" a procedure in a macro?

How to "wrap" the outarr8 procedure in a macro? I read about macros on the Internet, but I don't understand how to use them in my case.

MODEL Small,pascal
include io.asm
S       segment stack 'stack'
        DB 256 DUP(?)
S       ends
 
D       segment
A   db  8,5,8,7,1,4
B   db  1,-1,6 DUP(4),9,4,7
numbera    dw  6
numberb    dw  11
x   dw  ?
y   dw  ?
D       ends
 
C       segment
        assume CS:C, DS:D, SS:S
 
outarr8 proc far data1:word,data2:word
LOCAL   xloc:WORD,smesh:WORD,num:WORD
    MOV AX,data1
    mov smesh,ax
    MOV ax,data2
    mov num,AX
    push dx
    push cx
    push bx
    push ax
    mov si,0
    mov bx,smesh
prv1:
    cmp si,num
    jge nxt1
    mov al,BYTE ptr [si+bx]
    mov xloc,ax
    outint xloc
    newline
    inc si
    jmp prv1
nxt1:  pop ax
    pop bx
    pop cx
    pop dx
    ret
    endp
 
start:  mov ax,D
        mov DS,ax
    
    mov si,numbera
    mov al,A[si-1]
    mov ah,0
    mov x,ax
    
    mov ax,0
    mov si,1
prv2:
    add al,B[si-1]
    cmp si,numberb
    jge nxt2
    inc si
    jmp prv2
nxt2:  mov dx,0
    idiv numberb
    cmp x,ax
    je nxt3
vzvb: LEA dx,b;mov ax,offset B
    MOV CX,numberb;mov bx,numberb
    call outarr8
    finish
nxt3:  cmp dx,0
    je vzva
    jmp vzvb
vzva:
    LEA DX,A;    mov ax,offset A
    mov Cx,numbera;    mov bx,numbera
    call outarr8,DX,CX
    finish
 
C   ends
    end start

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question