• Please review our updated Terms and Rules here

PET 4032 restoration

Yes, and I tried that several times. I agree the video RAM might be bad, but that wouldn't stop it beeping when entering PRINT CHR$(7) would it? That would make it beep wouldn't it?

You're assuming at this point that your keyboard is OK, and the keyboard VIA is OK...
 
That's a fair point. I could try with a different keyboard I suppose... But I think the VIA is not socketed, so swapping it out for a known good one will take a while.
 
Obvs I meant the keyboard PIA before anyone says anything ;)

One thing at a time I guess, we need to concentrate on getting the video working. At least with a chirrup you have an idea that the VIA is doing something. Have you scoped pins 1/3/5 of the video connector? One of my other threads has a fix for a missing video signal on an otherwise working machine.

W
 
I'm checking round the video generation circuit with a logic probe just to be sure...

All this testing tells me things are probably OK with this section. So it looks like the CPU is running enough to beep, then set up the 6545 CRTC and then clear video RAM before it goes off track. This explained why BASIC is not working and the blank screen. The problem may possibly be a bad ROM or bad low RAM. Since these parts are soldered, perhaps some ideas for next step include:

1. Using a RAM/ROM replacement board (if you dislike the idea of replacing so many parts).
2. Program one 2532 at a time and piggyback first the $B000 ROM, then reprogramming and trying the $C000 ROM, etc. until some response is seen. (this is hoping the ROM fault is an open line and not shorted).
3. Piggyback one RAM chip at a time in the lower 8 chips (odd numbered chips like UA5).
 
I have 4116 chips in my parts bin, so would try 3 first.

I do have a desoldering station and IC sockets as well, so I can remove the lower RAM and put some more in. But first I need to ensure the control lines are connected (had a failed CAS line on my 3016 for example). This puts me in more familiar territory. I suppose the monitor needs a working later RAM bank, too.
 
I suppose the monitor needs a working later RAM bank, too.

I'm not quite sure what you mean here. Are you saying is it possible that the video RAM is not working? The answer is yes, but at this point it would not prevent something on the screen. So the first step is to get BASIC up and running and go from there. You are doing great with the troubleshooting.
-Dave
 
Hi Dave

I meant the machine code monitor that is activated by pulling the diagnostic sense pin low (not the CRT monitor). :D Ambiguous of me...

I have been looking at the memory banks. CAS0 and CAS1 look to be stuck high. RAS0 is OK. This is exactly what happened on my other PET!

Still tracing the signal. Got it back to the multiplexer at UE2. No pulsing on Y4 (supplies the CAS0 and CAS1 signal, via some gates), but pulsing on A4 and B4 inputs. Again, same as my other PET. I found a spare 74LS157 and piggybacked it over UE2; now I have a CAS0, but BASIC is still not booting. And no CAS1 (at least, not after the chirp - it flashes a few times then sticks high). And still no M/C monitor.

For CAS1 I think it's one of the gates of the 74LS00 at UD5. Pin 11 (CAS1) is stuck high but the gate's inputs are pulsing nicely. Don't have a lot of time to swap it out now, would BASIC boot with just the lower RAM working?

Edit: Swapped out UD5 but pin 11 still stuck high.
 
Last edited:
Might be time to break out the Zicon logic analyser. This is a specialised thing that can record all the CPU pin states, plus disassemble a piece of working code. You can trigger it by the address line and / or data bus values. Only thing is, it has very little memory for recording stuff so we have to be specific.

So, can anyone tell me.. in the 6502's ROM address space, what are the key addresses that are executed at boot up? I need a list, then I can use the Zicon to trigger on each of these addresses and we will see how far in the boot sequence it is getting.

This machine has the following ROMs installed:

  • UD6 MOS 901465-22 4382 (CBM mask rom) F000-FFFF
  • UD7 Microport 80 column editor ROM (EPROM) E000-EFFF
  • UD8 MOS 901465-21 4982 (CBM mask ROM) D000-DFFF
  • UD9 MOS 901465-20 4382 (CBM mask ROM) B000-BFFF
  • UD10 MOS 901465-23 4781 (CBM mask ROM) A000-AFFF

It's a shame I don't have a 6502 ICE, I could use that to check the memory...

Edit: This may help: http://www.classiccmp.org/dunfield/pet/petmem.txt. Says the BASIC cold boot entry point is D3B6. I can check to see if it is getting called.

Also FD16 seems to be the kernel entry point, but I think it's safe to say it is called as there is a chirp.

Edit #2: Not getting to D3B6, but is getting to FD16, at which point we get
FD16 LDX #FF
FD18 SEI
FD19 TXS
FD1A CLD
FD1B JSR E000

..then...
E000 JMP E04B

E04B JSR E60F

..etc.

Proves the Zicon is running right, and connected. So anyway.. it seems to be stuck in a loop but my 6502 assembly isn't good enough to work out what it's up to.
 
Last edited:
Hi Dave

I meant the machine code monitor that is activated by pulling the diagnostic sense pin low (not the CRT monitor). :D Ambiguous of me...

I have been looking at the memory banks. CAS0 and CAS1 look to be stuck high. RAS0 is OK.

Check the Y-Z jumpers to make sure 32K RAM is enabled. See Detail B in Top Assembly Sheet.

M/L Monitor should work with 16K RAM.
 
Last edited:
So, can anyone tell me.. in the 6502's ROM address space, what are the key addresses that are executed at boot up?

Here is a listing of the initialization routines.
Code:
; -    Power-Up RESET Entry


 FD16        LDX #$FF    ; Load X $FF
 FD18        SEI        ; Disable Interrupts
 FD19        TXS        ; Transfer $FF to Stack Pointer
 FD1A        CLD        ; Clear Decimal Mode
 FD1B        JSR $E000    ; cint    Initialize Editor & Screen
 FD1E        LDA #$FF
 FD20        STA $94        ; Vector: Non-Maskable Interrupt [3:C389,4: B3FF]
 FD22        LDA #$B3
 FD24        STA $95
 FD26        LDA #$78
 FD28        STA $92        ; Vector: BRK Instr. Interrupt [3: FD17, 4: D478]
 FD2A        LDA #$D4
 FD2C        STA $93
 FD2E        LDA #$A4
 FD30        STA $03FA    ; Monitor extension vector [D7A4]
 FD33        LDA #$D7
 FD35        STA $03FB
 FD38        LDA #$00
 FD3A        STA $03FC    ; 4: Flag: Kernal Variable for IEEE Timeout
 FD3D        CLI        ; Enable Interrupts
;
 FD3E        LDA $E810    ; PIA 1 CHIP - Check for  Diagnostics line low
 FD41        BMI $FD46    ;If MSB Set, go to BASIC RAM INIT (normal)
 FD43        JMP $D472    ;If MSB of User Port Grounded go to Perform [ML monitor]
;
 FD46    iFD46    JMP $D3B6    ; initcz    Initialize BASIC RAM


; cint    Initialize Editor & Screen


 E000    iE000    JMP $E04B    ; Start of Editor ROM
;
;cint1


 E04B    iE04B    JSR $E60F    ; cint1 =>  Initialize I/O ;Init PIAs & VIA and do a Power-up BEEP in BASIC4


 E04E        JSR $E07A    ; Initialize CRTC --




; -    After the CRTC is initialized, Clear the Screen


 E051    iE051    LDX $E0        ; 3+4.40: Screen Line Link Table / Editor Temps
 E053        DEX
 E054    iE054    INX
 E055        JSR $E06C
 E058        JSR $E1C1    ; -    Clear Screen Line
 E05B        CPX $E1        ; 4.80: last line of window
 E05D        BCC $E054
 E05F    iE05F    LDX $E0        ; 3+4.40: Screen Line Link Table / Editor Temps
 E061        STX $D8        ; Current Cursor Physical Line Number
 E063    iE063    LDY $E2        ; 4.80: first column of window
 E065        STY $C6        ; Cursor Column on Current Line




; -    Set Screen Pointers


 E067    iE067    LDX $D8        ; Current Cursor Physical Line Number
 E069        JMP $E06F


 E06C    iE06C    LDY $E2        ; 4.80: first column of window
 E06E        DEY
 E06F    iE06F    LDA $E755,X    ; -    Screen Line Addresses LO        DATA
 E072        STA $C4        ; Pointer: Current Screen Line Address
 E074        LDA $E76E,X    ; -    Screen Line Addresses HI        DATA
 E077        STA $C5
 E079        RTS




; Initialize CRTC --


 E07A    iE07A    LDA #$2A
 E07C        LDX #$E7
 E07E        LDY #$0E
 E080        BNE $E088




; Initialize CRTC --


 E082    iE082    LDA #$3C    ;E73C has video setup data constants
 E084        LDX #$E7
 E086        LDY #$0C
 E088    iE088    STA $C7        ; Pointer: Tape Buffer/ Screen Scrolling
 E08A        STX $C8
 E08C        LDA $E84C
 E08F        AND #$F0
 E091        STA $D1        ; Length of Current File Name
 E093        TYA
 E094        ORA $D1        ; Length of Current File Name
 E096        STA $E84C
 E099        LDY #$11
 E09B    iE09B    LDA ($C7),Y    ; Pointer: Tape Buffer/ Screen Scrolling
 E09D        STY $E880    ; 6545/6845 CRT                    CHIP
 E0A0        STA $E881
 E0A3        DEY
 E0A4        BPL $E09B
 E0A6        RTS
;
; initcz    Initialize BASIC RAM - MAIN INIT
;
 D3B6    iD3B6    LDX #$FB
 D3B8        TXS        ;transfer X to Stack Pointer to init
 D3B9        LDA #$4C
 D3BB        STA $51
 D3BD        STA $00        ; USR Function Jump Instr (4C)
 D3BF        LDA #$73
 D3C1        LDY #$C3
 D3C3        STA $01        ; USR Address [4: C373]
 D3C5        STY $02
 D3C7        LDX #$1C
 D3C9    iD3C9    LDA $D398,X    ; load constants in 6F
 D3CC        STA $6F,X
 D3CE        DEX
 D3CF        BNE $D3C9
 D3D1        LDA #$03
 D3D3        STA $50
 D3D5        TXA        ; Transfer X register to ACC should have zero
 D3D6        STA $65        ; Floating -accum. #1: Overflow Digit
 D3D8        STA $10        ; 3: width of source (unused - from TTY)
 D3DA        STA $15
 D3DC        STA $0D        ; 3: Flag to suppress PRINT or PRINT# when -ve
 D3DE        PHA        ; push ACC to stack s/b zero
 D3DF        INX        ; increment x register
 D3E0        STX $01FD    ; store X to 01FD
 D3E3        STX $01FC    ; store X to 01FC
 D3E6        LDX #$16        ; load X with 16
 D3E8        STX $13        ; Pointer Temporary String
 D3EA        LDY #$04        ; Initialize Y register to 04 as hi byte address
 D3EC        STA $28        ; Pointer: Start of BASIC Text [0401]
 D3EE        STY $29
 D3F0        STA $11        ; Temp: Integer Value start at 00
 D3F2        STY $12        ;starts at 04
 D3F4        TAY        ;transfer acc to Y register (clear)
 D3F5        LDA #$80
 D3F7        BNE $D400    ;always go to Memory Test at $D400
 D3F9        LDA #$00
 D3FB        LDY #$B0
 D3FD        JMP $D41B
;
;Memory Test
;
 D400    iD400    INC $11    ; Start Memory test loop by increment of low byte address from init address $0400
 D402        BNE $D408    ; If not zero, continue to D408
 D404        INC $12    ; If zero, bump high byte address which was initialized to 04
 D406        BMI $D417    ; Branch when hi byte hits $80 (32K) to initms Output Power-Up Message
 D408    iD408    LDA #$55    ; Load $55 test pattern into ACC
 D40A        STA ($11),Y    ; Store test pattern into memory indirectly addressed by location 11 & 12
                ; Y register will always stay at zero in this loop  
 D40C        CMP ($11),Y    ; Compare Memory contents with ACC
 D40E        BNE $D417    ; If not equal, branch to 'Output Power-Up Message' with current RAM address in 11 & 12
 D410        ASL        ; Shift ACC left to get $AA test pattern
 D411        STA ($11),Y    ; Store test pattern into memory indirectly addressed by location 11 & 12 
 D413        CMP ($11),Y    ; Compare Memory contents with ACC
 D415        BEQ $D400    ; If Pass, go back to start of memory test loop to increment address
                ; If Fail, drop to initms with current RAM address in memory location 11 & 12
;
; initms    Output Power-Up Message
;
 D417    iD417    LDA $11        ; Load Low Byte Memory Count
 D419        LDY $12        ; Load High Byte Memory Count
 D41B    iD41B    STA $34        ; Pointer: Highest Address Used by BASIC
 D41D        STY $35
 D41F        STA $30        ; Pointer: Bottom of String Storage
 D421        STY $31
 D423        LDY #$00
 D425        TYA        ; Clear ACC
 D426        STA ($28),Y    ; Pointer: Start of BASIC Text [0401]
 D428        INC $28        ; Pointer: Start of BASIC Text [0401]
 D42A        LDA #$A4
 D42C        LDY #$DE
 D42E        JSR $BB1D    ; strout    Output String ###COMMODORE BASIC 4###
 D431        LDA $34        ; Pointer: Highest Address Used by BASIC
 D433        SEC
 D434        SBC $28        ; Pointer: Start of BASIC Text [0401]
 D436        TAX
 D437        LDA $35
 D439        SBC $29
 D43B        JSR $CF83    ;calc free memory and print on screen???
 D43E        LDA #$4B
 D440        LDY #$D4
 D442        JSR $BB1D    ; strout    Output String "bytes free"
 D445        JSR $B5D4
 D448        JMP $B3FF    ; ready    Restart BASIC




; words    Power-Up Message for old PET not used        DATA


 D44B        .byte 20 42 59 54 45 53 20 46  ; bytes f
 D453        .byte 52 45 45 0D 00 23 23 23  ;ree..###
 D45B        .byte 20 43 4F 4D 4D 4F 44 4F  ; commodo
 D463        .byte 52 45 20 42 41 53 49 43  ;re basic
 D46B        .byte 20 23 23 23 0D 0D 00     ; ###...


;
========================================================




;Initialize I/O


; cint1    Initialize I/O


 E60F    iE60F    LDA #$7F
 E611        STA $E84E
 E614        LDX #$6D
 E616        LDA #$00
 E618        STA $E8        ; 4.80: Home Count
 E61A        STA $E4        ; 4.80: Flag: REPEAT Key Used, $80 = Repeat, $40 = disable
 E61C    iE61C    STA $8D,X    ; Real-Time Jiffy Clock (approx) 1/60 Sec
 E61E        DEX
 E61F        BPL $E61C
 E621        LDA #$55
 E623        STA $90        ; Vector: Hardware Interrupt [3: E62E, 4: E455]
 E625        LDA #$E4
 E627        STA $91
 E629        LDA #$09
 E62B        STA $E3        ; 4.80: Size of Keyboard Buffer
 E62D        LDA #$03
 E62F        STA $B0        ; Default Output (CMD) Device (3)
 E631        LDA #$0F
 E633        STA $E810    ; PIA 1                        CHIP
 E636        ASL
 E637        STA $E840    ; VIA                        CHIP
 E63A        STA $E842
 E63D        STX $E822
 E640        STX $E845
 E643        LDA #$3D
 E645        STA $E813
 E648        BIT $E812
 E64B        LDA #$3C
 E64D        STA $E821
 E650        STA $E823
 E653        STA $E811
 E656        STX $E822
 E659        LDA #$0E
 E65B        STA $A8        ; Timer: Countdown to Toggle Cursor
 E65D        STA $A7        ; Cursor Blink enable: 0 = Flash Cursor
 E65F        STA $E6        ; 4.80: Repeat Delay Counter
 E661        STA $E5        ; 4.80: Repeat Speed Counter
 E663        STA $E84E
 E666        JSR $E1D2    ; Exit Window
 E669        LDX #$0C
 E66B        LDA #$00
 E66D    iE66D    STA $03EE,X    ; 4.80: Table of 80 bits to set TABs
 E670        DEX
 E671        BPL $E66D
 E673        LDA #$1D
 E675        LDX #$E1
 E677        STA $E9        ; 4.80: input from screen vector (from E006)
 E679        STX $EA
 E67B        LDA #$0C
 E67D        LDX #$E2
 E67F        STA $EB        ; 4.80: print to screen vector (from E009)
 E681        STX $EC
 E683        LDA #$10
 E685        STA $E7        ; 4.80: Chime Time; Power up BEEP for 8032??


 E687        JSR $E6A4
 E68A        BEQ $E6A4
 E68C    iE68C    JSR $E202    ; -    Output to Screen
 E68F        TAX
 E690        LDA $D5        ; Physical Screen Line Length
 E692        SEC
 E693        SBC $C6        ; Cursor Column on Current Line
 E695        CMP #$05
 E697        BNE $E6D0
 E699        TXA
 E69A        CMP #$1D
 E69C        BEQ $E6A4
 E69E        AND #$7F
 E6A0        CMP #$20
 E6A2        BCC $E6D0
 E6A4    iE6A4    JSR $E6A7    ; ?




