Advertisement
Guest User

Assembly paint

a guest
Jun 15th, 2013
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. org 100h
  2. y_Pos: db 5 ;Cursor Y pos
  3. x_Pos: db 5 ;Cursor X pos
  4. Charecter db ' '
  5. MainLoop:
  6. mov ah, 02h
  7. mov dh, [y_Pos]
  8. mov dl, [x_Pos]
  9. int 10h ; Move the cursor
  10. mov ah, 09h ; bl has the color already
  11. mov al, byte[Charecter]
  12. mov cx, 1d
  13. int 10h ;Draw the color at cursor
  14. call Get_User_Input
  15. cmp al, 'w'
  16. je Up_Cursor
  17. cmp al, 's'
  18. je Down_Cursor
  19. cmp al, 'a'
  20. je Left_Cursor
  21. cmp al, 'd'
  22. je Right_Cursor
  23. cmp al, 'c'
  24. je Change_Color
  25. cmp al, 'r'
  26. je Change_Draw_Unit
  27. jmp MainLoop
  28. Up_Cursor:
  29. cmp byte[y_Pos], 0
  30. je MainLoop
  31. dec byte [y_Pos]
  32. jmp MainLoop
  33. Down_Cursor:
  34. cmp byte [y_Pos], 24
  35. je MainLoop
  36. inc byte [y_Pos]
  37. jmp MainLoop
  38. Left_Cursor:
  39. cmp byte[x_Pos], 0
  40. je MainLoop
  41. dec byte[x_Pos]
  42. jmp MainLoop
  43. Right_Cursor:
  44. cmp byte[x_Pos],79
  45. je MainLoop
  46. inc byte[x_Pos]
  47. jmp MainLoop
  48. Change_Color:
  49. call Get_User_Input
  50. cmp al, '1'
  51. je BLU
  52. cmp al, '2'
  53. je BLA
  54. cmp al, '3'
  55. je GRE
  56. cmp al, '4'
  57. je AK
  58. cmp al, '5'
  59. je RED
  60. cmp al, '6'
  61. je PUR
  62. cmp al, '7'
  63. je YEL
  64. cmp al, '8'
  65. je WHI
  66. BLU:
  67. mov bl, 19d
  68. jmp MainLoop
  69. BLA:
  70. mov bl, 08d
  71. jmp MainLoop
  72. GRE:
  73. mov bl, 2ah
  74. jmp MainLoop
  75. AK:
  76. mov bl, 3bh
  77. jmp MainLoop
  78. RED:
  79. mov bl, 4ch
  80. jmp MainLoop
  81. PUR:
  82. mov bl, 5dh
  83. jmp MainLoop
  84. YEL:
  85. mov bl, 6eh
  86. jmp MainLoop
  87. WHI:
  88. mov bl, 7fh
  89. jmp MainLoop
  90. Change_Draw_Unit:
  91. call Get_User_Input
  92. mov byte[Charecter],al
  93. jmp MainLoop
  94. Get_User_Input:
  95. mov ah,00h
  96. int 16h ;Get user input
  97. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement