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


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

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 15:37
enthusi

Registered: May 2004
Posts: 636
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 15:50
Mace

Registered: May 2002
Posts: 1768
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 17:02
Skate

Registered: Jul 2003
Posts: 469
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 21:16
TWW

Registered: Jul 2009
Posts: 409
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-28 00:10
Skate

Registered: Jul 2003
Posts: 469
@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 08:50
Mace

Registered: May 2002
Posts: 1768
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 17:03
MisterMSK

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 03:10
TWW

Registered: Jul 2009
Posts: 409
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 17:52
MisterMSK

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 21:01
Perplex

Registered: Feb 2009
Posts: 197
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
Squad333
Vent/TRIAD
phreedh
Acidchild/Padua
skull
Guests online: 42
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 The Shores of Reflec..  (9.6)
5 Lunatico  (9.6)
6 Comaland 100%  (9.5)
7 Incoherent Nightmare  (9.5)
8 Wonderland XII  (9.5)
9 Comaland  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 Pandemoniac Part 2 o..  (9.6)
2 FMX Music Demo  (9.6)
3 Daah, Those Acid Pil..  (9.5)
4 Dawnfall V1.1  (9.5)
5 Synthesis  (9.5)
6 Dawnfall  (9.4)
7 Treu Love [reu]  (9.4)
8 Field Sort  (9.4)
9 KAOS 64  (9.3)
10 One-Der  (9.2)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.3)
4 Crest  (9.3)
5 The Judges  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Mitch  (9.8)
3 Mr Zero Page  (9.8)
4 Snacky  (9.8)
5 MWS  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2017
Page generated in: 0.237 sec.