BENCHLNG.b 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Input file : ./tests/inputs/BENCHLNG.EXE
  3. * File type : EXE
  4. */
  5. #include "dcc.h"
  6. long LMOD@ (long arg0, int arg2, int arg3)
  7. /* Takes 8 bytes of parameters.
  8. * Runtime support routine of the compiler.
  9. * High-level language prologue code.
  10. * Untranslatable routine. Assembler provided.
  11. * Return value in registers dx:ax.
  12. * Pascal calling convention.
  13. */
  14. {
  15. MOV cx, 2
  16. PUSH bp
  17. PUSH si
  18. PUSH di
  19. MOV bp, sp
  20. MOV di, cx
  21. MOV ax, [bp+0Ah]
  22. MOV dx, [bp+0Ch]
  23. MOV bx, [bp+0Eh]
  24. MOV cx, [bp+10h]
  25. CMP cx, 0
  26. JNE L1
  27. OR dx, dx
  28. JE L2
  29. OR bx, bx
  30. JE L2
  31. L1: TEST di, 1
  32. JNE L3
  33. OR dx, dx
  34. JNS L4
  35. NEG dx
  36. NEG ax
  37. SBB dx, 0
  38. OR di, 0Ch
  39. L4: OR cx, cx
  40. JNS L3
  41. NEG cx
  42. NEG bx
  43. SBB cx, 0
  44. XOR di, 4
  45. L3: MOV bp, cx
  46. MOV cx, 20h
  47. PUSH di
  48. XOR di, 0
  49. XOR si, 0
  50. L5: SHL ax, 1
  51. RCL dx, 1
  52. RCL si, 1
  53. RCL di, 1
  54. CMP di, bp
  55. JB L6
  56. JA L7
  57. CMP si, bx
  58. JB L6
  59. L7: SUB si, bx
  60. SBB di, bp
  61. INC ax
  62. L6: LOOP L5
  63. POP bx
  64. TEST bx, 2
  65. JE L8
  66. MOV ax, si
  67. MOV dx, di
  68. SHR bx, 1
  69. L8: TEST bx, 4
  70. JE L9
  71. NEG dx
  72. NEG ax
  73. SBB dx, 0
  74. L9: POP di
  75. POP si
  76. POP bp
  77. RETF 8
  78. L2: MOV tmp, dx:ax ;Synthetic inst
  79. DIV bx
  80. MOD bx ;Synthetic inst
  81. TEST di, 2
  82. JE L10
  83. MOV ax, dx
  84. L10: XOR dx, dx
  85. JMP L9
  86. }
  87. void main ()
  88. /* Takes no parameters.
  89. * High-level language prologue code.
  90. */
  91. {
  92. long loc1;
  93. long loc2;
  94. long loc3;
  95. long loc4;
  96. long loc5;
  97. int loc6; /* ax */
  98. scanf ("%ld", &loc0);
  99. printf ("executing %ld iterations\n", loc5);
  100. scanf ("%ld", &loc2);
  101. scanf ("%ld", &loc3);
  102. loc3 = 1;
  103. while ((loc3 <= loc5)) {
  104. loc2 = 1;
  105. while ((loc2 <= 40)) {
  106. loc4 = ((loc4 + loc1) + loc2);
  107. loc1 = (loc4 >> 1);
  108. loc4 = LMOD@ (loc1, 10);
  109. if (loc1 == loc2) {
  110. loc6 = 1;
  111. }
  112. else {
  113. loc6 = 0;
  114. }
  115. loc4 = loc6;
  116. loc1 = (loc4 | loc2);
  117. if ((loc3 | loc9) == 0) {
  118. loc6 = 1;
  119. }
  120. else {
  121. loc6 = 0;
  122. }
  123. loc4 = loc6;
  124. loc1 = (loc4 + loc2);
  125. if (loc1 > loc2) {
  126. loc6 = 1;
  127. }
  128. else {
  129. loc6 = 0;
  130. }
  131. loc4 = loc6;
  132. loc2 = (loc2 + 1);
  133. } /* end of while */
  134. loc3 = (loc3 + 1);
  135. } /* end of while */
  136. printf ("a=%d\n", loc4);
  137. }