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.

(Download)
What language is it in?
Assembly. It's the only way to get that small. I wrote something similar in Axe that weighed 147 bytes.
I just wrote one that is 60 bytes on the calc (TI-86). It's really only 47 bytes of actual code. Smile
Nice. This one is for the TI-83+ Family, though.
SirCmpwn wrote:
Nice. This one is for the TI-83+ Family, though.

True, and I don't know much about the 83+ series. They might require more code to access the graph screen or to print to the homescreen than the 86, or something.

Anyway, I just made my version smaller: 39 bytes of code, or 52 bytes on the calc. Here's my source if you want to use it in yours:

Code:
; small sprite converter for TI-86
; by Christopher Williams
; 2011-03-26

_plotSScreen equ 0xc9fa
_putc        equ 0x4a2b
_newline     equ 0x4a5f

   .org 0xd748
   ld   hl,_plotSScreen
   ld   de,16   ; height of graph screen in bytes
   ld   b,8
   xor   a
@loop
   rld         ; get the first digit
   call   @digit
   call   @digit
   add   hl,de
   djnz   @loop
   jp   _newline

@digit
   push   af      ; save this digit
   add   a,'0'
   cp   '9'+1
   jr   c,@notaf
   add   a,'A'-'0'-10
@notaf
   call   _putc
   pop   af      ; restore digit
   rld         ; get next digit
   ret


EDIT: inlined the printhex routine. This didn't affect the size at all, but it looks cleaner. I also renamed it from "ssc" to "tssc" (for a more fair size comparison with "WSSC"), so it's now 53 bytes on calc.

Code:
asm(prgmWSSC


I win Razz
qazz42 wrote:

Code:
asm(prgmWSSC


I win Razz
I don't see any credits, looks like plagiarism of SirC's code. Razz
comicIDIOT wrote:
qazz42 wrote:

Code:
asm(prgmWSSC


I win Razz
I don't see any credits, looks like plagiarism of SirC's code. Razz

Plus you need to add 6 bytes or so for "asm(", "prgm", and "WSSC", or more if you put that inside a BASIC program. So yours is at least 66 bytes. Smile
Where is the source code for SirCmpwn's program?
KermMartian wrote:
Where is the source code for SirCmpwn's program?

(Download)
SirCmpwn's code:


Code:
; Worlds Smallest Sprite Converter
; Converts the 8x8 sprite on
; the graph screen to hex

 nolist
 include "ti83plus.inc"
 list
 db 0BBh, 6Dh
 org 9D95h

 ld hl, plotsscreen
 ld b, 8
 ld de, 12
 
Loop:
 ld a, (hl)
 call DispHexA
 add hl, de
 djnz Loop

 ret

DispHexA:
   push af
   rrca
   rrca
   rrca
   rrca
   call dispha
   pop af
   call dispha
   ret
dispha:
   and 15
   cp 10
   jr nc,dhlet
   add a,48
   jr dispdh
dhlet:
   add a,55
dispdh:
   bcall PutC
   ret
   db 0
An optimization:
Code:
   pop af
   call dispha
   ret
dispha:
to
Code:
    pop af
dispha:
Saves four bytes.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement