Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. ;PROGRAM EXAMPLE FOR USING A SIMPLE MACRO
  2. TITLE Program with macro call
  3. MYSTACK SEGMENT PARA 'STACK'
  4. DB 64 DUP ('STACK')
  5. MYSTACK ENDS
  6. DATA SEGMENT PARA 'DATA'
  7. TAMP DB 2000 DUP (' ')
  8. DATA ENDS
  9. INTIR MACRO TIME
  10. LOCAL P1, P2 ;;p1 and p2 are local labels
  11. PUSH DX ;;saves dx and cx registers
  12. PUSH CX
  13. MOV DX, TIME ;; loads a delay in dx
  14. P1: MOV CX, 0FF00H ;;loads cx with 0FF00h
  15. ;;counts
  16. P2: DEC CX ;;delays by decrementing cx
  17. JNZ P2 ;;if cx!=0 continue
  18. DEC DX ;;if cx=0 decrements dx
  19. JNZ P1 ;;if dx!=0 loads again cx
  20. POP CX ;;if dx=0 remake cx and dx
  21. POP DX ;;
  22. ENDM ;;end macro
  23. MYCOD SEGMENT PARA 'CODE' ;defines code segment
  24. PROCED PROC FAR ;procedure with proced name
  25. ASSUME CS:MYCOD, ES:DATA, DS:DATA, SS:MYSTACK
  26. PUSH DS
  27. XOR AX,AX
  28. PUSH AX
  29. MOV AX, DATA ;puts data segment in ax
  30. MOV ES, AX
  31. MOV DS,AX ;loads es with data segment
  32. ;program will clear the display writing 25*80 spaces on the screen
  33. ;writing those with different values in bl the screen color will change
  34. ;intir macro will maintain this color for a time
  35. MOV CX, 09H ;loops 8 times
  36. MOV BL, 00H ;sets background color
  37. LOOP1: LEA BP, TAMP ;writes black string
  38. MOV DX, 0000H ;sets the cursor to the upper
  39.  
  40. MOV AH, 19 ;writes attribute string
  41. MOV AL, 1 ;writes a character and moves
  42. ;the cursor
  43. PUSH CX ;saves cx
  44. MOV CX, 2710H ;writes 2000 spaces
  45. INT 10H ;call 10h
  46. INTIR 1000 ;delays 10 units
  47. ADD BL, 10H ;changes background color
  48. POP CX ;restores cx
  49. LOOP LOOP1 ;loops 8 times
  50. RET ;hands over the control to
  51. ;dos
  52. PROCED ENDP ;end procedure
  53. MYCOD ENDS ;end code segment
  54. END PROCED ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement