Jump to content

macro problem

- - - - -

  • Please log in to reply
1 reply to this topic

#1
wildfly

wildfly

    Newbie

  • Members
  • Pip
  • 1 posts
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




these are the errors TASM gives me:

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

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Is there any particular reason why you're using TASM? There are newer and better (free) compilers and such available on the Internet. TASM has largely fallen out of use--Borland doesn't even support it anymore--so there's a lower chance of someone being able to help you than if you were to use MASM or NASM.
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users