views:

14

answers:

0

i was given a primitive task to find out (and to put in cl) how many nums in an array are bigger than the following ones, (meaning if (arr[i] > arr[i+1]) count++;) but i've problems as it has to be a macro. i am getting errors from TASM. can someone give me a pointer?

SortA macro a, l

 LOCAL noes
  irp reg, <si,di,bx>
  push reg
  endm

     xor bx,bx
  xor si,si  

rept l-1             ;;also tried rept 3 : wont' compile
       mov bl,a[si]  
       inc si
       cmp bl,arr[si]  
       jb noes
       inc di
 noes: add di,0
  endm
 mov cx,di
 irp reg2, <bx,di,si>
     pop reg2
  endm


endm



dseg segment 
 arr db 10,9,8,7
 len = 4

dseg ends


sseg segment stack
       dw 100 dup (?)
  sseg ends


cseg segment
  assume ds:dseg, ss:sseg, cs:cseg
  start: mov ax, dseg
         mov ds,ax

sortA arr,len

cseg ends
   end start

errors:

Assembling file: sorta.asm
**Error** sorta.asm(51) REPT(4) Expecting pointer type
**Error** sorta.asm(51) REPT(6) Symbol already different kind: NOES
**Error** sorta.asm(51) REPT(10) Expecting pointer type
**Error** sorta.asm(51) REPT(12) Symbol already different kind: NOES
**Error** sorta.asm(51) REPT(16) Expecting pointer type
**Error** sorta.asm(51) REPT(18) Symbol already different kind: NOES
Error messages: 6