; ?


 E6A7    iE6A7    LDY $E7        ; 4.80: Chime Time;    Power up BEEP for 8032??
 E6A9        BEQ $E6D0
 E6AB        LDA #$10
 E6AD        STA $E84B
 E6B0        LDA #$0F
 E6B2        STA $E84A
 E6B5        LDX #$07
 E6B7    iE6B7    LDA $E74D,X    ; Timer 2 LO Values            DATA
 E6BA        STA $E848
 E6BD        LDA $E7        ; 4.80: Chime Time; Power up BEEP for 8032??


 E6BF    iE6BF    DEY
 E6C0        BNE $E6BF
 E6C2        SEC
 E6C3        SBC #$01
 E6C5        BNE $E6BF
 E6C7        DEX
 E6C8        BNE $E6B7
 E6CA        STX $E84A
 E6CD        STX $E84B
 E6D0    sE6D0    RTS
 
I can see

1 It's not getting to D3B6 at all
2 At FD3D it enables interrupts. Immediately it calls the interrupt handler.
3 On return, executes one instruction at FD3E. Then gets interrupted again.
4 Never gets back to execute FD43 (which would put it into the monitor if the diagnostic line was low).

So. I think what we're seeing is a continual spurious interrupt condition...
 
...and sure enough, IRQ is stuck low. I can see it on the Zicon and also at the output of UB16 (the 6520). At this moment I am not sure if there is a short to ground somewhere or the 6520 is playing up. How to diagnose it without removing it? There is a spare in my 4032 (I mean, a socketed known working one I could use for testing) but it's soldered to the 4032's board. 40 pins... ouch! Even with my kit I would expect a few broken legs / tracks / pads taking it out. So I would like to be sure it is the problem before removing it. I suppose piggy-backing is unlikely to work on such a monster..
 
Hmm, there is a component on the board labelled L2 which is near the 6520 and it looks burned out. The trace underneath it is scorched. I would be surprised if it wasn't open circuit. What's it for?

Edit: Fixed it, but IRQ still stuck low. :(
 
Last edited:
In order to bypass the IRQ problem, I shorted the pullup resistor R14 so IRQ is always high.

The result looks like it has gone into the M/C monitor. The screen is showing a typical monitor display.

image.jpg

However, it's not responding to the keyboard (is that interrupt driven? I guess so!)

At least it proves the video circuits and RAM are working! The picture is very crisp on this new tube too.

So we are back to diagnosing the 6520. I am assuming that it's not a short to earth otherwise all smokin' hell would have been unleashed by this R14 trick (would effectively be shorting the 5v rail out).

How to proceed?
 
Last edited:
On the 6520, CA1 and CA2 are stuck high. CB1 and CB2 don't appear to have a signal. These seem to be fed by UA20, a MC3446 quad bus transceiver. It's not inconceivable that this is causing the issue.

Edit. I disconnected the power only to UA20 and I can now see that CA2 is still high. CA1 is NC. Since CA2 is connected only to UA20 pin 11 I have to suspect a short to +5v on that line.

Edit #2: I checked the line and it seems clean. No short to +5v (and checked with a meter too). Disconnected UA20 Pin 11 and it is still stuck at 5v. I am thinking it is the 6820 but it seems odd for it to be putting +5v out on CA2 except that the datasheet seems to be saying it is a bidirectional line; so if failed, it may well be stuck high internally and thus showing on the output pin.

In other words, it's looking like I will need to swap out the 6520. Unless... anyone?
 
Last edited:
More confusion.

CA2 is feeding this pin 11 of the transceiver and it's labelled as an active low output called "/NDAC OUT", so it could be that CA2 being high is correct... That, gentlemen, is what we call a red herring... :evil:
 
Forgive the ignorance if this is totally out of context (I have no experience with Commodore systems)......

Is there any way of determining which interrupt is being held? Obviously the IRQ line is being held low so the machine goes into the interrupt handler etc; but is there a way to determine what the CPU things the interrupt is? This might help you narrow down what is failing.

For a poor example it might be that your keyboard is interrupt driven and the fault lies with its logic; or something as simple as a key stuck down.
 
Unplug the keyboard, and you can eliminate stuck keys.

Even stuck keys will not prevent the system from booting though, I think.

I had the exact same problem and what I ended up finding was INIT being stuck low, but I never figured out why, I just shorted the pullup resistor and it's that way still.
 
In other words, it's looking like I will need to swap out the 6520. Unless... anyone?

The PIA#1 (G8 ) is the only device programmed to issue an Interrupt Request. It does so every 60 Hz (16.66 mS) when the SYNC signal (Video On) pulses at the CB1 input (pin18 ). Hold /RES down to see if /IRQ is released. If so, it may get stuck low due to faulty 6520. The interrupt routine does the keyboard scan, increments the jiffy clock, blinks the cursor, etc.
 
Last edited:
Back
Top