cpu 8086 org 100h mov si,perms ; Start of permutations xor bx,bx ; First word of permutation xor dx,dx ; Second word of permutation mov cx,23 ; There are 23 permutations given perm: lodsw ; Load first word of permutation xor bx,ax ; XOR with first word of missing lodsw ; Load second word of permutation xor dx,ax ; XOR with second word of missing loop perm ; Get next permutation mov [mperm],bx ; Store in placeholder mov [mperm+2],dx mov ah,9 ; Write output mov dx,msg int 21h ret msg: db 'Missing permutation: ' mperm: db 0,0,0,0,'$' ; Placeholder perms: db 'ABCD','CABD','ACDB','DACB','BCDA','ACBD','ADCB','CDAB' db 'DABC','BCAD','CADB','CDBA','CBAD','ABDC','ADBC','BDCA' db 'DCBA','BACD','BADC','BDAC','CBDA','DBCA','DCAB'