Inspired by Trixter's 13 bytes version.

My 12 bytes version:

init:movax,0e5ch;Load AH with "write char" cmd and AL with '\'
scasb;read from where ES:DI points and compare to AL
;this sets flags similar to a subtraction
pickch:jpwritec;If parity set, jump to writing char in AL
moval,'/';otherwise, choose other character
writec:int10h;write char in AL
jmpinit;loop endlessly

herm1t's 11 bytes version:

init:moval,'\';Load the default character
scasb;read from where ES:DI points and compare to AL
;this sets flags similar to a subtraction
pickch:jpwritec;If parity set, jump to writing char in AL
moval,'/';otherwise, choose other character
writec:int29h;write char in AL
jmpinit;loop endlessly

My 10 bytes version:

init:scasb;read from where ES:DI points and compare to AL
;this sets flags similar to a subtraction
salc;set mask in AL to 00 or FF
andal,'\'-'/';begin choosing character (AL is 00 or 2D)
addal,'/';finish choosing character
writec:int29h;write char in AL
jmpinit;loop endlessly

Copyright (c) 2012-2013 Peter Ferrie
All rights reserved

This site is hosted by 000webhost.com



Free web hostingWeb hosting