Jump to content
IGNORED

Sprpck problems


EmOneGarand

Recommended Posts

So, I've gotten the cc65 program with the lynx libraries, problem is I can't get any obj files created from Sprpck to be converted to olb files by the ar65 app with cc65.. I tried to get Bastian Schick's BLL dev programs but his site just has broken links. Kinda frustrating when I can't create a simple "Hello World" program cause the Lynx has no printf :x

Edited by EmOneGarand
Link to comment
Share on other sites

  • 2 weeks later...

So, I've gotten the cc65 program with the lynx libraries, problem is I can't get any obj files created from Sprpck to be converted to olb files by the ar65 app with cc65.. I tried to get Bastian Schick's BLL dev programs but his site just has broken links. Kinda frustrating when I can't create a simple "Hello World" program cause the Lynx has no printf :x

 

The sprpck is not compatible in that way with cc65. What you need to do is:

 

sprpck -t6 -p2 mysprite.bmp

 

then you need to edit a file calles mysprite.s with this content:

. global mysprite

.segment RODATA

mysprite: .incbin mysprite.spr

 

After this you need to compile it:

ar65 -t lynx -o mysprite.o mysprite.s

 

And finally link it with your main program...

 

I have a rule in my Makefile that does this automatically:

 

# Rule for making a *.o file out of a *.bmp file

%.o : %.bmp

$(SPRPCK) -t6 -p2 $<

$(ECHO) .global _$* > $*.s

$(ECHO) .segment \"$(RODATA_SEGMENT)\" >> $*.s

$(ECHO) _$*: .incbin \"$*.spr\" >> $*.s

$(AS) -t lynx -o $@ $(AFLAGS) $*.s

$(RM) $*.s

$(RM) $*.pal

$(RM) $*.spr

 

--

Karri

Link to comment
Share on other sites

Kinda frustrating when I can't create a simple "Hello World" program cause the Lynx has no printf :x

 

Oh yes it has. You just have to find it.

 

#include <lynx.h>
#include <6502.h>
#include <tgi.h>

extern char minitgi[];

int main()
{
 int x = 10;
 int y = 10;
 tgi_install(&minitgi);

 // Single display buffer
 tgi_setviewpage(0);
 tgi_setdrawpage(0);

 // Set our default palette to the hardware
 tgi_setpalette(tgi_getdefpalette());

 tgi_setcolor(COLOR_WHITE);
 tgi_outtextxy(x, y, "Hello World");
 while (1)
  ;
}

 

But you also need to create a statically linked tgi-driver for this to work.

 

copy C:\Program Files\cc65\tgi\lynx-160-102-16.tgi .

co65 --code-label _minitgi lynx-160-102-16.tgi

cl65 -t lynx --asm-include-dir ../asminc -I ../include -L ../lib myprog.c -o myprog.com lynx-160-102-16.s

 

The paths should be relative to your installation.

 

In case you want a preconfigured environment I have mine at http://kosh.dna.fi/cc65.u3p

 

It is intended to install on a SanDisk U3 USB memory stick. And it requires no installation at the Windows computer. Just insert the USB stick and click on "cc65 on U3". In the opening window type

 

source bashrc

 

After that "cd" to wherever your project is and you can use:

- lyxass

- bll

- cc65

- vi (graphical colour editor)

- sprpck

- make

- unix commands

- cvs

- handy

 

--

Karri

Link to comment
Share on other sites

  • 2 years later...

Hi, I've started playing with sprpck but either I'm doing something wrong or the software is buggy, the palettes it outputs are missing the green value

When converting a windows bmp file with the 4 first index colors 0x000000,0x000050,0x600000,0x500050 the output palette is :

char redir[]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};

char pal[]={

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x05,0x00,0x65,0x5B,0x50,0xB5,0x0B,0x00,0x50,0xB7,0x5E,0x93,0xB0,0xF5,0xFF,0xFB}

;

 

The first line is all zeroes, I get the same with other palette types

redir: dc.b $01,$23,$45,$67,$89,$AB,$CD,$EF

pal: DP 005,000,065,05B,050,0B5,00B,000,050,0B7,05E,093,0B0,0F5,0FF,0FB

 

If I hardcode the palette by hand it displays correctly, I'll try to see what's wrong in the software.

Link to comment
Share on other sites

If I hardcode the palette by hand it displays correctly, I'll try to see what's wrong in the software.

 

If you fix this I would also like to have a copy. It is a very annoying bug.

 

Sometimes I have been thinking about writing a "Lynx packed sprite" format to Gimp that would store the sprite data in a asm file that could be compiled directly.

 

16 bytes palette

Sprite struct

Image data

 

This is the same format that is used for the title sprites.

 

--

Karri

(spending his night on a coach at the airport. First a train crashed somewhere in Sweden keeping my train waiting for 2 extra hours. And now the plane broke and they are waiting for 4 hours to get a replacement.)

But I should not complain as long as I am not involved in these accidents.

Link to comment
Share on other sites

Yep found it, here's a patch to io.c

246c246,247

< pByte = in + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

---

> //pByte = in + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

> pByte = in + 14 + inbmpinfo->bmiHeader.biSize;

283c284,285

< pByte = in + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

---

> // pByte = in + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

> pByte = in + 14 + inbmpinfo->bmiHeader.biSize;

 

seems like the size of the structs are incorrect, if the info stored in the info header is used, it works.

I only tested 16colors bmps 256 should be ok (but anyway the resulting sprite is probably ugly)

Link to comment
Share on other sites

http://sipo.fi/cc65.u3p <<< thanks heaps karri!!! I hope this avoids all the standard problems when trying to configure an environment and lets me jump to coding straight away. btw.. I found the link through a google on the cc65 mailing list since the link on this forum is a dead one for me, and were assuming you're the same person as on there :)

 

*proud owner of a lynx dev kit on his usb keychain*

Edited by Ninjabba
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...