Click here to Skip to main content
15,895,799 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.

 
GeneralBlatant Programming Question Pin
CDP180217-Nov-12 22:47
CDP180217-Nov-12 22:47 
... for which there will certainly be no more adequate place to post it. And I don't really expect more than some moral support. Smile | :)

So here we go: I'm planing to build a computer again, with up to 8 CPUs (CDP1802, what else?), up to 8 Mb RAM, Graphics based on the old MC6847 graphics chip (with one of the CPUs dedicated as graphics processor). An 8 bit machine with processors from 1976, which would have outperformed typical 16 bit Amigas or Atari STs from 1990. Smile | :)

I also want PS/2 ports for the keyboard and a mouse, but don't want to use microcontrollers. I have read, that in IBM's first AT models the Intel 8255 parallel port was used in bit mode for that purpose. Does anybody have more information about that?

The old computers based on the CDP1802 worked quite well without any OS, but this will obviously not be the case here. So I fired up both the assembler and the C compiler and started coding.

The code generated by the C compiler was more than eight times longer than that produced by the assembler. So much for compilers generating much better code than you possibly could manually. But, to be fair, it is no secret that 8 bit processors are generally not well suited for C.

Looking at the machine code confirmed that. The C compiler needed all that extra code to pass parameters to functions and keep local variables on the stack. The oldschool assembly techniques relied far more on global variables or holding values in the CDP1802's large register set.

Before I really can get to work now, I will need to work out some kind of calling convention which does not bloat the code too much, does not bog down the CPU by doing actually more work to pass parameters and variables than anything else, while trying to at least reduce the need for globals. Still, it now seems very strange that even the processor's handbook saw no need to discuss any techniques beyond global data. For recursive calls they worried about keeping the return address on the stack, but that's all. Who cares about parameters or local variables?

Edit: Just for fun: A small part of the assembler's listing:
(1)  118/      34 :                     ; =========================================================================================
(1)  119/      34 :                     ; Interrupt and DMA service routine for the CDP1861 to display an effective resolution
(1)  120/      34 :                     ; of 64 x 64 pixels, using a display buffer of 512 bytes.
(1)  121/      34 :                     ; =========================================================================================
(1)  122/      34 :                     
(1)  123/      34 : =>TRUE              		IF Resolution == 40H
(1)  124/      34 :                     
(1)  125/      34 : 72                  ExitInterrupt:	LDXA
(1)  126/      35 : 70                  		RET
(1)  127/      36 : C4                  DisplayInt:	NOP
(1)  128/      37 : 22                  		DEC R2
(1)  129/      38 : 78                  		SAV
(1)  130/      39 : 22                  		DEC R2
(1)  131/      3A : 52                  		STR R2
(1)  132/      3B : F8 01               		LDI DisplayBuffer >> 8
(1)  133/      3D : B0                  		PHI R0
(1)  134/      3E : F8 00               		LDI 00H
(1)  135/      40 : A0                  		PLO R0
(1)  136/      41 : C4                  		NOP
(1)  137/      42 : C4                  		NOP
(1)  138/      43 : E2                  		SEX R2
(1)  139/      44 : 80                  DisplayLoop:	GLO R0
(1)  140/      45 : E2                  		SEX R2
(1)  141/      46 : 20                  		DEC R0
(1)  142/      47 : A0                  		PLO R0
(1)  143/      48 : E2                  		SEX R2
(1)  144/      49 : 3C 44               		BN1 DisplayLoop
(1)  145/      4B : 80                  Rest:		GLO R0
(1)  146/      4C : E2                  		SEX R2
(1)  147/      4D : 20                  		DEC R0
(1)  148/      4E : A0                  		PLO R0
(1)  149/      4F : 34 4B               		B1 Rest
(1)  150/      51 : 30 34               		BR ExitInterrupt
(1)  151/      53 :                     
(1)  152/      53 : [123]               		ENDIF


modified 18-Nov-12 4:59am.

GeneralRe: Blatant Programming Question Pin
RugbyLeague17-Nov-12 23:03
RugbyLeague17-Nov-12 23:03 
GeneralRe: Blatant Programming Question Pin
CDP180217-Nov-12 23:11
CDP180217-Nov-12 23:11 
GeneralRe: Blatant Programming Question Pin
harold aptroot18-Nov-12 0:10
harold aptroot18-Nov-12 0:10 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 0:34
CDP180218-Nov-12 0:34 
GeneralRe: Blatant Programming Question Pin
OriginalGriff18-Nov-12 0:42
mveOriginalGriff18-Nov-12 0:42 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 1:12
CDP180218-Nov-12 1:12 
GeneralRe: Blatant Programming Question Pin
OriginalGriff18-Nov-12 1:19
mveOriginalGriff18-Nov-12 1:19 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 1:41
CDP180218-Nov-12 1:41 
GeneralRe: Blatant Programming Question Pin
OriginalGriff18-Nov-12 2:02
mveOriginalGriff18-Nov-12 2:02 
GeneralRe: Blatant Programming Question Pin
Mike Hankey18-Nov-12 2:18
mveMike Hankey18-Nov-12 2:18 
GeneralRe: Blatant Programming Question Pin
Mike Hankey18-Nov-12 2:27
mveMike Hankey18-Nov-12 2:27 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 3:07
CDP180218-Nov-12 3:07 
GeneralRe: Blatant Programming Question Pin
  Forogar  18-Nov-12 3:26
professional  Forogar  18-Nov-12 3:26 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 3:49
CDP180218-Nov-12 3:49 
GeneralRe: Blatant Programming Question Pin
Mike Hankey18-Nov-12 3:29
mveMike Hankey18-Nov-12 3:29 
GeneralRe: Blatant Programming Question Pin
Vivi Chellappa18-Nov-12 5:24
professionalVivi Chellappa18-Nov-12 5:24 
GeneralRe: Blatant Programming Question Pin
Roger Wright18-Nov-12 17:07
professionalRoger Wright18-Nov-12 17:07 
GeneralRe: Blatant Programming Question Pin
CDP180218-Nov-12 19:20
CDP180218-Nov-12 19:20 
GeneralRe: Blatant Programming Question Pin
Roger Wright19-Nov-12 2:14
professionalRoger Wright19-Nov-12 2:14 
GeneralRe: Blatant Programming Question Pin
CDP180219-Nov-12 2:21
CDP180219-Nov-12 2:21 
GeneralRe: Blatant Programming Question Pin
Rage18-Nov-12 22:12
professionalRage18-Nov-12 22:12 
GeneralRe: Blatant Programming Question Pin
Paul O'Brien19-Nov-12 2:22
Paul O'Brien19-Nov-12 2:22 
GeneralRe: Blatant Programming Question Pin
Rage19-Nov-12 2:27
professionalRage19-Nov-12 2:27 
GeneralRe: Blatant Programming Question Pin
patbob19-Nov-12 6:23
patbob19-Nov-12 6:23 

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.