Advertisement
Guest User

Untitled

a guest
May 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1.  
  2. Data;
  3. alloc flag,0
  4. alloc cmpt1,0
  5. alloc puissance,0
  6. alloc index1,0
  7. alloc color,0
  8. alloc value,0
  9. alloc scale,0
  10. alloc offsetx,0
  11. alloc offsety,0
  12. alloc X,0
  13. alloc Y,0
  14. alloc adrX,0
  15. alloc adrY,0
  16.  
  17.  
  18.  
  19. define console,65536 //addresse du lcd
  20. define con_clk,67582 //adresse de la commande marche du lcd
  21. define con_reset,67577 //adresse de la commande reset du lcd
  22.  
  23.  
  24.  
  25. line0: db 'TEST',0 // metre entre les '' le texte quon veut
  26.  
  27.  
  28.  
  29. Code;
  30. mov #con_clk,1 //turns the console ON
  31. call cls
  32. jmp main
  33.  
  34. Main:
  35. mov #color,090 //change la couleur du lcd
  36.  
  37.  
  38. mov ebx,65536 //l'endroi ou tu ecrit sur lafficheur
  39. mov eax,Line0 //la string a ecrire
  40. call Writestring //ecrire la string
  41.  
  42.  
  43. mov eax,123456789 //valeur a ecrire
  44. call writevalue //ecrire la valeur
  45.  
  46. jmp main
  47.  
  48.  
  49.  
  50. //----------------------------------------------------------------------
  51.  
  52.  
  53. writelcd:
  54. mov ebx,#y
  55. mul ebx,32
  56. add ebx,#x
  57. add ebx,67584
  58. mov #ebx,#color //put the chars to console!
  59. ret
  60.  
  61.  
  62. cls:
  63. mov #con_reset,1
  64. mov #con_reset,0
  65. ret
  66.  
  67. Writestring: //EBX = address to write, EAX = the db line to write, then call it.
  68. cmp #eax,0 //check to see if we have reached end of string "0"
  69. je Writend
  70. mov #ebx,#eax //put the chars to console!
  71. inc ebx //Bump Console up one cell
  72. mov #ebx,#color //output char params
  73. inc ebx //next console cell
  74. inc eax //next value in the string
  75. jmp Writestring //keep writing till we hit a 0
  76. Writend:
  77. ret
  78.  
  79.  
  80.  
  81. writevalue:
  82. mov #puissance,1
  83. mov ecx,eax
  84. calcsize:
  85. cmp ecx,10
  86. jle again
  87. div ecx,10
  88. mul #puissance,10
  89. jmp calcsize
  90. again:
  91. cmp eax,#puissance
  92. mov ecx,0
  93. cge convert
  94. call writenumber
  95. div #puissance,10
  96. cmp #puissance,1
  97. jge again
  98. mov ecx,-16
  99. call writenumber
  100. ret
  101.  
  102. convert:
  103. sub eax,#puissance
  104. add ecx,1
  105. cmp eax,#puissance
  106. jge convert
  107. ret
  108.  
  109. Writenumber:
  110. add ecx,48
  111. mov #ebx,ecx
  112. inc ebx
  113. mov #ebx,952
  114. inc ebx
  115. ret
  116.  
  117.  
  118. wait:
  119. dec eax
  120. cmp eax,0
  121. jne wait
  122. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement