MaxCoderz

for your 1 bit pleasure!

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Something small
PostPosted: Sun 17 Feb, 2008 2:56 pm 
Offline
Extreme Poster
User avatar

Joined: Thu 17 May, 2007 4:49 pm
Posts: 395
Location: $4080
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:
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...)


Top
 Profile  
Reply with quote  
 Post subject: Re: Something small
PostPosted: Sun 17 Feb, 2008 3:43 pm 
Offline
MCF Legend

Joined: Mon 20 Dec, 2004 8:45 am
Posts: 1601
Location: Budapest, Absurdistan
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.

_________________
The Independent Z80 Assembly Guide
Acelgoyobis
PindurTI


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 18 Feb, 2008 9:45 pm 
Offline
Extreme Poster
User avatar

Joined: Thu 17 May, 2007 4:49 pm
Posts: 395
Location: $4080
:drifter:
Congrats, oh well, it certainly was a short 'contest' :P
It took me 2 hours to find out... >_>


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB ® Forum Software © phpBB Group | DVGFX2 by: Matt