Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,42 +1,42 @@
|
|||
puts: equ 9 ; MS-DOS print string syscall
|
||||
amount: equ 20 ; Amount of antiprimes to find
|
||||
cpu 8086
|
||||
org 100h
|
||||
xor si,si ; SI = current number
|
||||
xor cx,cx ; CH = max # of factors, CL = # of antiprimes
|
||||
cand: inc si
|
||||
mov di,si ; DI = maximum factor to test
|
||||
shr di,1
|
||||
mov bp,1 ; BP = current candidate
|
||||
xor bl,bl ; BL = factor count
|
||||
.test: mov ax,si ; Test current candidate
|
||||
xor dx,dx
|
||||
div bp
|
||||
test dx,dx ; Evenly divisible?
|
||||
jnz .next
|
||||
inc bx ; Then increment factors
|
||||
.next: inc bp ; Next possible factor
|
||||
cmp bp,si ; Are we there yet?
|
||||
jbe .test ; If not, try next factor
|
||||
cmp bl,ch ; Is it an antiprime?
|
||||
jbe cand ; If not, next candidate
|
||||
inc cx ; If so, increment the amount of antiprimes seen
|
||||
mov ch,bl ; Update maximum amount of factors
|
||||
mov bx,nbuf ; Convert current number to ASCII
|
||||
mov ax,si
|
||||
mov di,10
|
||||
digit: xor dx,dx ; Extract a digit
|
||||
div di
|
||||
add dl,'0' ; Add ASCII 0
|
||||
dec bx
|
||||
mov [bx],dl ; Store it
|
||||
test ax,ax ; Any more digits?
|
||||
jnz digit ; If so, get next digit
|
||||
mov dx,bx
|
||||
mov ah,puts
|
||||
int 21h ; Print using MS-DOS
|
||||
cmp cl,amount ; Do we need any more antiprimes?
|
||||
jb cand ; If so, find the next one
|
||||
ret ; Otherwise, back to DOS
|
||||
db '.....' ; Placeholder for decimal output
|
||||
nbuf: db ' $'
|
||||
puts: equ 9 ; MS-DOS print string syscall
|
||||
amount: equ 20 ; Amount of antiprimes to find
|
||||
cpu 8086
|
||||
org 100h
|
||||
xor si,si ; SI = current number
|
||||
xor cx,cx ; CH = max # of factors, CL = # of antiprimes
|
||||
cand: inc si
|
||||
mov di,si ; DI = maximum factor to test
|
||||
shr di,1
|
||||
mov bp,1 ; BP = current candidate
|
||||
xor bl,bl ; BL = factor count
|
||||
.test: mov ax,si ; Test current candidate
|
||||
xor dx,dx
|
||||
div bp
|
||||
test dx,dx ; Evenly divisible?
|
||||
jnz .next
|
||||
inc bx ; Then increment factors
|
||||
.next: inc bp ; Next possible factor
|
||||
cmp bp,si ; Are we there yet?
|
||||
jbe .test ; If not, try next factor
|
||||
cmp bl,ch ; Is it an antiprime?
|
||||
jbe cand ; If not, next candidate
|
||||
inc cx ; If so, increment the amount of antiprimes seen
|
||||
mov ch,bl ; Update maximum amount of factors
|
||||
mov bx,nbuf ; Convert current number to ASCII
|
||||
mov ax,si
|
||||
mov di,10
|
||||
digit: xor dx,dx ; Extract a digit
|
||||
div di
|
||||
add dl,'0' ; Add ASCII 0
|
||||
dec bx
|
||||
mov [bx],dl ; Store it
|
||||
test ax,ax ; Any more digits?
|
||||
jnz digit ; If so, get next digit
|
||||
mov dx,bx
|
||||
mov ah,puts
|
||||
int 21h ; Print using MS-DOS
|
||||
cmp cl,amount ; Do we need any more antiprimes?
|
||||
jb cand ; If so, find the next one
|
||||
ret ; Otherwise, back to DOS
|
||||
db '.....' ; Placeholder for decimal output
|
||||
nbuf: db ' $'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue