; Life42 by Baudsurfer/rsi 2015 aka olivier.poudade.free.fr ; revision history : ; 14/06/2015 42 bytes by Olivier "Baudsurfer/rsi" Poudade ; 02/04/2015 44 bytes by Olivier "Baudsurfer/rsi" Poudade ; 13/03/2015 47 bytes by Olivier "Baudsurfer/rsi" Poudade ; 12/03/2015 51 bytes by Olivier "Baudsurfer/rsi" Poudade ; 05/01/1998 65 bytes original version by Vladislav Kaipetsky, Tenie Remmel, Mark Andreas org 100h mov al,13h ; Set mode 13h int 10h push 09000h-1 ; DS = last 64K segment pop ds les bp,[bx];push 0A000h ; ES = video memory ;pop es LifeLoop:xchg cx,ax AccLoop: add cl,[di+bx-64-16] ; Add in this column add cl,[si+bx-2-16] add cl,[si+bx+318-16] dec bx ; Loop back jnz AccLoop lodsb ; Get center cell, set pixel stosb stc ; 3 = birth, 4 = stay (tricky): rcr al,cl ; 1.00?0000x --> 0.0x100?00 (rcr 3) and al,20h ; ^carry | ^ or [si-1-16],al ; Add in new cell ^ shr byte [di-65-16],5 ; Shift previous value mov bl,3 ; 3 iterations in AccLoop jmp LifeLoop ; Life42 42-byte Conway's game of life by Baudsurfer/rsi 2015 aka olivier.poudade.free.fr ; optimized from original 65-byte ver. by Vladislav Kaipetsky, Tenie Remmel, Mark Andreas org 100h mov al,13h ; Set mode 13h int 10h ; push 09000h ; DS = last 64K segment ; pop ds ; push 0A000h ; ES = video memory ; pop es les cx,[bx] push 8fffh pop ds LifeLoop:xchg cx,ax AccLoop: add cl,[di+bx-64] ; Add in this column add cl,[si+bx-2] add cl,[si+bx+318] dec bx ; Loop back jnz AccLoop lodsb ; Get center cell, set pixel stosb stc ; 3 = birth, 4 = stay (tricky): rcr al,cl ; 1.00?0000x --> 0.0x100?00 (rcr 3) and al,20h ; ^carry | ^ or [si-1],al ; Add in new cell ^ shr byte [di-65],5 ; Shift previous value mov bl,3 ; 3 iterations in AccLoop jmp LifeLoop ; Life44 44-byte Conway's game of life by Baudsurfer/rsi 2015 aka olivier.poudade.free.fr ; optimized from original 65-byte ver. by Vladislav Kaipetsky, Tenie Remmel, Mark Andreas org 100h mov al,13h ; Set mode 13h int 10h push 09000h ; DS = last 64K segment pop ds push 0A000h ; ES = video memory pop es LifeLoop:xchg cx,ax AccLoop: add cl,[di+bx-64] ; Add in this column add cl,[si+bx-2] add cl,[si+bx+318] dec bx ; Loop back jnz AccLoop lodsb ; Get center cell, set pixel stosb stc ; 3 = birth, 4 = stay (tricky): rcr al,cl ; 1.00?0000x --> 0.0x100?00 (rcr 3) and al,20h ; ^carry | ^ or [si-1],al ; Add in new cell ^ shr byte [di-65],5 ; Shift previous value mov bl,3 ; 3 iterations in AccLoop jmp LifeLoop