| |
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.... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
soci, thats a neat idea, tho I cant think of a scenario where it would be useful :) maybe some demo effect with lots of prepped csets. |
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
Soci , hehe i don't like to kill a fly with RPG but
what do you mean
by:
$0000 | bits(bitmap) where is the bits function? or i miss something.
and later:
and #~(screen[14:16] || []) hehe for not a C coders
could you make a friendly explain ? (you can do it on
private if you prefer) |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
I think Soci is talking about 64tass:
http://tass64.sourceforge.net/ |
| |
Dr.j
Registered: Feb 2003 Posts: 277 |
oh Flavioweb ok. i am kickass person so i leave it aside
for now hehe |
| |
soci
Registered: Sep 2003 Posts: 480 |
Too much late coding yesterday ;) It would go even more off topic if I'd go into details in this thread.
The code fragment was only a demonstration about constructing $d018 values without using divisions and shifts.
Normally I use some variant of this:
lda #((font >> 10) & $0f) | ((screen >> 6) & $f0)
sta $d018
lda $dd00
ora #3
eor #font >> 14
sta $dd00 Even if this version is wasting 2 bytes half the time for the $dd00 calculation. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
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 :) |
| |
soci
Registered: Sep 2003 Posts: 480 |
Not sure why. I just checked and even my one filers are mostly doing the masking, where there's no chance of loader interference.
It must be tradition then.
So I now declare trademark rights on the ora/eor version. It may only identify genuine Singular productions ;) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
i see this often, also with eg $01 or $d011 .... people must have learned it somewhere :) |
| |
The Phantom
Registered: Jan 2004 Posts: 360 |
Why not give an example of code? Unabridged CODE. No documentation per line of code, just CODE.
Screen Ram - $7f40-$8327 ?
Color Ram - $8338 (or is it $8328)-$8711?
My code, and it doesn't display proper at all.. Like missing lines...
Lda $dd02
and #$03
sta $dd02
lda $dd00
and #$fc
ora #$02
sta $dd00
And of course I follow with:
lda #$18
ldx #$f8
ldy #$3b
sta $d018
stx $d016
sty $d011
Not known if my image will show...
<a href="http://s48.photobucket.com/user/festeezio/media/koala_zpsxtctbx.." target="_blank"><img src="http://i48.photobucket.com/albums/f245/festeezio/koala_zpsxtctb.." border="0" alt=" photo koala_zpsxtctbxw4.png"/></a>
If it doesn't, here's a direct link..
http://i48.photobucket.com/albums/f245/festeezio/koala_zpsxtctb..
Any suggestions as to what I'm doing wrong?
Image is at $6000. The 2 RAMS mentioned are being read and plotted to the screen/color area. |
| |
soci
Registered: Sep 2003 Posts: 480 |
*= $6000
>6000 pic .binary "a.kla",2
*= $0801
>0801 0b 08 df 07 .word +, 2015
>0805 9e 32 30 36 31 00 .null $9e, ^start
>080b 00 00 + .word 0
.080d a2 00 ldx #$00 start ldx #0
.080f a0 04 ldy #$04 ldy #4
.0811 bd 40 7f lda $7f40,x lp lda pic+8000,x
.0814 9d 00 44 sta $4400,x sta $4400,x
.0817 bd 28 83 lda $8328,x lda pic+9000,x
.081a 9d 00 d8 sta $d800,x sta $d800,x
.081d e8 inx inx
.081e d0 f1 bne $0811 bne lp
.0820 ee 13 08 inc $0813 inc lp+2+range(4)*3
.0823 ee 16 08 inc $0816
.0826 ee 19 08 inc $0819
.0829 ee 1c 08 inc $081c
.082c 88 dey dey
.082d d0 e2 bne $0811 bne lp
.082f 8c 20 d0 sty $d020 sty $d020
.0832 ad 10 87 lda $8710 lda pic+10000
.0835 8d 21 d0 sta $d021 sta $d021
.0838 ad 00 dd lda $dd00 lda $dd00
.083b 29 fc and #$fc and #$fc
.083d 09 02 ora #$02 ora #$02
.083f 8d 00 dd sta $dd00 sta $dd00
.0842 a9 18 lda #$18 lda #$18
.0844 a2 f8 ldx #$f8 ldx #$f8
.0846 a0 3b ldy #$3b ldy #$3b
.0848 8d 18 d0 sta $d018 sta $d018
.084b 8e 16 d0 stx $d016 stx $d016
.084e 8c 11 d0 sty $d011 sty $d011
.0851 4c 51 08 jmp $0851 jmp *
|
Previous - 1 | 2 | 3 | 4 | 5 - Next |