TREUG.ASM 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .286
  2. .model small
  3. .code
  4. org 100h
  5. start:
  6. mov ax, 13h
  7. int 10h
  8. mov ax, 0a000h
  9. mov es, ax
  10. push 1
  11. push 1
  12. push 20
  13. push 20
  14. call Line
  15. push 20
  16. push 20
  17. push 30
  18. push 70
  19. call Line
  20. push 30
  21. push 70
  22. push 1
  23. push 1
  24. call Line
  25. mov ah, 08h
  26. int 21h
  27. mov ax, 3
  28. int 10h
  29. int 20h
  30. ;------------------------------
  31. Line proc near
  32. push bp
  33. mov bp,sp
  34. LY2 EQU word ptr [bp+4]
  35. LX2 EQU word ptr [bp+6]
  36. LY1 EQU word ptr [bp+8]
  37. LX1 EQU word ptr [bp+10]
  38. pusha
  39. mov ifY, 0
  40. mov cur, 0
  41. mov ax, LX2
  42. sub ax, LX1
  43. jg LLX
  44. neg ax
  45. mov si, LX2
  46. mov mybeg, si
  47. jmp TOY
  48. LLX:
  49. mov si, LX1
  50. mov mybeg, si
  51. TOY: mov bx, LY2
  52. sub bx, LY1
  53. jg LLY
  54. neg bx
  55. mov otbeg, si
  56. jmp TOW
  57. LLY:
  58. mov si, LY1
  59. mov otbeg, si
  60. TOW: cmp bx, ax
  61. jl MYX
  62. mov cx, mybeg
  63. mov si, otbeg
  64. mov mybeg, si
  65. mov otbeg, cx
  66. mov ifY, 1
  67. push ax
  68. mov ax, bx
  69. pop bx
  70. MYX: mov gend, ax
  71. mov ots, bx
  72. mainloop:
  73. mov ax, ots
  74. mov bx, cur
  75. mul bx
  76. mov bx, gend
  77. div bx
  78. mov dx, ax
  79. add dx, otbeg
  80. cmp ifY, 0
  81. jz defs
  82. mov ax, mybeg
  83. add ax, cur
  84. mov cx, ax
  85. shl ax, 6
  86. shl cx, 8
  87. add ax, cx
  88. add ax, dx
  89. mov si, ax
  90. mov ax, COL
  91. mov byte ptr es:[si], al
  92. jmp GGG
  93. defs:
  94. mov cx, dx
  95. shl dx, 6
  96. shl cx, 8
  97. add dx, cx
  98. add dx, mybeg
  99. add dx, cur
  100. mov si, dx
  101. mov ax, COL
  102. mov byte ptr es:[si], al
  103. GGG:
  104. inc cur
  105. mov ax, cur
  106. cmp ax, gend
  107. jle mainloop
  108. popa
  109. pop bp
  110. ret 8
  111. ifY db 0
  112. mybeg dw ?
  113. otbeg dw ?
  114. cur dw 0
  115. gend dw ?
  116. ots dw ?
  117. endp
  118. COL dw 4
  119. end start