CIRCLE.ASM 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. ;----------------------------------
  11. mov X, 0
  12. mov ax, rad
  13. mov Y, ax
  14. mov sum, 0
  15. writeloop: mov ax, x
  16. add ax, x0
  17. push ax
  18. mov ax, y0
  19. sub ax, y
  20. push ax
  21. push 5
  22. call plotpixel
  23. inc x
  24. mov ax, x
  25. add sum, ax
  26. mov ax, y
  27. cmp sum, ax
  28. jl endloop
  29. mov ax, y
  30. sub sum, ax
  31. dec y
  32. endloop: mov ax, rad
  33. cmp x, ax
  34. jle writeloop
  35. mov ah, 08h
  36. int 21h
  37. mov ax, 3
  38. int 10h
  39. int 20h
  40. ;----------------------------------------------
  41. x0 dw 100
  42. y0 dw 100
  43. x dw ?
  44. y dw ?
  45. rad dw 20
  46. sum dw ?
  47. ;-----------------------------------------------
  48. plotpixel PROC NEAR
  49. PUSH BP
  50. MOV BP,SP
  51. plotcol equ word ptr [bp+4]
  52. ploty equ word ptr [bp+6]
  53. plotx equ word ptr [bp+8]
  54. push ax
  55. push bx
  56. push si
  57. mov ax, ploty
  58. mov bx, ax
  59. shl ax, 8
  60. shl bx, 6
  61. add ax, bx
  62. add ax, ploty
  63. mov si, ax
  64. mov ax, plotcol
  65. mov es:[si], al
  66. pop si
  67. pop bx
  68. pop ax
  69. pop bp
  70. ret 6
  71. ENDP
  72. end start