Something small

Moderator: MaxCoderz Staff

Post Reply
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Something small

Post by driesguldolf »

Attempt to bring some life into this place.

I guess you all know the code, but it has a bug. Find it!
Also present the solution (smallest size)

Code: Select all

getpixel:
	ld h, 0
	ld d, h
	ld e, l
	add hl, hl
	add hl, de
	add hl, hl
	add hl, hl
	ld de, gbuf
	add hl, de
	ld e, a
	srl e
	srl e
	srl e
	add hl, de
	and 7
	ld b, a
	ld a, %10000000
	ret z
-
	rrca
	djnz -
	ret
Have fun! (I certainly didn't...)
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Re: Something small

Post by CoBB »

You forgot to zero d when adding the horizontal byte offset. A fix that doesn’t cost a single byte would be simply to move the addition of gbuf to the end of the address calculation.
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Post by driesguldolf »

:drifter:
Congrats, oh well, it certainly was a short 'contest' :P
It took me 2 hours to find out... >_>
Post Reply