home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1991 / 04 / review / sievetop.a < prev    next >
Text File  |  1991-01-04  |  4KB  |  125 lines

  1. module sievetop
  2.  
  3. extrn InOut$WriteString
  4. extrn InOut$Read
  5. extrn InOut$WriteLn
  6. extrn InOut$Write
  7. extrn InOut$WriteCard
  8. extrn InOut$
  9. extrn __initm
  10.  
  11. segment _BSS(BSS,00028H) (*segment length = 02002H*)
  12.                             $0:
  13. org 01FFFH
  14.                             $1:
  15. org 00001H
  16.                             $2:
  17. org 00002H
  18.  
  19. segment _CONST(DATA,00028H) (*segment length = 00023H*)
  20.                             $3:
  21. db 048H,069H,074H,020H,061H,020H,06BH,065H
  22. db 079H,020H,074H,06FH,020H,073H,074H,061H
  23. db 072H,074H,020H,032H,030H,030H,030H,020H
  24. db 049H,054H,045H,052H,041H,054H,049H,04FH
  25. db 04EH,053H,000H
  26.  
  27. segment _CONST(DATA,00028H) (*segment length = 00008H*)
  28.                             public _main:
  29.   dd $4
  30.   dw InOut$
  31. db 0FFH,0FFH
  32.  
  33. segment _DATA(DATA,00028H) (*segment length = 00009H*)
  34.                             public __initx:
  35.   dd __initm
  36. db 000H,040H,0FFH,0FFH,000H
  37.  
  38. segment STACK(STACK,00074H) (*segment length = 04000H*)
  39. org 04000H
  40.  
  41. segment NEAR_STACK(BSS,00028H) (*segment length = 00001H*)
  42.                             public __near_stack_start:
  43. org 00001H
  44.  
  45. segment NEAR_HEAP(BSS,00028H) (*segment length = 0FFFFH*)
  46.                             public __near_heap_start:
  47. org 0FFFFH
  48.  
  49. segment SieveTopSpeed_TEXT(CODE,00048H) (*segment length = 00034H*)
  50.                             $4:
  51. (*0000 BB 00 00*)             mov   bx,$3
  52. (*0003 8C D9*)                mov   cx,ds
  53. (*0005 B8 23 00*)             mov   ax,23H
  54. (*0008 9A 00 00 00 00*)       call  far InOut$WriteString
  55. (*000D B8 FF 1F*)             mov   ax,$1
  56. (*0010 8C DB*)                mov   bx,ds
  57. (*0012 9A 00 00 00 00*)       call  far InOut$Read
  58. (*0017 9A 00 00 00 00*)       call  far InOut$WriteLn
  59. (*001C 9A 00 00 00 00*)       call  far $5
  60. (*0021 B0 07*)                mov   al,7
  61. (*0023 9A 00 00 00 00*)       call  far InOut$Write
  62. (*0028 A1 00 20*)             mov   ax,[$2]
  63. (*002B BB 05 00*)             mov   bx,5
  64. (*002E 9A 00 00 00 00*)       call  far InOut$WriteCard
  65. (*0033 CB*)                   ret far 0
  66.  
  67. segment SieveTopSpeed_TEXT(CODE,00048H) (*segment length = 0005FH*)
  68.                             $5:
  69. (*0000 57*)                   push  di
  70. (*0001 56*)                   push  si
  71. (*0002 52*)                   push  dx
  72. (*0003 51*)                   push  cx
  73. (*0004 53*)                   push  bx
  74. (*0005 50*)                   push  ax
  75. (*0006 BB 01 00*)             mov   bx,1
  76. (*0009 33 D2*)                xor   dx,dx
  77. (*000B EB 1C*)                jmp   $9
  78. (*000D 90*)                   nop   
  79.                             $6:
  80. (*000E C6 84 00 00 00*)       mov   byte [si][$0],0
  81. (*0013 03 F0*)                add   si,ax
  82.                             $7:
  83. (*0015 3B F1*)                cmp   si,cx
  84. (*0017 76 F5*)                jbe   $6
  85. (*0019 FF 06 00 20*)          inc   word [$2]
  86.                             $8:
  87. (*001D 47*)                   inc   di
  88. (*001E 3B F9*)                cmp   di,cx
  89. (*0020 76 22*)                jbe   $10
  90. (*0022 43*)                   inc   bx
  91. (*0023 81 FB D0 07*)          cmp   bx,7D0H
  92. (*0027 77 2F*)                ja    $11
  93.                             $9:
  94. (*0029 89 16 00 20*)          mov   [$2],dx
  95. (*002D B0 01*)                mov   al,1
  96. (*002F BF 00 00*)             mov   di,$0
  97. (*0032 1E*)                   push  ds
  98. (*0033 07*)                   pop   es
  99. (*0034 AA*)                   stosb 
  100. (*0035 8A E0*)                mov   ah,al
  101. (*0037 B9 FF 0F*)             mov   cx,0FFFH
  102. (*003A F3 AB*)                rep   ;stosw 
  103. (*003C B8 FF 1F*)             mov   ax,1FFFH
  104. (*003F 8B FA*)                mov   di,dx
  105. (*0041 B9 FE 1F*)             mov   cx,1FFEH
  106.                             $10:
  107. (*0044 80 BD 00 00 00*)       cmp   byte [di][$0],0
  108. (*0049 74 D2*)                je    $8
  109. (*004B 8B C7*)                mov   ax,di
  110. (*004D 03 C7*)                add   ax,di
  111. (*004F 05 03 00*)             add   ax,3
  112. (*0052 8B F7*)                mov   si,di
  113. (*0054 03 F0*)                add   si,ax
  114. (*0056 EB BD*)                jmp   $7
  115.                             $11:
  116. (*0058 58*)                   pop   ax
  117. (*0059 5B*)                   pop   bx
  118. (*005A 59*)                   pop   cx
  119. (*005B 5A*)                   pop   dx
  120. (*005C 5E*)                   pop   si
  121. (*005D 5F*)                   pop   di
  122. (*005E CB*)                   ret far 0
  123.  
  124. end
  125.