Retro: The “snail-line” challenge

While OTW Vortex/12 is under way, another highschool retro I’ve found. The original challenge was to draw out a 200×200 spiral as you can see it on the picture. In hungarian spiral is csigavonal, where csiga means snail and vonal means line. It was necessary, to do it in 320×200 video mode, and wait for a keypress before switching back to textmode and exit. Smaller bytecode wins!

Snail in asm

I’ve tried different approaches, the best I could reach was the following, with 52 bytes:

Progx 	Segment 
	Assume Cs:Progx,Ds:Progx
	Org 100h


	Mov Ax,13h
	Int 10h
	Mov Ax,0A000h
	Mov Es,Ax
	Shr Ax,08
	Xor Di,Di

	Mov Dx,201
	Mov Cx,Dx
	Dec Di
	Rep Stosb
	Dec Dx
	Dec Dx
	Mov Cx,Dx
	Mov Bx,320
	Call Vert
	Dec Di
	Mov Cx,Dx
	Inc Di
	Rep Stosb
	Dec Dx
	Dec Dx

	Mov Cx,Dx
	Mov Bx,-320
	Call Vert
	Inc Di

	Cmp Dx,3
	Jl  Exit

	Jmp Csiga
	Xor Ax,Ax
	Int 16h
	Mov Ax,03h
	Int 10h

Vert	Proc Near
Vert_1:	Mov Es:[Di],Al
	Add Di,Bx	
	Loop Vert_1
Vert	Endp
Progx 	EndS
	End Start

I’m sure it can be done using fewer bytes!

This entry was posted in Retro and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s