Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ; Small-C Run Time Library for Win NT
  3. ;
  4. ; Nasm version  17/Nov/98  H T Walheim
  5. ; Revised:      20/Nov/98  HTW [Bugs in switch]
  6. ;
  7.  
  8. _CCARGC:
  9. ;B+ Ellipses arguments ( ,...)
  10.   ;cl - argument count
  11.  
  12.   xor  eax,eax
  13.   movzx eax,cl  ; No sign-extension
  14.   ret
  15. ;E:.
  16.  
  17. ;B+ Compare
  18.  
  19. __ult:
  20. ;B+ ???
  21.   cmp  eax,ebx
  22.   ja   true
  23.   xor  eax,eax
  24.   ret
  25. ;E:.
  26.  
  27. __ugt:
  28. ;B+ ???
  29.   cmp  eax,ebx
  30.   jb   true
  31.   xor  eax,eax
  32.   ret
  33. ;E:.
  34.  
  35. __ule:
  36. ;B+ ???
  37.   cmp  eax,ebx
  38.   jae  true
  39.   xor  eax,eax
  40.   ret
  41. ;E:.
  42.  
  43. __uge:
  44. ;B+ ???
  45.   cmp  eax,ebx
  46.   jbe  true
  47.   xor  eax,eax
  48.   ret
  49. ;E:.
  50.  
  51. __eq:
  52. ;B+ ???
  53.   cmp  eax,ebx
  54.   je   true
  55.   xor  eax,eax
  56.   ret
  57. ;E:.
  58.  
  59. __ne:
  60. ;B+ ???
  61.   cmp  eax,ebx
  62.   jne  true
  63.   xor  eax,eax
  64.   ret
  65. ;E:.
  66.  
  67. __lt:
  68. ;B+ ???
  69.   cmp  eax,ebx
  70.   jg   true
  71.   xor  eax,eax
  72.   ret
  73. ;E:.
  74.  
  75. __gt:
  76. ;B+ ???
  77.   cmp  eax,ebx
  78.   jl   true
  79.   xor  eax,eax
  80.   ret
  81. ;E:.
  82.  
  83. __le:
  84. ;B+ ???
  85.   cmp  eax,ebx
  86.   jge  true
  87.   xor  eax,eax
  88.   ret
  89. ;E:.
  90.  
  91. __ge:
  92. ;B+ ???
  93.   cmp  eax,ebx
  94.   jle  true
  95.   xor  eax,eax
  96.   ret
  97. ;E:.
  98.  
  99. ;E:.
  100.  
  101. __lneg:
  102. ;B+ Logical Negate of Primary
  103.   or   eax,eax
  104.   jnz  false
  105. true:
  106.   mov  eax,1
  107.   ret
  108.  
  109. false:
  110.   xor  eax,eax
  111.   ret
  112. ;E:.
  113.  
  114. __switch:
  115. ;B+ Execute "switch" statement
  116.  
  117.  ;eax   - switch value
  118.  ;[esp] - pointer to switch table
  119.  ;   dd addr1,value1
  120.  ;         ...
  121.  ;   dd 0
  122.  ;   [jmp default]
  123.  ;   continuation
  124.  ;
  125.  ; Revised: 20/Nov/98 [JECXZ needed]
  126.  
  127.  pop  ebx
  128.   jmp  skip
  129. back:
  130.   add  ebx,8        ;next case-pair
  131. skip:
  132.   mov  ecx,[ebx]    ;case-label location (adress)
  133.   jecxz default
  134.   cmp  eax,[ebx+4]  ;test case-value
  135.   jnz  back
  136.   jmp  ecx          ;match -- jump to case
  137. default:
  138.   add  ebx,4
  139.   jmp  ebx          ;jump to default/continuation
  140. ;E:.
  141.