Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - [Coding competition 2017] Astro Force by eruiz00

Reply to topic Goto page Previous  1, 2, 3

Rate this entry!

1 (Poor) 0% 0%
2 0% 0%
3 0% 0%
4 0% 0%
5 0% 0%
6 4% 4%
7 4% 4%
8 45% 45%
9 (Excellent) 45% 45%
This poll has expired.
Author Message
  • Joined: 29 Mar 2012
  • Posts: 289
  • Location: Spain
Reply with quote
Post Posted: Thu Jun 08, 2017 7:27 am
wow! I didn't know that SDCC was able to optimize that to a single instruction!
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 1807
Reply with quote
Post Posted: Thu Jun 08, 2017 8:11 am
the point is that SDCC understands that shifting right 8 times an unsigned int means to take only the upper byte, and if the variable is global, it has its own fixed address in RAM, which implies that its upper byte is at that same address + 1, which means you can use

ld a,(immediate address)

sometimes the compiler can't use register A (which can be holding another variable...) so it will do something like this:

ld hl,#immediate address
ld b,(hl)

or along this line anyway.
  View user's profile Send private message Visit poster's website
  • Joined: 28 Jan 2017
  • Posts: 157
  • Location: Málaga, Spain
Reply with quote
Post Posted: Thu Jun 08, 2017 5:19 pm
Always is a pleasure to talk about this sort of things :)
  View user's profile Send private message
Reply to topic Goto page Previous  1, 2, 3



Back to the top of this page

Back to SMS Power!