Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Assembly and adding a Picture
2009-08-26 19:51
MisterMSK
Account closed

Registered: Jul 2009
Posts: 37
Assembly and adding a Picture

Hi All,

I have some assembly code written for ACME assembler. I was just curious how I would add a picture into the code. I got the pause down but I just need a picture to show. Doesn't matter what format. I assume I can change my picture to most formats specified.

This would be great if someone could let me know.

Thanks,
MisterMSK
2009-08-26 20:49
Mace

Registered: May 2002
Posts: 1799
I'm not familiar with the ACME assembler, but in general adding a picture comes down to inserting/binding a binary file of that picture as an external file into your code.

In 64TASS is would be something like:
*=$2000
.binary "my picture.prg",2
2009-08-26 21:47
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
ACME:

*=address of pic
!bin "filename.prg",, $02
2009-08-27 03:39
TWW

Registered: Jul 2009
Posts: 541
And for actually showing the picture it depends totally wich format you are using.

But a Koala picture f.ex. is stored in video bank from $4000-8000.

It is a good format to get familiar with setting up gfx on the c64.

The bmp is from $6000 to $6e40 and immediately after you will find the char-colours and after that again you will find the $d800 colours.

which means you need to switch video bank ($dd00) and then set the correct video display ($d018) and then you need to copy the char colours into the video display you have selected in $d018. Lastly you need to copy the $d800 colours to....... $d800 :-)))))

alternatively you can transfer the bmp to $2000 - $3e40 and use $0400 and $d800 as normal.

You will find more about setting the video bank and $d018 in the programmers reference manual. And if I am not misstaken you will probably find 1000+ koala display routines on the net :) try a google!
2009-08-27 06:09
Angel of Death

Registered: Apr 2008
Posts: 210
hmmmm...
Why don't you do it the old-fashioned way? Steal the code!
Maybe from this one:
Hello!
(Please Jan. Don't shoot me. I'm just joking. Stealing is wrong!)

:))
2009-08-27 09:44
Mace

Registered: May 2002
Posts: 1799
Quoting TWW

But a Koala picture f.ex. is stored in video bank from $4000-8000.

That's totally untrue in any cross platform assembler, as you can load the binary at any location you wish.

Again, I'm not familiar with ACME, but in 64TASS you're able to even load a certain part of a binary.
This means you could load the bitmap, the chars and the colours at different locations, breaking up the Koala structure of the original binary.

Think outside the box ;-)
2009-08-27 10:43
linde

Registered: Jul 2006
Posts: 47
I put my pictures immediately after the code and move it where it should be using a loop to keep the size down a bit. My bsessive mind can't really stand having a bunch of empty space between the pic and code.

PS. not recommended if you're not using an assembler ;)
2009-08-27 13:37
enthusi

Registered: May 2004
Posts: 675
or do it the other way round - align the code to the gfx.
This way you save quite some memory to be overwritten:

*=$5c00

hirescolmap
.bin 8002,1000,"gfxfun/rooms2.ip64h"
.dsb 24,0
hiresbitmap
.bin 2,8000,"gfxfun/rooms2.ip64h"

code_start
	
init_gfx
	sei
	lda #$06
	sta $d020
	lda #%00000010
	sta $dd00
	lda $d011
	ora #%00111000	;enable hires + screen on
	sta $d011	
	lda #%01111000  
	sta  $d018


PS: ip64h is interpaint HiRes - gimp with cbmplugs is able to export to this format ;-)
PPS: you could also put the code inside the 24 byte gap between bitmap and colormap but well....
2009-08-27 13:50
Mace

Registered: May 2002
Posts: 1799
Quoting linde
My obsessive mind can't really stand having a bunch of empty space between the pic and code.

Funny.
The empty space between the code and the picture probably crunches better than the code to move the picture.
So in the end you're crunched file might be longer ;-)

So, yeah, what enthusi said.
2009-08-27 15:02
Skate

Registered: Jul 2003
Posts: 490
If you are using ACME, check this out. my library (sk8viclib) is exactly what you need.

http://www.akaydin.com/sk8lib/

in examples folder, there is an example called "vic+mem_example". this should help.

p.s: this library is not complete and not updated for a few years. but I'll finish and release it someday.


2009-08-27 19:16
TWW

Registered: Jul 2009
Posts: 541
Quoting tww

But a Koala picture f.ex. is stored in video bank from $4000-8000.

Quoting mace

That's totally untrue in any cross platform assembler, as you can load the binary at any location you wish.

Again, I'm not familiar with ACME, but in 64TASS you're able to even load a certain part of a binary.
This means you could load the bitmap, the chars and the colours at different locations, breaking up the Koala structure of the original binary.

Think outside the box ;-)


Uhm... a "KOALA" picture isn't in the $4000-8000 bank???

My statement stands true, I mentioned nothing about relocating. Any nimbwitt knows that everything can be relocated.

MisterMSK wanted someone to explain to him how to display a picture. You do this by teaching him how the format of the gfx works and how to set up $dd00/d018/d016/d011. then you can start relocating and customize as you wish after you get that part!

think standard format & learning ;-)
 
... 21 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Deev/Onslaught
Andy/AEG
andym00
A3/AFL
Airwolf/F4CG
Apollyon/ALD
Moloch/TRIAD
Acidchild/Padua
Krill/Plush
csabanw
Guests online: 157
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Graphicians
1 Sulevi  (10)
2 Mirage  (9.8)
3 Lobo  (9.7)
4 Mikael  (9.7)
5 Archmage  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.061 sec.