English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 21 December 2018, 21:18   #1
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Setting up screen parameters/DIW/DDF/..

I'm setting up a screen (PAL) with a layout like this:
Click image for larger version

Name:	scrSetupOK.jpg
Views:	47
Size:	179.8 KB
ID:	61264
It has 4 parts, vertically, 2 of which are 'active':
Code:
1/4: upper red border (passive) (no bitplanes)
2/4: sfx area: 320x160, 5 bitplanes
3/4: txt area: 320x80, 2 bitplanes
4/4: lower red border (passive) (no bitplanes)
I've attached the source, with a vasm makefile. I'm using a standard main/frame loop as shown in the tutorials by Photon (main.s). Nothing happens in the main loop; every is set up at initialisation, like this:
Code:
init:
    jsr     sysInit                     ;sys setup/init
    jsr     scrMainSetupDIWDDF          ;main screen setup

    jsr     scrSfxSetBitplanePointers   ;sfx screen setup
    jsr     scrSfxInit                  ;sfx screen init: OFFENDING LINE
    jsr     scrTxtSetBitplanePointers   ;txt screen setup

    move.l  #copper,COP1LCH             ;set new copper list
Here's how the screen memory is allocated (in screen.s):
Code:
    SECTION ScreenDataC,DATA_C

;-- scrSfx mem alloc
    EVEN
scrSfxMem:
    dcb.b   (scrSfxWidth*scrSfxHeight*scrSfxNrBpl)/8,%11110000

;-- scrTxt mem alloc
    EVEN
scrTxtMem:
    dcb.b   (scrTxtWidth*scrTxtHeight*scrTxtNrBpl)/8,$f0
The DIW/DDF setup is pretty standard, too (screen is 320 pixels wide):
Code:
ddfStartValue           equ $38
ddfStopValue            equ $d0

diwStartValue           equ (scrSfxFirstLine<<8)+$81
diwStopValue            equ ((scrTxtLastLine-$100+1)<<8)+$c1

    EVEN
scrMainSetupDIWDDF:
    move.w  #diwStartValue,DIWSTRT
    move.w  #diwStopValue,DIWSTOP

    move.w  #ddfStartValue,DDFSTRT
    move.w  #ddfStopValue,DDFSTOP

.return:
    rts
If I leave out the offending line, everything seems to work as expected, and I get the screen shown above. However, as a test, I wanted to 'draw' a rectangle in the sfx area, starting at 1/4 height from the top and going to 3/4 down. This is the code for that:
Code:
    EVEN
scrSfxInit:
    lea     scrSfxMem+(scrSfxBplTotalSize/4),a0         ;start at 1/4 down
    move.l  #(scrSfxBplTotalSize/2)-1,d0                ;'paint' to 3/4 down
.bplFillLoopSfx:    
    move.b  #$ff,(a0)+
    dbf     d0,.bplFillLoopSfx
    
.return:
    rts
However, to my surprise, I get this:
Click image for larger version

Name:	scrSetupNotOK.jpg
Views:	46
Size:	205.8 KB
ID:	61265
Please note the unexpected garbage data at the end of the txt area. Also note that this is a winUAE screenshot; on an actual Amiga it's even worse. I should probably mention I'm using non-interleaved bitplane mode for the sfx area (which is new for me). Also, in screen.s, if you swap the allocation order (sfx <-> txt), you get a different 'effect'. I'm aware the first line of the sfx area looks quite hairy, what with setting the full palette in the copper and all. Also, I'm only setting the DIW/DDF parameters once, and switching the number of bitplanes after 2/3 of the height.

I've been looking at this for hours, and I have no idea what's wrong. I've been logging all my parameters (width, height, nr of bitplanes), and everything looks like I expect it to. The memory seems to be filled with random data, which would suggest I'm reading some memory which has not been allocated/initialized. However, if I don't draw the testing rectangle, everything seems to be fine.

What am I missing/not understanding/doing wrong? Any tips would be very welcome! Even if they imply I'm very stupid!
Attached Files
File Type: zip scrSetup.zip (21.1 KB, 17 views)
guy lateur is offline  
Old 21 December 2018, 21:40   #2
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
The way I debug these problems is by simply using the Action Replay cart.

Add it as a cartridge rom and press Page Up to go into it... if you go down this route then let me know and I'll give you some basic pointers on how to use it.
mcgeezer is offline  
Old 21 December 2018, 21:53   #3
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Quote:
Originally Posted by mcgeezer View Post
The way I debug these problems is by simply using the Action Replay cart.

