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: 36
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
 
... 21 posts hidden. Click here to view all posts....
 
2009-08-27 13:37
enthusi

Registered: May 2004
Posts: 674
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 ;-)
2009-08-27 22:10
Skate

Registered: Jul 2003
Posts: 490
@TWW: My library is a middle way solution. He can put his graphic datas to anywhere allowed in the memory without understanding how dd00/d018/d016/d011 works. Of course this is only good for the first step.
2009-08-28 06:50
Mace

Registered: May 2002
Posts: 1799
Quoting TWW
MisterMSK wanted someone to explain to him how to display a picture.

Well, actually he wanted to know how to add a picture into the code.
This can either be explained as how to attach a picture's binary file into the assembly code in order to have it added to the final PRG after compiling *OR* as how to write a routine to display the picture.

I was answering the first, you are answering the second.

However, you're answer suggests that if you'd want to display a Koala picture, you have to assume it's in $4000-$7fff, which IMHO is not true if you're working cross platform. The file simply doesn't have a location, as you always have to set it in your code when attaching the binary.

You are right, that if you'd load the picture on a real machine ",8,1" you'd have it starting at $6000.
You also suggest transfering it, but this implicates that you'd have to physically move it in the memory after loading.
Both are not necessary if you add the picture in your assembly code the way I suggest.

Perhaps MisterMSK should respond to our suggestions, so we can see where we're going... ;-)
2009-08-28 15:03
MisterMSK
Account closed

Registered: Jul 2009
Posts: 36
Quote: Quoting TWW
MisterMSK wanted someone to explain to him how to display a picture.

Well, actually he wanted to know how to add a picture into the code.
This can either be explained as how to attach a picture's binary file into the assembly code in order to have it added to the final PRG after compiling *OR* as how to write a routine to display the picture.

I was answering the first, you are answering the second.

However, you're answer suggests that if you'd want to display a Koala picture, you have to assume it's in $4000-$7fff, which IMHO is not true if you're working cross platform. The file simply doesn't have a location, as you always have to set it in your code when attaching the binary.

You are right, that if you'd load the picture on a real machine ",8,1" you'd have it starting at $6000.
You also suggest transfering it, but this implicates that you'd have to physically move it in the memory after loading.
Both are not necessary if you add the picture in your assembly code the way I suggest.

Perhaps MisterMSK should respond to our suggestions, so we can see where we're going... ;-)


Sure. I modified FMGPUCCRBRR to just start a program when it loads. This way I can easly start a PRG from my MMC Replay (Just comment out like 64-67 and it will auto start the program. Make every color 0 so you don't see any text displayed.) Anyway, I am auto-starting sd2brwse, which allows me to browse my uIEC card with my joystick. I found, thou, it starts up to fast for the uIEC. So I wanted to create a 3 to 4 second pause. Then I relized I need more like a 6 to 8 second pause so I know it starts up every time. This is when I'd desided it needed a picture in there. It would be nice to put it in the FMGPUCCRBRR program so if I wanted to switch, let say, to DraBrowse I could. This site contains a program to transfer JPEG to Koala. So with that being easy to do, I would like to try to stick a Koala pick in there and pause for 6 to 8 seconds.

I hope this helps.
2009-08-29 01:10
TWW

Registered: Jul 2009
Posts: 541
So what is your question?

How to include the koala file in your code and/or displaying it on the screen :)

I believe Jan Harries already wrote how to include binaries into ACME:

ACME:

*=address of pic
!bin "filename.prg",, $02

I haven't used this assembler meself but this should normaly not be a problem to figgure out through the assemblers documentation. Even to do a 'selective' loading of the binary file so the such as mace sais to let the assembler relocate it for you (If you for some reason want to do that).

For displaying the code you need to set up the character screen and graphics bank with $dd00/$d018. Then you need to load up the 2 char-multicolor colours onto the character screen you have chosen by setting $d018. $d016 sets single/multicolor mode and $d011 sets hires mode. and ultimately you need to load the last multicolor colors onto $d800.

as said b4 there are a million sources and stuff for this (but if youre to laze to figgure it out I am sure I could post an example for you).

For pausing for some seconds there are a variety of ways to do this. but think that a screen update is 50 times a econd (PAL) (60 in NTSC) so if you count the amount of screen scans you can easilly 'pause'.

ldy #seconds
ldx #$50/60 //PAL/NTSC
cpx $d012
bne *-3
dex
bne *-6
dey
bne *-11


or something like that (not tested but should work if your not depending on $d012 for other stuff).
2009-11-02 16:52
MisterMSK
Account closed

Registered: Jul 2009
Posts: 36
Quote: So what is your question?

How to include the koala file in your code and/or displaying it on the screen :)

I believe Jan Harries already wrote how to include binaries into ACME:

ACME:

*=address of pic
!bin "filename.prg",, $02

I haven't used this assembler meself but this should normaly not be a problem to figgure out through the assemblers documentation. Even to do a 'selective' loading of the binary file so the such as mace sais to let the assembler relocate it for you (If you for some reason want to do that).

For displaying the code you need to set up the character screen and graphics bank with $dd00/$d018. Then you need to load up the 2 char-multicolor colours onto the character screen you have chosen by setting $d018. $d016 sets single/multicolor mode and $d011 sets hires mode. and ultimately you need to load the last multicolor colors onto $d800.

as said b4 there are a million sources and stuff for this (but if youre to laze to figgure it out I am sure I could post an example for you).

For pausing for some seconds there are a variety of ways to do this. but think that a screen update is 50 times a econd (PAL) (60 in NTSC) so if you count the amount of screen scans you can easilly 'pause'.

ldy #seconds
ldx #$50/60 //PAL/NTSC
cpx $d012
bne *-3
dex
bne *-6
dey
bne *-11


or something like that (not tested but should work if your not depending on $d012 for other stuff).


TWW,

Thanks so much for the information. Got the pausing down. However, still have been trying to figure out the displaying a picture. When looking at different examples, never could get one to display. If you could post an example as you said, I would be greatful.

Thanks,
MisterMSK
2009-11-02 20:01
Perplex

Registered: Feb 2009
Posts: 254
Quote: So what is your question?

How to include the koala file in your code and/or displaying it on the screen :)

I believe Jan Harries already wrote how to include binaries into ACME:

ACME:

*=address of pic
!bin "filename.prg",, $02

I haven't used this assembler meself but this should normaly not be a problem to figgure out through the assemblers documentation. Even to do a 'selective' loading of the binary file so the such as mace sais to let the assembler relocate it for you (If you for some reason want to do that).

For displaying the code you need to set up the character screen and graphics bank with $dd00/$d018. Then you need to load up the 2 char-multicolor colours onto the character screen you have chosen by setting $d018. $d016 sets single/multicolor mode and $d011 sets hires mode. and ultimately you need to load the last multicolor colors onto $d800.

as said b4 there are a million sources and stuff for this (but if youre to laze to figgure it out I am sure I could post an example for you).

For pausing for some seconds there are a variety of ways to do this. but think that a screen update is 50 times a econd (PAL) (60 in NTSC) so if you count the amount of screen scans you can easilly 'pause'.

ldy #seconds
ldx #$50/60 //PAL/NTSC
cpx $d012
bne *-3
dex
bne *-6
dey
bne *-11


or something like that (not tested but should work if your not depending on $d012 for other stuff).


That code won't pause as long as you'd like as it stands.
The reason is that when x becomes below a certain value,
the raster line comparison will be true several times per
frame ($d012 wraps around from $ff to $00 just a few lines
into the lower border).

Easily fixed though:

lda #$fb    // Lower border starts here
ldy #seconds
ldx #$50/60 //PAL/NTSC
cmp $d012
bne *-3
cmp $d012
beq *-3
dex
bne *-11
dey
bne *-16


Sorry about the nitpick. :)
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
zscs
hedning/G★P
Juzdie/Artline Designs
duce/extend
t0m3000/ibex-crew
sln.pixelrat
Brittle/Dentifrice^(?)
d0c
WVL/Xenon
Didi/Laxity
Guests online: 321
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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