Author Topic: World's Smallest Sprite Converter  (Read 6457 times)

0 Members and 2 Guests are viewing this topic.

SirCmpwn

  • Guest
World's Smallest Sprite Converter
« on: March 26, 2011, 02:30:22 pm »
Hello,
I whipped up this ridiculously small sprite converter program this morning, for those of you feeling the crunch of less memory.  It will convert the 8x8 sprite in the top left corner of the screen to hex for you, weighing only 60 bytes!  I challenge - no, I *dare* you to make a smaller sprite converter.

Note: This was inspired by re-reading this post: http://ourl.ca/8639/161291
« Last Edit: March 26, 2011, 02:39:27 pm by SirCmpwn »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #1 on: March 26, 2011, 02:40:21 pm »
Hello,
I whipped up this ridiculously small sprite converter program this morning, for those of you feeling the crunch of less memory.  It will convert the 8x8 sprite in the top left corner of the screen to hex for you, weighing only 60 bytes!  I challenge - no, I *dare* you to make a smaller sprite converter.

Note: This was inspired by re-reading this post: http://ourl.ca/8639/161291

That looks sweet, but you don't even ClrDraw =P I know it's for the speed and size :P

SirCmpwn

  • Guest
Re: World's Smallest Sprite Converter
« Reply #2 on: March 26, 2011, 02:41:26 pm »
That looks sweet, but you don't even ClrDraw =P I know it's for the speed and size :P
I don't do anything that would take up any size.  I don't even turn off the run indicator.  This is in pure assembly, I'm just displaying the raw bytes from the graph screen.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #3 on: March 26, 2011, 02:46:09 pm »
That looks sweet, but you don't even ClrDraw =P I know it's for the speed and size :P
I don't do anything that would take up any size.  I don't even turn off the run indicator.  This is in pure assembly, I'm just displaying the raw bytes from the graph screen.

Will you post the code, though?

SirCmpwn

  • Guest
Re: World's Smallest Sprite Converter
« Reply #4 on: March 26, 2011, 02:47:01 pm »

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: World's Smallest Sprite Converter
« Reply #5 on: March 26, 2011, 02:58:49 pm »
Wow's that amazingly small :O I still prefer a more GUI-based editor though, like your other converter.
Is this supposed to be a proof-of concept thing?
In-progress: Graviter (...)

SirCmpwn

  • Guest
Re: World's Smallest Sprite Converter
« Reply #6 on: March 26, 2011, 03:01:25 pm »
Wow's that amazingly small :O I still prefer a more GUI-based editor though, like your other converter.
Is this supposed to be a proof-of concept thing?

Note: This was inspired by re-reading this post: http://ourl.ca/8639/161291

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: World's Smallest Sprite Converter
« Reply #7 on: March 26, 2011, 04:12:14 pm »
Nice, I guess it's good to see these tools as small as possible, especially if you have many small programs.

I'M starting to wonder if we will need a project/releases sub-forum just for sprite editors, converters and map editors now, though. O.O (no offense)
« Last Edit: March 26, 2011, 04:13:07 pm by DJ_O »

Offline christop

  • LV3 Member (Next: 100)
  • ***
  • Posts: 87
  • Rating: +20/-0
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #8 on: March 26, 2011, 04:20:00 pm »
I took SirCmpwn's challenge/dare. Here's my own tiny sprite converter for the TI-86. It's 39 bytes of code/53 bytes on calc. It might be one byte larger if you port it to the 83+ because you can't jump straight to a bcall (or can you?).

EDIT: Derp, I finally saw the mistake in one of the comments. Where it says "height" in "height of graph screen in bytes", it should say "width". Oh well. :D
« Last Edit: March 26, 2011, 04:21:48 pm by christop »
Christopher Williams

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: World's Smallest Sprite Converter
« Reply #9 on: March 26, 2011, 04:22:59 pm »
Snap CmPwn your bluff just got called :O
In-progress: Graviter (...)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: World's Smallest Sprite Converter
« Reply #10 on: March 26, 2011, 04:23:18 pm »
Nice. I wonder if there are any sprite routines for BASIC programmers on the 86 and if the Asm() command is as slow to launch as the one on the 83+ (due to VAT)? I never got to see an hybrid BASIC game for the 86 before and it would be nice to port some 83+ games using them. (although since 86 BASIC is slower than the 82/83/84/85 it might pose a problem).

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #11 on: March 26, 2011, 10:13:37 pm »
Well, at first I thought the challenge was to store the sprite in a string in Ans (so you can recall it into an Axe program.)  Then I looked at SirCmpwn's version and realized the challenge was just to display the string on screen. :)

My first version (store the string in Ans) is 39 bytes of code:
Code: [Select]
        ld hl,16
B_CALL CreateTStrng
inc de
ld hl,plotSScreen
loop1: ld b,2
loop: xor a
rld
daa
add a,-16
adc a,40h
inc de
ld (de),a
djnz loop
ld a,l
add a,12
ld l,a
cp 95h
jr c,loop1
B_CALL OP4ToOP1
B_CALL StoAns
ret
(I feel like this could be optimized a little more.)

My second version (display the string on screen) is 26 bytes of code:
Code: [Select]
ld hl,plotSScreen
loop1: ld b,2
loop: xor a
rld
daa
add a,-16
adc a,40h
B_CALL PutC
djnz loop
ld a,l
cp h
ret nc
add a,12
ld l,a
jr loop1

SirCmpwn

  • Guest
Re: World's Smallest Sprite Converter
« Reply #12 on: March 26, 2011, 10:21:35 pm »
Daaaaaaaaamn

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #13 on: March 26, 2011, 10:23:30 pm »
In 83/84 basic, I got it down to 99 bytes with a one letter program name.  Wabbit crashed upon export, so I have no proof of it, but I doubt if it can get any smaller.

Edit: If I just have to display it, I can make it smaller (if anyone cares). :P
« Last Edit: March 26, 2011, 10:24:32 pm by ztrumpet »

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: World's Smallest Sprite Converter
« Reply #14 on: March 26, 2011, 10:26:07 pm »
okay, that's why Drew doesn't start with a B.  Nicely nicely done FloppusMaximus.