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 > Show Koala Pic
2014-11-09 19:57
Ejner

Registered: Oct 2012
Posts: 43
Show Koala Pic

I'm sure noone here has any problems with showing a simple Koala picture, but I came across this piece of code on codebase64.org and wondered why this had to be done so complicated...?

http://codebase64.org/doku.php?id=base:calculate_vic_settings_f..

In TurboAssembler it's pretty simple to calculate the VIC settings, see my example below. Isn't something similar possible with KickAssembler? Just wondering...

Example in TurboAssembler:

;---------------------------------------
;        Show Koala
;---------------------------------------
koala    = $6000
screen   = $5c00
;---------------------------------------
bank     = koala/$4000

         *= $1000

         lda #$3b
         sta $d011
         lda #koala-($4000*bank)/1024
         ora #(screen-($4000*bank))/64
         sta $d018
         lda #$d8
         sta $d016
         lda $dd02
         ora #%00000011
         sta $dd02
         lda $dd00
         and #%11111100
         ora #3-bank
         sta $dd00

         ldx #0
copy     lda koala+$1f40,x
         sta screen,x
         lda koala+$2040,x
         sta screen+$0100,x
         lda koala+$2140,x
         sta screen+$0200,x
         lda koala+$2228,x
         sta screen+$02e8,x
         lda koala+$2328,x
         sta $d800,x
         lda koala+$2428,x
         sta $d900,x
         lda koala+$2528,x
         sta $da00,x
         lda koala+$2610,x
         sta $dae8,x
         inx
         bne copy
         lda koala+$2710
         sta $d021
         lsr a
         lsr a
         lsr a
         lsr a
         sta $d020

         lda #0
         cmp $0277     ;wait for key
         bne *-3

         lda $dd02
         ora #%00000011
         sta $dd02
         lda $dd00
         and #%11111100
         ora #%00000011
         sta $dd00
         lda #$1b
         sta $d011
         lda #$15
         sta $d018
         lda #$c8
         sta $d016

         jmp $9000
;---------------------------------------

Note: The result of "bank = koala/$4000" is an integer.
 
... 32 posts hidden. Click here to view all posts....
 
2015-08-31 17:26
The Phantom

Registered: Jan 2004
Posts: 360
AHHH!!


Now I see... I'm putting data at $0400, instead of $4400, which became my new screen (as opposed to $0400).

Thanks Soci :D
2015-08-31 17:28
The Phantom

Registered: Jan 2004
Posts: 360
That was my problem.. I had the bank switch correct, but had my STA at $0400. I just changed my values and son of a bitch if it's not displayed proper....

Thanks Soci :D Now I can get this out today....
2015-08-31 21:00
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: why not just store a fixed value to $dd00 though? i dare to say that "properly" ORing the value is very rarely needed - certainly almost never in the usual setup code at the start of your intro/demo/whatever :)

Did "proper" masking for long myself. Such stupidity. My usual setup code is now usually something along:
ldx #$2e
:
   lda vic,x
   sta $d000,x
   dex
bpl :-

vic: .byte register.setup.here...
2015-09-01 12:39
Frantic

Registered: Mar 2003
Posts: 1648
Well I also used to do the masking thing for quite a while. :D
2015-09-06 20:20
Monte Carlos

Registered: Jun 2004
Posts: 359
copy0400: sta src
stx src+1
tsx
lda $0104,x
sta dest
lda $0103,x
sta dest+1

ldx #0
ldy #4
cop:
src = *+1
lda $ffff,x
dest = *+1
sta $ffff,x
inx
bne cop
inc src+2
inc dest+2
dey
bne cop
rts

call with:
lda #<scrn
pha
lda #>scrn
pha
lda #<koala+$1f40
ldx #>koala+$1f40
jsr cop
pla
pla

lda #<$d800
pha
lda #>$d800
pha
lda #<koala+$1f40
ldx #>koala+$1f40
jsr cop
pla
pla
rts


screen and colorram has zero lowbyte, so you may hardcode this in cop routine. but if you want it flexible...
$0100 is the stack beginning. as return address is pushed, you need tsx: lda $0103,x...
2015-09-07 02:10
soci

Registered: Sep 2003
Posts: 480
I see demand for a separate thread for posting clever routines...
2015-09-07 05:35
Oswald

Registered: Apr 2002
Posts: 5094
thats overcomplicated, how about:

copy0400:

ldx #0
ldy #4
cop:
src = *+1
lda $ffff,x
dest = *+1
sta $ffff,x
inx
bne cop
inc src+2
inc dest+2
dey
bne cop
rts

call with:

lda #<scrn
sta dest
lda #>scrn
sta dest+1

lda #<koala+$1f40
sta src
lda #>koala+$1f40
sta src+1

jsr copy


lda #<$d800
sta dest
lda #>$d800
sta dest+1

lda #<koala+$1f40
sta src
lda #>koala+$1f40
sta src+1

jsr copy
rts
2015-09-19 04:49
Ejner

Registered: Oct 2012
Posts: 43
Or no flexibility, just copy what needs to be copied without messing up sprite pointers :-)

         ldx #0
copy     lda koala+$1f40,x
         sta screen,x
         lda koala+$2040,x
         sta screen+$0100,x
         lda koala+$2140,x
         sta screen+$0200,x
         lda koala+$2228,x
         sta screen+$02e8,x
         lda koala+$2328,x
         sta $d800,x
         lda koala+$2428,x
         sta $d900,x
         lda koala+$2528,x
         sta $da00,x
         lda koala+$2610,x
         sta $dae8,x
         inx
         bne copy
2015-09-21 17:36
SIDWAVE
Account closed

Registered: Apr 2002
Posts:
what is this thread ?
we learned to do this in 1985..

thread started by ejner, who dont know me at all, but downvotes my productions. why ejner ?

so now i shitted in your shitty thread...
how to set up a koala pic ?

congrats on showing your codeskills..
how about making some releases and stop downvoting mine ?
2015-09-21 18:50
Bitbreaker

Registered: Oct 2002
Posts: 508
Ah, Rambones is spreading again love and friendship in the scene.
Previous - 1 | 2 | 3 | 4 | 5 - 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
csabanw
Twoflower/ΤRIΛD
Jangler/Artline Desi..
Chrx/Design/Chaos
Brataccas/HF
Genius/Xenon
Guests online: 113
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Pal  (9.6)
4 Carrion  (9.6)
5 Sulevi  (9.6)

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