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