line3 1.6 KB

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