Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: ASM (NASM)  |  size: 0.48 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. %include "io.inc"
  2.  
  3. section .data
  4.         n dd 0
  5.         m dd 13
  6.         array1 db 'S', 'C', 'D', 'H'
  7.         array2 db '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'
  8.                
  9. section .text
  10.         global CMAIN
  11.  
  12.         CMAIN:
  13.                 GET_UDEC 4, [n]        
  14.                 mov eax, dword [n]
  15.                 dec eax
  16.                 mov edx, 0
  17.                 div dword [n]
  18.                 mov ebx, edx; ebx - equal of card
  19.                 mov ecx, eax; ecx - colour of card
  20.                 mov al, byte [array2 + ebx]
  21.                 PRINT_CHAR al
  22.                 mov al, byte [array1 + ecx]
  23.                 PRINT_CHAR al
  24.                 xor eax, eax
  25.                 ret