Programming the VDP in ASM

Assembler, C/C++ related topics

Programming the VDP in ASM

Postby Chris » Fri Dec 26, 2014 11:51 pm

Hello all and a belated happy christmas.

I'm having a bit of a problem programming the VDP in ASM and hoped someone could give me some pointers to the correct sequence. I'm probably not understanding something correctly.

Taking my cues from the objdump of the rom:

currently I am performing a reset (setting SRS/Clearing SRS)
setting R6 SCREEN_MODE0 =($59), R7 SCREEN_MODE1 =($08), P7 SYSCTRL =($00) for mode P2
setting R8 CTRL =($c2)
setting R13 PALETTE_CTRL =($00)
setting R14 PALETTE_PTR =($00)

I then copy the 16 bytes from the palette table into P1 PALETTE_REG - I use the palette table from the font.h for the rom
i then copy the font data from the font.h to VRAM starting at $00000
i then I set the backdrop colour to $04 as per the ROM code
i then I set 3784 bytes of VRAM starting at $7C000 to $00

All I get is a white screen, just like its not been programmed. attempting to write anything to the VRAM pattern table doesn't change anything (i am writing 2 bytes per location).

I get a clear 2 weeks to work on something and I've spent 3 days banging my head against something so basic :oops:

Thanks
Chris
Chris
Developer
 
Posts: 279
Joined: Thu Apr 04, 2013 7:53 pm
Location: England, UK

Re: Programming the VDP in ASM

Postby simon » Sat Dec 27, 2014 11:08 am

Belated happy Christmas Chris,

the register values are correct. First I can see is that you copy 16 bytes only to the palette. Each of the palette entries consists of three bytes (one for R, one for G, one for B). Thus you have to write 3*16 bytes.
Second I don't know if the first entry of the font data is a character. Maybe it is just a blank. If it is a blank you would get an empty screen (backdrop color) if you write it all over the screen. Try to write "$21,$00" patterns. If I am correct, this should write "A"s (ASCII 65-32)...

You can post/send the code if you need help. I am curious what you will come around with. :-)

Good luck!

Simon
simon
Site Admin
 
Posts: 742
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany

Re: Programming the VDP in ASM

Postby Chris » Sat Dec 27, 2014 5:28 pm

simon wrote:I can see is that you copy 16 bytes only to the palette. Each of the palette entries consists of three bytes (one for R, one for G, one for B). Thus you have to write 3*16 bytes.
You can post/send the code if you need help. I am curious what you will come around with. :-)


Hi Simon, yes a very poor description on my part, I have written 16 x 3 byte entries not just 16 bytes. I have attached the basic initialisation code as I can't seem to post it in code delimiters, it is pre-optimisation as I wanted to get it working before I started shaving cycles. Font.inc is just a rework of font.h that works in an assembler.

I must have done something stupid and have gone code blind and can't see the problem. I have run it through the idk68 simulator and it appears to do what I expect it to do, so heres hoping a fresh set of eyes will spot it right away.

Thanks

Chris
Attachments
VDPTest.txt
(5.07 KiB) Downloaded 329 times
Chris
Developer
 
Posts: 279
Joined: Thu Apr 04, 2013 7:53 pm
Location: England, UK

Re: Programming the VDP in ASM

Postby simon » Sat Dec 27, 2014 6:10 pm

Hi Chris,

maybe your program never contiues at your status check right at the beginning.
Look at your code:
Code: Select all
WAIT       move.b $3df610, D0          ; read status

$10 is port #8 which is the "primary standard kanji ROM ADDRESS PORT" which is write-only. You probably got confused by hex and decimal as you want to check port #5 (decimal 10 or hex $0a). Try this line instead:
Code: Select all
WAIT       move.b $3df60a, D0          ; read status
simon
Site Admin
 
Posts: 742
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany

Re: Programming the VDP in ASM

Postby Chris » Sat Dec 27, 2014 6:52 pm

simon wrote:Hi Chris,

maybe your program never contiues at your status check right at the beginning.
Look at your code:
Code: Select all
WAIT       move.b $3df610, D0          ; read status

$10 is port #8 which is the "primary standard kanji ROM ADDRESS PORT" which is write-only. You probably got confused by hex and decimal as you want to check port #5 (decimal 10 or hex $0a). Try this line instead:
Code: Select all
WAIT       move.b $3df60a, D0          ; read status


Well spotted :clap: , that'll be exactly what happened. I better go over the others and double check there are no more.

Thanks

Chris
Chris
Developer
 
Posts: 279
Joined: Thu Apr 04, 2013 7:53 pm
Location: England, UK

Re: Programming the VDP in ASM

Postby Chris » Sat Dec 27, 2014 7:01 pm

All working now,

It also helps if you reset the VRAM address before you start to fill it with 'A's after you've just filled it with chr(0) :oops:

Thanks again for looking at that Simon.

Regards

Chris
Chris
Developer
 
Posts: 279
Joined: Thu Apr 04, 2013 7:53 pm
Location: England, UK

Re: Programming the VDP in ASM

Postby simon » Sat Dec 27, 2014 7:09 pm

Great Chris, I am happy for you that it works now. :) Programming errors can be a nightmare to find...

Good luck with your program. I am curious what it will be. :)

Regards
Simon
simon
Site Admin
 
Posts: 742
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest