Click here to Skip to main content
15,886,584 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 11:42
CodeWraith5-Dec-20 11:42 
GeneralRe: From my crossassembler's manual Pin
OriginalGriff5-Dec-20 20:20
mveOriginalGriff5-Dec-20 20:20 
GeneralRe: From my crossassembler's manual Pin
trønderen5-Dec-20 13:40
trønderen5-Dec-20 13:40 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 14:40
CodeWraith5-Dec-20 14:40 
GeneralRe: From my crossassembler's manual Pin
trønderen5-Dec-20 17:25
trønderen5-Dec-20 17:25 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 23:21
CodeWraith5-Dec-20 23:21 
GeneralRe: From my crossassembler's manual Pin
trønderen6-Dec-20 8:20
trønderen6-Dec-20 8:20 
GeneralRe: From my crossassembler's manual Pin
CodeWraith6-Dec-20 14:39
CodeWraith6-Dec-20 14:39 
Quote:
If the timing precision is the only argument against using a HLL, then you claim that it is impossible for a compiler to generate the same instructions as those you handcraft using an assembler. I would like to see the arguments for defending that claim.

I can try, but it will not be easy to show you all the traps in this code which a compiler would have to evade.

This is the datasheet of the ancient CDP1861 graphics chip: Datasheet[^]

It's just a year younger than the famous Altair and the ability to add graphics to your computer for about 20$ was a small wonder. Just hook up this chip to your bus, send the output signals to a composite monitor, include a small interrupt routine and you are ready to go. Of course that only works if you have a CDP1802 processor, because these ICs work together closely via interrupt and DMA.

You will find these interrupt routines on the last pages of the datasheet.

The upper part is all acout initialisation. It already has some pitfalls, worst of which is that the graphics chip gives us only a certain number of bus cycles before it starts requesting display data via DMA. If the initialisation is not complete by then, we are already out of sync before we have begun. How is a compiler to know this? Will it read the datasheet? Other devices may give us more or less time.

The real problem comes in the second half from the DISP label on. The graphics chip has begun to display graphics data line by line. It gets these bytes via DMA, but the CPU never gives up control of the bus. Instead, it adds an additional DMA bus cycle at the end of the current instruction, does the memory addressing itself. The CPU acts like a DMA controller and uses register 0 as DMA pointer.

The lower part of the interrupt routine is albout reducing the vertical resolution. The graphics chip always requests 128 lines every frame. If you repeat each line two or four times, you can reduce the memory requirements of the video buffer and also get better aspect ratios of the pixels.

Again we must execute an exact number of bus cycles per line and at the same time manipulate register 0 while it's also altered by exactly 8 DMA requests per line. Do you know any compiler that could deal with this? Why is it even important? When hardware and software interact so closely all knowledge of the instruction set in the world is not enough.

And yes, this CDP1861 is obsolete and out of production for 30 years now. It's a museum piece. That did not krrp some people from building their own replacements, some even with higher resolutions. But nobody ever even tried to implement any interrupt routines in any high level language. And I recently posted them a little graphics library with modified interrupt routines thatsupport double buffering and configurable vertical resolution. And sprites, text output...

Yes, we have a C compiler that I could have used for that. The performance was ok, but the compiled code was about 1/4 - 1/3 longer. Not acceptable on a computer with as little as 4k memory. Just as I said before. Not everything you can program has the resources of a state of the art PC.
I have lived with several Zen masters - all of them were cats.

His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.

GeneralRe: From my crossassembler's manual Pin
trønderen7-Dec-20 11:28
trønderen7-Dec-20 11:28 
GeneralRe: From my crossassembler's manual Pin
CodeWraith7-Dec-20 13:03
CodeWraith7-Dec-20 13:03 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 6:05
professionalden2k886-Dec-20 6:05 
GeneralRe: From my crossassembler's manual Pin
trønderen6-Dec-20 8:36
trønderen6-Dec-20 8:36 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 11:18
professionalden2k886-Dec-20 11:18 
GeneralRe: From my crossassembler's manual Pin
Richard MacCutchan5-Dec-20 21:35
mveRichard MacCutchan5-Dec-20 21:35 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 23:29
CodeWraith5-Dec-20 23:29 
GeneralRe: From my crossassembler's manual Pin
Richard MacCutchan6-Dec-20 1:25
mveRichard MacCutchan6-Dec-20 1:25 
GeneralRe: From my crossassembler's manual Pin
dandy726-Dec-20 3:24
dandy726-Dec-20 3:24 
GeneralRe: From my crossassembler's manual Pin
CodeWraith6-Dec-20 3:54
CodeWraith6-Dec-20 3:54 
GeneralRe: From my crossassembler's manual Pin
dandy727-Dec-20 9:24
dandy727-Dec-20 9:24 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 5:53
professionalden2k886-Dec-20 5:53 
JokeAin't it the truth PinPopular
Mike Hankey5-Dec-20 8:19
mveMike Hankey5-Dec-20 8:19 
GeneralRe: Ain't it the truth Pin
OriginalGriff5-Dec-20 9:46
mveOriginalGriff5-Dec-20 9:46 
GeneralRe: Ain't it the truth Pin
Slacker0075-Dec-20 9:55
professionalSlacker0075-Dec-20 9:55 
GeneralRe: Ain't it the truth Pin
W Balboos, GHB6-Dec-20 1:11
W Balboos, GHB6-Dec-20 1:11 
GeneralRe: Ain't it the truth Pin
User 110609795-Dec-20 12:33
User 110609795-Dec-20 12:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.