6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 16, 2024 11:25 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: MC6845 programming
PostPosted: Sun Oct 10, 2021 4:30 pm 
Offline

Joined: Sat Jan 09, 2021 9:33 pm
Posts: 24
Hello there,

I try to find the good configuration bytes for a MC6845 crtc.
This chip is widely used with 6502 system so I hope I can find advises here.

The situation is as follow :
- dot clock 16 MHz
- character clock 1.6 MHz
- expected display 80 x 24 or 80x25 characters
- output to a video composite entry PAL or NTSC
- character generator with 8 rows of 9 lines of dots
- no need for space between character and line, these empty lines and rows are included in the dot matrix of each character.

I find manually a set of datas :

FCB $69,$50 ; R0 R1 H total and H displayed
FCB $57,$08 ; R2 R3 HS position and HS width
FCB $21,$06 ; R4 R5 V total and V total adjacent
FCB $18,$1C ; R6 R7 V displayed and VS position
FCB $00,$08 ; R8 R9 Interlace and Max scan line
FCB $60,$08 ; R10 R11 Cursor start and end
FDB $0000 ; R12 R13 Start cursor
FDB $0000 ; R14 R15 Cursor address

which give a stable 80x24 display but a little bit too large for the screen...
The obvious solution (increase R0), even of one character, give a lost of synchronization on the screen.

Of course I read carefully the 6845 datasheet but codes calculation examples and explanations are unclear and confused.

Any explanation on how to do the calculation will be welcome. May there is omewhere a program or spreadsheet for helping in this topic ?
Or may a commented calculation example ?

Thanks for help.
Philippe


Top
 Profile  
Reply with quote  
 Post subject: Re: MC6845 programming
PostPosted: Sun Oct 10, 2021 4:45 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10981
Location: England
There's a masterclass video which might help:

Acorn Masterclass: An Introduction to CRTC Registers on the BBC Micro - Part 1

And the slides are here.

And the interactive demo you can run, written in Basic and running in the browser:
https://stardot.org.uk/forums/viewtopic ... 29#p304929
(click to focus in the right pane then use cursor keys to select a register and adjust the value)


Top
 Profile  
Reply with quote  
 Post subject: Re: MC6845 programming
PostPosted: Sun Oct 10, 2021 5:19 pm 
Offline

Joined: Sat Jan 09, 2021 9:33 pm
Posts: 24
Very nice !


Top
 Profile  
Reply with quote  
 Post subject: Re: MC6845 programming
PostPosted: Mon Oct 11, 2021 6:47 am 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
You can have a look here too http://www.6502.org/users/andre/hwinfo/crtc/index.html

It is important to understand what your video output timing is, then use the clock frequency to determine the register values.

Say for example you have 15kHz horizontal video frequency (e.g. PAL video), each line takes about 66us.
With a 1MHz system with 1us cycle time you then need to put 66 into CRTC reg 0 to get 66us. For a 2MHz system with 0.5us cycle time you have to use 132 as value to reach the 66us. And so on.

André

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
 Post subject: Re: MC6845 programming
PostPosted: Mon Oct 11, 2021 6:54 am 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
And looking at what seems to be your problem above.

With a given clock frequency and one character per clock cycle, a character takes a defined amount of width on the screen. With the 1MHz example from my prev. post you can have 66 characters on screen - minus the time where the sync and retrace is. For a one MHz system that typically results in a 40col display.

If you change the total number of cycles on a line, ie reg 0, you break the video timing and the monitor will normally notsync anymore.

To get a larger border or to get more characters, with a given video timing you need to increase the clock speed

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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: