02 May 2018, 00:23 | #1 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
display a picture with custom size?
I'm trying to learn how to display a picture with asm, however I'm stucked with picture with different size (no 320*256) or <> 3 bitplanes.
This is the code for 3 bitplanes: Code:
incdir "dh1:/own/images/" SECTION CiriCop,CODE START: move.l 4.w,a6 jsr -$78(a6) lea GfxName(PC),a1 jsr -$198(a6) move.l d0,GfxBase move.l d0,a6 move.l $26(a6),OldCop MOVE.L #PIC,d0 LEA BPLPOINTERS,A1 MOVEQ #3-1,D1 ; bitplanes count - 1 POINTBP: move.w d0,6(a1) swap d0 move.w d0,2(a1) swap d0 add.l #40*256,d0 ; pic size addq.w #8,a1 dbra d1,POINTBP move.l #COPPERLIST,$dff080 move.w d0,$dff088 move.w #0,$dff1fc move.w #$c00,$dff106 mouse: btst #6,$bfe001 bne.s mouse move.l OldCop(PC),$dff080 move.w d0,$dff088 move.l 4.w,a6 jsr -$7e(a6) move.l gfxbase(PC),a1 jsr -$19e(a6) rts GfxName: dc.b "graphics.library",0,0 GfxBase: dc.l 0 OldCop: dc.l 0 SECTION GRAPHIC,DATA_C COPPERLIST: dc.w $120,$0000,$122,$0000,$124,$0000,$126,$0000,$128,$0000 ; clear sprite pointers dc.w $12a,$0000,$12c,$0000,$12e,$0000,$130,$0000,$132,$0000 ; clear sprite pointers dc.w $134,$0000,$136,$0000,$138,$0000,$13a,$0000,$13c,$0000 ; clear sprite pointers dc.w $13e,$0000 dc.w $8e,$2c81 ; DiwStrt (registri con valori normali) dc.w $90,$2cc1 ; DiwStop dc.w $92,$0038 ; DdfStart dc.w $94,$00d0 ; DdfStop dc.w $102,0 ; BplCon1 dc.w $104,0 ; BplCon2 dc.w $108,0 ; Bpl1Mod dc.w $10a,0 ; Bpl2Mod ; 5432109876543210 dc.w $100,%0011001000000000 BPLPOINTERS: dc.w $e0,$0000,$e2,$0000 ; BPL0PT dc.w $e4,$0000,$e6,$0000 ; BPL1PT dc.w $e8,$0000,$ea,$0000 ; BPL2PT dc.w $0180,$0001,$0182,$00af,$0184,$0148,$0186,$0666 ; picture palette dc.w $0188,$007e,$018a,$0aaa,$018c,$0eee,$018e,$0689 ; picture palette dc.w $FFFF,$FFFE PIC: incbin "logo_SM_320_256_3.raw" end the only change I do is with the line: add.l #40*256,d0 ; pic size to add.l #40*128,d0 ; pic size However I can see my picture twice on the screen, on top and bottom of the screen.. and this is the custom size issue. Now let's say I try loading a pic 320*256 with 4 bitplanes instead of 3. I will change: MOVEQ #3-1,D1 ; bitplanes count - 1 to MOVEQ #4-1,D1 ; bitplanes count - 1 Change this: dc.w $100,%0100001000000000 ; bits 14 (4 = %100) And then I add this line to BLPOINTERS: dc.w $ec,$0000,$ee,$0000 ; bitplane - BPL3PT However the picture appears disturbed. What's wrong with the code? |
02 May 2018, 00:42 | #2 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
Quote:
|
|||
02 May 2018, 08:39 | #3 | |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 22
|
Quote:
I assume (never tried) that if the windows size remains 320X256 and you use a 128px image, the latter will be duplicated and the bitplanes overlappings dont match... Increasing the bitplane number is trivial and it should work as you stated, if not I am available to take a look at your code, the ramjam course is well done and I was able to use whatever bitplane combination. I see you are italian like me, feel free to contact me if you want some help. |
|
02 May 2018, 10:34 | #4 | |||
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Hi all!
Quote:
Thank you very much Quote:
This is the full code for 4 bitplanes, I can see the image "disturbed". Code:
incdir "dh1:/own/images/" SECTION CiriCop,CODE START: move.l 4.w,a6 jsr -$78(a6) lea GfxName(PC),a1 jsr -$198(a6) move.l d0,GfxBase move.l d0,a6 move.l $26(a6),OldCop MOVE.L #PIC,d0 LEA BPLPOINTERS,A1 MOVEQ #4-1,D1 ; bitplanes count - 1 POINTBP: move.w d0,6(a1) swap d0 move.w d0,2(a1) swap d0 add.l #40*256,d0 addq.w #8,a1 dbra d1,POINTBP move.l #COPPERLIST,$dff080 move.w d0,$dff088 move.w #0,$dff1fc move.w #$c00,$dff106 mouse: btst #6,$bfe001 bne.s mouse move.l OldCop(PC),$dff080 move.w d0,$dff088 move.l 4.w,a6 jsr -$7e(a6) move.l gfxbase(PC),a1 jsr -$19e(a6) rts GfxName: dc.b "graphics.library",0,0 GfxBase: dc.l 0 OldCop: dc.l 0 SECTION GRAPHIC,DATA_C COPPERLIST: dc.w $120,$0000,$122,$0000,$124,$0000,$126,$0000,$128,$0000 ; clear sprite pointers dc.w $12a,$0000,$12c,$0000,$12e,$0000,$130,$0000,$132,$0000 ; clear sprite pointers dc.w $134,$0000,$136,$0000,$138,$0000,$13a,$0000,$13c,$0000 ; clear sprite pointers dc.w $13e,$0000 dc.w $8e,$2c81 ; DiwStrt dc.w $90,$2cc1 ; DiwStop dc.w $92,$0038 ; DdfStart dc.w $94,$00d0 ; DdfStop dc.w $102,0 ; BplCon1 dc.w $104,0 ; BplCon2 dc.w $108,0 ; Bpl1Mod dc.w $10a,0 ; Bpl2Mod dc.w $100,$4200 BPLPOINTERS: dc.w $e0,$0000,$e2,$0000 ; BPL0PT dc.w $e4,$0000,$e6,$0000 ; BPL1PT dc.w $e8,$0000,$ea,$0000 ; BPL2PT dc.w $ec,$0000,$ee,$0000 ; BPL3PT dc.w $0180,$0000,$0182,$018f,$0184,$0048,$0186,$0555 dc.w $0188,$005b,$018a,$0998,$018c,$0037,$018e,$007e dc.w $0190,$0169,$0192,$0cdd,$0194,$0689,$0196,$0124 dc.w $0198,$0677,$019a,$0aba,$019c,$0eff,$019e,$00af dc.w $FFFF,$FFFE PIC: incbin "logo_SM_320_256_4.raw" end Quote:
Last edited by fstarred; 02 May 2018 at 10:47. |
|||
02 May 2018, 11:31 | #5 | |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 22
|
the code is correct, the only thing it It might be wrong it's the color palette, did you double check it?
Quote:
|
|
02 May 2018, 11:38 | #6 | |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Quote:
However if you see also the image output of my previous post, the image display looks disturbed. |
|
02 May 2018, 12:19 | #7 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Apparently it was a fault of kefrons converter.. I've used PicCon250 and it appears to work.
|
02 May 2018, 15:08 | #8 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Having similar issue with any depth image having width <> 320.
Let's say the image is 256*128, I've changed this line add.l #40*256,d0 with add.l #32*128,d0 These are the values of DiwStrt and Stop dc.w $8e,$2c81 ; DiwStrt dc.w $90,$a1c1 ; DiwStop The output is attached on the post |
02 May 2018, 16:01 | #9 |
Registered User
Join Date: Feb 2018
Location: London / UK
Posts: 112
|
Have you tried changing the lower 8 bits in window start / stop which are the horizontal values? Try something like $2ca1 and $a1a1
|
02 May 2018, 16:02 | #10 | |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 22
|
how did you calculate a1c1?
Quote:
|
|
02 May 2018, 17:01 | #11 |
Registered User
Join Date: Mar 2018
Location: Rome
Posts: 173
|
Uhm.. I don't remember
But at least the height value, I'd calculate values in this way: height: $2c + $80(128) = $ac |
02 May 2018, 17:27 | #12 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Check DDFSTRT and DDFSTOP.
|
02 May 2018, 18:07 | #13 |
Registered User
Join Date: Feb 2018
Location: London / UK
Posts: 112
|
Oh, yeah. Change your DDFSTRT and DDFSTOP values. The vertical fetch start / stop are automatically the same as the visible window but when changing the horizontal window size you'll need to set the fetch positions to match so that a correct number of 16 pixels chunks (OCS) are read from memory per scanline. Try increasing/decreasing start/stop by $20 and go from there.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Minimising attached picture size | mark_k | project.EAB | 1 | 03 February 2013 21:12 |
Algorithm to double the size of a tile based picture smoothely? | Codetapper | project.Sprites | 9 | 31 January 2006 04:36 |
1084s Display Size & WB Overscan | Blackjackel6 | support.Hardware | 1 | 31 May 2003 14:57 |
Custom display modes with RivaTuner | §ane | support.WinUAE | 6 | 02 October 2002 06:54 |
Custom Display Modes... | P-J | support.WinUAE | 3 | 15 July 2001 11:23 |
|
|