Add it as a cartridge rom and press Page Up to go into it... if you go down this route then let me know and I'll give you some basic pointers on how to use it.
Thanks for the tip, that's definitely something I should check out! I can't seem to get it to work, though. Nothing happens when I press PageUp/Down, it seems. Below are my settings (winUAE 4.0.1; version that comes with Amiga Forever 7.2.12.0). Do I need to do anything else?
Click image for larger version

Name:	actionReplaySettings.jpg
Views:	31
Size:	169.4 KB
ID:	61267
guy lateur is offline  
Old 21 December 2018, 21:58   #4
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Quote:
Originally Posted by guy lateur View Post
Thanks for the tip, that's definitely something I should check out! I can't seem to get it to work, though. Nothing happens when I press PageUp/Down, it seems. Below are my settings (winUAE 4.0.1; version that comes with Amiga Forever 7.2.12.0). Do I need to do anything else?
Attachment 61267
Wait, that's not the way to set it up, is it? Where can I get this cartridge ROM?
guy lateur is offline  
Old 21 December 2018, 22:15   #5
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Quote:
Originally Posted by guy lateur View Post
Wait, that's not the way to set it up, is it? Where can I get this cartridge ROM?
Try here.

http://109.228.4.199/eab/
mcgeezer is offline  
Old 21 December 2018, 22:25   #6
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Quote:
Originally Posted by mcgeezer View Post
Thanks, but that seems to prevent my machine (A1200, 3.1 ROM) from booting. Also, my antivirus went mental over it..
guy lateur is offline  
Old 21 December 2018, 22:27   #7
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Quote:
Originally Posted by guy lateur View Post
Thanks, but that seems to prevent my machine (A1200, 3.1 ROM) from booting. Also, my antivirus went mental over it..
Ohh...I assumed you were using the OCS..

I've uploaded the A1200 AR Cart rom so refresh the page.

Not sure what your AV went mental over. My VPS is quite safe.
mcgeezer is offline  
Old 21 December 2018, 22:50   #8
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Quote:
Originally Posted by mcgeezer View Post
Ohh...I assumed you were using the OCS..

I've uploaded the A1200 AR Cart rom so refresh the page.

Not sure what your AV went mental over. My VPS is quite safe.
My AV probably just doesn't like me browsing directly to ip-adresses and/or downloading a .rom file -- which is fair enough. Anyway, the AR cartridge now seems to work, which is nice, so thank you! I'll need to read up on what exactly I can do with it, of course.

I have used the built-in winUAE debugger before, too, so I know how to look at memory and so on. I'm still not sure on how to further debug this problem I'm having, though..
guy lateur is offline  
Old 22 December 2018, 10:13   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,368
Old system copperlist runs at least once after you have set up DIW/DDF...
Toni Wilen is offline  
Old 22 December 2018, 11:54   #10
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,462
Just a word in addition to Toni's write.

If you do not want to insert DIW/DDF in copper list be assured that old copper do not create a race condition with you code.
The garbage is due to DDFSTOP as the old value and there is a one more fetch every line.
Unfortunately your video pattern is too much simple to notice immediately the differences, but it's here from the second line
ross is offline  
Old 22 December 2018, 12:05   #11
guy lateur
Registered User

guy lateur's Avatar
 
Join Date: May 2017
Location: Belgium
Age: 45
Posts: 297
Quote:
Originally Posted by Toni Wilen View Post
Old system copperlist runs at least once after you have set up DIW/DDF...
D'oh! I knew I was gonna look stupid.. Thanks a lot for your help, you saved my holidays! I'm gonna go ahead and ruin them again in just a moment, probably..

Also thank you ross for your explanation. I clearly still have a lot to learn.

Here's the working code:
Code:
init:
    jsr     sysInit                     ;sys setup/init

    move.l  #copper,COP1LCH             ;set new copper list
    jsr     scrMainSetupDIWDDF          ;main screen setup

    jsr     scrSfxInit                  ;sfx screen preFill: OFFENDING LINE
    jsr     scrSfxSetBitplanePointers   ;sfx screen setup

    jsr     scrTxtSetBitplanePointers   ;txt screen setup
Here's what it looks like:
Click image for larger version

Name:	scrSetupInitOK.jpg
Views:	33
Size:	119.2 KB
ID:	61274
guy lateur is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameters hdf... Stl75 support.WinUAE 1 14 March 2018 22:42
Setting application screen positions? Sinphaltimus support.Other 2 22 January 2018 03:26
Button to generate a correct integer scale setting for the current screen display Leandro Jardim support.WinUAE 2 25 September 2017 11:25
BPLCON4 and DDF-registers (AGA) dissident Coders. Asm / Hardware 53 25 March 2017 10:37
WinUAE commandline parameters Borg_Number_One New to Emulation or Amiga scene 7 04 October 2006 15:34

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.07812 seconds with 16 queries