| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler Thread 2
The previous thread took a little long to load, so this is a new fresh one.. |
|
... 592 posts hidden. Click here to view all posts.... |
| |
Mace
Registered: May 2002 Posts: 1799 |
@ Conjuror: yes, check pages 18 and 34 of the manual.
Also, you could place your label inside the scope better, so that it points to the address itself instead of having to do calculations outside the scope. |
| |
Conjuror
Registered: Aug 2004 Posts: 168 |
Thanks Mace, thats just embarrassing. I was very tired today. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
As Mace said, it is supported. Another example of 'auto namespacing' is when you put a label before a macro execution. This will enable you to access the labels inside the macro which is quite useful. |
| |
Mace
Registered: May 2002 Posts: 1799 |
Quote:Another example of 'auto namespacing' is when you put a label before a macro execution. Blimey, I needed that! Thanks :-) |
| |
TWW
Registered: Jul 2009 Posts: 542 |
Alright, here is a question;
I have a .BMP logo which takes more then 2K (Larger then a char bank). The gfx only uses 3 collors + background.
Traditionally I would do the conversion from koala to char-screen in my own C64 native converter.
What I do on is to take 4x8 Multicollor Pixels and compare they 1 by 1 as I go along and "reuse" any duplicate "char-blocks" to conserve memory and allow fullscreen char-gfx using only 1 char-bank. At the same time the routine also produces the character-set map which is needed to display the gfx.
I reckon a simmular aproach is needed for this in Kickasseblers aswell and hope someone can point me in the right direction on how to aproach this?
I am thinking LoadPicture function with some PC-memory buffer used to sort out the data before filling the c-64 memory...
|
| |
tlr
Registered: Sep 2003 Posts: 1739 |
@tww: I'd use a hash table indexed by the char contents somehow. If 64-bit variables are allowed use that, otherwise just create the index by concatenating toHexString(<byte>) of all the char bytes. Make the hash entry contain a number indicating which char value it corresponds to.
When you match a char in the hash, just pick that number as char value. Keep the char mem in a list. When all is done, output the contents of the hash and the char mem using .fill or similar.
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
It is possible to do big conversions in Kick Assembler (See Cruzer pictureconverter on codebase64) and tlr got a point in using strings and hashtables for fast char-matching - The search process might be time critical since it is a script language.
If you are in the right mood for coding then go for the Tlr approach, if you want an easier way you can start by searching CSDb to see if someone else have done an 'other platform tool' for charpacking which can save you some time.
Tlr : all numeric values are treated as doubles and I guess you want to use a 64-bit integer.
|
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
I actually made an equal char packer using a hash table recently. It packs a 320x200 hires pic, but it should be easy to change it to multicolor and extend the size...
.macro equalCharPack(filename, screenAdr, charsetAdr) {
.var charMap = Hashtable()
.var charNo = 0
.var screenData = List()
.var charsetData = List()
.var pic = LoadPicture(filename)
.for (var charY=0; charY<25; charY++) {
.for (var charX=0; charX<40; charX++) {
.var currentCharBytes = List()
.var key = ""
.for (var i=0; i<8; i++) {
.var byteVal = pic.getSinglecolorByte(charX, charY*8 + i)
.eval key = key + toHexString(byteVal) + ","
.eval currentCharBytes.add(byteVal)
}
.var currentChar = charMap.get(key)
.if (currentChar == null) {
.eval currentChar = charNo
.eval charMap.put(key, charNo)
.eval charNo++
.for (var i=0; i<8; i++) {
.eval charsetData.add(currentCharBytes.get(i))
}
}
.eval screenData.add(currentChar)
}
}
.pc = screenAdr "screen"
.fill screenData.size(), screenData.get(i)
.pc = charsetAdr "charset"
.fill charsetData.size(), charsetData.get(i)
}
:equalCharPack("pic.png", $2800, $2000)
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Nice one.. Btw. There is an error directive so you can fail if the number of chars exceeds 256. |
| |
TWW
Registered: Jul 2009 Posts: 542 |
Awesome!
A small patch to fix the size issue:
// Graphics should fit in 8x8 Single collor / 4 x 8 Multi collor blocks
.var PictureSizeX = pic.width/8
.var PictureSizeY = pic.height/8
.for (var charY=0; charY<PictureSizeY; charY++) {
.for (var charX=0; charX<PictureSizeX; charX++) {
And perhaps letting the gfx-mode (SC/MC) being passed as a argument to the Macro and we've got ourselves a fricking hot converter here.
Perhaps the RGB collors can be passed as an argument aswell so one can keep track of which collor goes to which bit-combination... Goddam! |
Previous - 1 | ... | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ... | 61 - Next |