It is currently Mon Oct 20, 2014 4:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Jun 09, 2014 6:07 pm 
Offline
User avatar
 Profile

Joined: Thu Feb 02, 2012 4:24 am
Posts: 68
Hi,
I first asked about this at the bottom of a previous thread.. but it was kind of a thread derail.. and I'm still stuck on this problem :)

http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=881

My objective: to change from a regular screen mode -- such as Mode 7 - to a custom 8k screen mode (which is a 128x256 pixel screen based on Mode 5). I want to be able to do this without wiping the memory between &5800 and &6000.

What is working: I can get an "8k MODE 5" by first changing to MODE 5 and then setting values in CRTC for 128x256 pixel screen and the screen start addr to &6000

What isn't working: By changing to Mode 5 first, I wipe the memory between 5800-6000. To try to resolve this, starting from Mode 7, I do the following:

a) clearing screen by writing zeroes to 6000-8000
b) setting all CRTC values to reflect an 8k mode 5 (ie keep the params to those in the Advanced User Guide for Mode 5 except chars per line and screen address)
c) Set the video ula &FE20 to &C4 (ie Mode 5)
d) Set the palette register to default mode 5 values by issuing VDU 20 (lda #20;jsr oswrch)
e) Set addressable latch for 8k screen:
ldx #4+8 : stx SysViaRegB \\ these two set the
ldx #5+0 : stx SysViaRegB \\ screen size to 8k


RESULT: the screen clears, but when plotting pixels, I get distorted results - essentially fragments of MODE 7 text characters in the area where pixels should be plotted..within an 8k screen area.. ie 32x32 char screen.

Where am I going wrong? Is what I'm aiming for possible?


Top
 
PostPosted: Mon Jun 09, 2014 8:51 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 7:02 pm
Posts: 273
Sound like the OS is re-programming the video ULA behind your back. Either use OSBYTE &9a to change the ULA control register, write to the shadow copy at &248 as well as &fe20, or disable interrupts and bin the OS.


Top
 
PostPosted: Tue Jun 10, 2014 6:07 pm 
Offline
User avatar
 Profile

Joined: Thu Feb 02, 2012 4:24 am
Posts: 68
Thanks Tom. Looks like that is what was happening.
I used OSBYTE &9A which did the trick, mostly.

I then got a blank white screen. Issuing VDU 19 OSWORD calls to change the palette didn't work properly.

I realised this was because VDU workspace wasn't being initialised to what I needed - i.e values suitable for MODE 5, which is pretty much what the 8k mode I'm using is, albeit 128x256 pixels. So I took a look at the memory layout notes in the AUG and fudged a few values so that the VDU 19 OSWORD calls worked correctly. Code snippet below for those who might be interested :)


Code:
;Set (fudge) VDU Workspace values
   ;________________________________________________________________
   .VduWorkspace
   lda #5   ; Record screen mode . We're actually setting up a custom 8k screen mode - but it's based on mode 5.
          ; We do this so the VDU 19 OS routines called below set the palette correctly.
   sta &355 ; The OS refers to this mem location in VDU routines. See p277 AUG.

   lda #3   ; Record number of logical colours minus one.
          ; We do this so the VDU 19 OS routines called below set the palette correctly.
   sta &360 ; The OS refers to this mem location in VDU routines. See p277 AUG

   lda #16  ; Record 16 bytes per character.
          ; We do this so the VDU 19 OS routines called below set the palette correctly.
   sta &34f ; The OS refers to this mem location in VDU routines. See p276 AUG
   ;________________________________________________________________


<snip>
;VDU 19 calls
   ;________________________________________________________________
   ;We need to set the logical colours ourselves,
   ;even if we wanted the defaults for a 4 colour screen.
   ;This is because we have set our own screen mode without
   ;calling the normal OS routines which would initialise everything
   ;like colour defaults for us.
   
   .vdu19
   ;Logical col 0 = blue
   lda #&0c         ; OSWORD call for VDU 19
   LDX #c0 MOD 256   ; param
   LDY #c0 DIV 256     ; block
   jsr osword

.
.
.
<snip>
 


TomW wrote:
Sound like the OS is re-programming the video ULA behind your back. Either use OSBYTE &9a to change the ULA control register, write to the shadow copy at &248 as well as &fe20, or disable interrupts and bin the OS.


Top
 
PostPosted: Tue Jun 10, 2014 10:25 pm 
Offline
User avatar
 Profile

Joined: Sat Mar 26, 2011 3:01 pm
Posts: 263
Location: Kings Langley
Glad you got it sorted, I can "go straight to the metal", but have only learned one OSBYTE call (1 - or is it 0)!


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron