Wenn ich mich mal in Ruhe hinsetzen kann, mach ich mich an die Umsetzung.

Code: Alles auswählen
; Primzahlvielfaches in dx:ax
set_bit:
mov cl,al
and cl,7
mov bx,1
shl bx,cl
shr dx,1
rcr ax,1
shr dx,1
rcr ax,1
shr dx,1
rcr ax,1
mov di,ax
mov cl,12
shl dx,cl
add dx, sieve_seg
mov es,dx
or es:[di], bl
ret
Code: Alles auswählen
;----------------------------------------------------------
; in: EAX bit offset.
; sieve_segments:word - table of segment adresses
; out: CF = bit value.
; AL byte value.
; ES:BX address of byte value.
; CX bit offset within byte.
get_bit:
mov cx,ax
and cx,00000111b
shr eax,3
mov ebx,eax
shr ebx,16
shl bx,1
mov bx,[sieve_segments+bx]
mov es,bx
mov bx,ax
mov al,[es:bx]
bt ax,cx
ret
Code: Alles auswählen
call get_bit
btr ax,cx
mov [es:bx],al