;prime5f without the text, with command line file. org 100h mov sp, -10 mov ax, freemem shr ax, 4 mov bx, cs add bx, ax mov es, bx mov ds, bx ;ds and es point to primes data xor di, di mov eax, 11111111000000001111111100000000b mov ecx, 4000h rep stosd ;set odds in es:0000 through es:FFFF add bx, 1000h mov ss, bx mov es, bx ;ss and es point to output xor di, di mov eax, ' ' mov ecx, 4000h rep stosd ;clear es:0000 through es:FFFF mov ax, ds mov es, ax ;es points to output again xor bp, bp mov cx, 1 xor bh, bh mov di, 1 next3: add di, 2 jc stop cmp byte [di], bh je next3 mov ax, di next: mov byte [di], bh add di, ax jnc next mov di, ax mov bx, 10 mov word [bp], 0a0dh add bp, 7 push bp decloop: dec bp xor dx, dx div bx add dl, '0' mov [bp], dl cmp ax, 0 jne decloop pop bp jmp next3 stop: mov ax, cs mov ds, ax mov es, ax ;ds and es = cs mov dx, 82h mov di, [80h] and di, 0xFF mov byte [di+81h], 0 mov ah, 3ch xor cx, cx int 21h ;create file on command line jc nogo mov cx, bp mov bx, ax mov ax, ss mov ds, ax xor dx, dx mov ah, 40h int 21h ;write BP bytes to file from SS:0000 mov ah, 3eh int 21h ;close mov ax, cs mov ds, ax mov dx, endmsg mov ah, 9 int 21h nogo: mov ax, 4c00h int 21h ;end endmsg db 13, 10, "Inhahe '98$" section .bss stack resb 100 initsp: resb 16 freemem: