Uncovering the Apple II's Mysterious (and Intentional) Clock Glitch

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 มิ.ย. 2024
  • The Apple II's CPU clock has jitter or a glitch. This issue is not new-it has been present since its original design in 1977! Bald Engineer uses an oscilloscope to show how often the glitch occurs and how to correlate that jitter to its source-which is useful when you are not testing 40-year-old devices.
    The device under test (DUT) in this video is the Mega IIe project. It's a fully compatible Apple IIe built around the Mega II chip.
    Watch the Mega IIe video here: • Mega IIe: First Fully ...
    Related Links: www.addohms.com/measuring-app...
    #appleii #electronics #oscilloscope
    Chapters
    00:00 Stretch, Glitch, Jitter
    00:28 Apple II Clocks
    02:44 Analog Video Signals
    04:26 Clock and Video Means Jitter
    06:20 kthxbai
    Patreon: / baldengineer
    Discord: bald.ee/discord
    Instagram: / baldengineer
    X: X.com/addohms
    Workbench Wednesdays: bald.ee/wbw
    Video produced by James Lewis (@baldengineer):
    baldengineer.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 54

  • @AddOhms
    @AddOhms  2 หลายเดือนก่อน +4

    Come discuss electronics, oscilloscopes, and retro computers in the AddOhms Discord: bald.ee/discord

    • @thermostance1815
      @thermostance1815 2 หลายเดือนก่อน

      What o scope do you use?

    • @KlodFather
      @KlodFather 2 หลายเดือนก่อน

      Which is exactly why there are man RGB and weird video formats in Arcade games of the time. They were pushing the abilities of the chips so far, that outputting NTSC or PAL was not a thing in coin cabinets. They did stay close to standards but the color and luminance information as well as the sync was sent separately to the monitor as in computer displays. Many old CRT monitors for computers make great replacement displays in arcade cabinets. This stuff was definitely Elfin Magic. (arcade and video poker tech of the 80's)

  • @ExplodingWaffle101
    @ExplodingWaffle101 2 หลายเดือนก่อน +60

    i am a simple man. i see fancy scope, i click

  • @James_Knott
    @James_Knott 2 หลายเดือนก่อน +14

    Back in the mid 70s, which is when the Apple II dates from, hardware was still expensive and designers would resort to various tricks to reduce costs. Steve W. was a genius at that.

  • @der.Schtefan
    @der.Schtefan 2 หลายเดือนก่อน +9

    Engineer? Wizard! That guy never ceases to amaze me!

    • @deang5622
      @deang5622 2 หลายเดือนก่อน

      Most electronic engineers are wizards... You'd understand why when you see how hard they work on their degree courses.

  • @makerspace533
    @makerspace533 2 หลายเดือนก่อน +5

    The idea of taking advantage of the two phase clock to run the video was ingenious.

  • @johnsonlam
    @johnsonlam 2 หลายเดือนก่อน +5

    It's really useful since I love my Apple II but too many books to read and not too easy to understand without graph and picture, thank you James.

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      You're welcome! I am considering doing more videos on the Apple II like this: showing how the hardware works. I think it's interesting to use modern test equipment to understand this clever computer.

  • @klausfortschbeck8369
    @klausfortschbeck8369 2 หลายเดือนก่อน +4

    Such cool Videos James. Keep on going:) Greetings from Germany

  • @ralphmunoz4582
    @ralphmunoz4582 2 หลายเดือนก่อน

    Wow! A complex subject and you made it easy to understand!! 😊

  • @grahamornstein
    @grahamornstein 2 หลายเดือนก่อน +3

    That scope is incredible!

    • @KlodFather
      @KlodFather 2 หลายเดือนก่อน

      Scope envy... Kinda like Tractor Envy or Truck Envy... But for NERDS ha ha

  • @edgeeffect
    @edgeeffect 2 หลายเดือนก่อน +1

    You talking about doing more videos on the Apple video system is well timed with my own "needs"... I just found out about NTSC artefacts giving more colours the other day.... and I'm still at the "what??? huh??????" stage at the moment.

  • @VideoNOLA
    @VideoNOLA 2 หลายเดือนก่อน

    The Apple ][ provided COUNTLESS hours of joy for me as a youth, in the form of learning, entertainment and comradery. I literally traveled the far corners of my hometown to copy, share, play and learn how to crack all the popular and lesser-known software titles.

  • @C3Cooper
    @C3Cooper 2 หลายเดือนก่อน +1

    I'm sure that one of your next videos will mention the time needed for the vertical transition between raster lines and the DRAM video refresh rate. Our drawing routines always had to use a raster offset tables to index the updates to the right memory. Yes, Woz is a pretty darn smart guy (as long has he isn't organizing rock festivals).

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +2

      If I wasn't already bald, I think fully understanding how (the Apple II's) DRAM refresh and sharing RAM between the CPU and Video cycles works, would get me there.

    • @C3Cooper
      @C3Cooper 2 หลายเดือนก่อน +1

      @@AddOhms Back in the 80's I worked for the company that did all of the procurement and repair for Apple systems for the school districts in the state of Minnesota (as well as software development). I've forgotten more than I remember. Between 1977 and 1990 there were huge leap-frogs of DRAM technology and speed of CRT response - this probably explains the exposed clock cycle differences that you're seeing. We saw bunches of generation revisions from the 2/2e/2c. If I remember, the speed of the electron guns going from end to the beginning of the next raster line offered window for DRAM refresh and CPU access. The vertical raster line interleave was also tied to this timing.

  • @guyejumz6936
    @guyejumz6936 2 หลายเดือนก่อน +1

    Did you find a way to disable the stretch cycle of the Mega II? I've wondered what it would be like to disable the stretch on systems which don't need it, like the IIgs.

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      No. Gemini (the follow-on to Mega-II) has a register to run PH0 at 2 MHz. However, Mega-II does not seem to support it. I wonder if that mode uses stretch.

  • @trudnai
    @trudnai 2 หลายเดือนก่อน +1

    Great video, thanks! And yes, absolutely, WOZ was (is) genius.

  • @toboldlygo
    @toboldlygo 2 หลายเดือนก่อน +2

    Great video! I have a somewhat related comment on a difference I’ve noticed between Apple II Rev 4 mobos (and earlier) and Rev 7 mobos (and later). I’ve been testing RGB cards that convert the composite signal to RGB signals and notice I only get the correct color palette on Rev 7 and later. For Rev 4 and earlier, in the RGB output red and blue colors are swapped and magenta and green are swapped. For example the castle in the Castle Wolfenstein is blue (not red) on the title splash screen on a Rev 4 Apple II using an RGB card. Reviewing schematics there certainly was an update to the video circuit in the Rev 7 but I don’t know how it would influence the color swapping in RGB. Some kind of phase shift or delay in the clock cycle perhaps. RGB cards were popularized only after the Rev 4 MoBo was replaced by Rev 7 ones. I’m keen to understand what the source of the RGB color swap is?

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน

      I don't know the Apple II revisions well enough to comment. Nor do I know how RGB cards work. (I have never looked at them.)

    • @toboldlygo
      @toboldlygo 2 หลายเดือนก่อน

      ⁠Thanks for responding! Any idea who might?

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      This project is capturing RGB video and sending it over Ethernet. Its creator might have better insight: github.com/jtflanagan/AppleTini/

    • @toboldlygo
      @toboldlygo 2 หลายเดือนก่อน

      @@AddOhms Thanks so much!

  • @wackowacko8931
    @wackowacko8931 2 หลายเดือนก่อน

    The origination of the phrase "It's not a bug (or glitch), it's a feature".
    The noisy sinusoidal wave on the top and bottom of every square wave is called Gibbs phenomena, and it is present in any square wave to a lesser or greater extent depending on how much money you spend on design. They knew how to suppress it back then in analog circuits, they probably just didn't bother. The resetting of the pulse width was likely a lazy and cheap way of fixing a problem in an effort to get the product out the door.

    • @rich1051414
      @rich1051414 2 หลายเดือนก่อน +1

      Even if you have a perfect square wave, if you low pass filter that square wave, you get the 'gibbs phenomena'. Studying Fourier transforms makes it apparent what is going on.

  • @rdson1621
    @rdson1621 2 หลายเดือนก่อน

    That scope 🤩 and KiCAD 🤩

  • @isaacwingfield4321
    @isaacwingfield4321 2 หลายเดือนก่อน +2

    That extra half line is to do interlace. One field of NTSC color video is comprised of 262.5 lines. Woz is indeed a brilliant engineer.

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +2

      I'm not sure what you mean by "extra half line." Everything I covered was related to the horizontal timing. Vertically, the Apple's video circuit only outputs for 192 of the 262 NTSC lines.

  • @raysoucie489
    @raysoucie489 2 หลายเดือนก่อน

    Subscribed

  • @saxtant
    @saxtant 2 หลายเดือนก่อน

    So, the clocks are reset on every scan line? I'm not sure how to interpret the colour clock.
    I recall that the raster lines mapped to memory with a large offset, so that in graphics mode the continuation of the next raster line in memory is halfway down the screen, cycling around to fill the entire screen.
    I wish I knew why that was necessary, as a software dev, that was quite annoying.
    I was only 12, so a lot of it was beyond me, I did write a decent assembler for 6502 though.

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +2

      No, the clocks run continuously. That's why the Stretch pulse is needed. It re-aligns the phase of the clocks for the next scan line.
      Regarding how screen lines are mapped, I am still learning that myself. However, a lot of the video memory mapping was to simplify the DRAM refresh. Great solution for hardware but it made it a nightmare for programmers!

    • @dale116dot7
      @dale116dot7 2 หลายเดือนก่อน

      The display memory skipping is needed to adhere to the memory refresh timings. The video scan was also used to read and rewrite memory lines and Steve Wozniak saved a bunch of gates and logic by scrambling the video scan addresses this way. DRAM refresh actually only requires a read cycle (pre charge or rewrite time after a read accomplished the write or refresh).

  • @RensePosthumus
    @RensePosthumus 2 หลายเดือนก่อน +4

    Did you really write those numbers in the palm of your hand? ;-)

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +4

      4:26 Maybe ...

  • @89elmonster
    @89elmonster 2 หลายเดือนก่อน

    Videos like this I wouldn’t mind if they were 20+ minutes

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน

      That’s good to know! That will probably happen with future retro/Apple topics.
      Also, this Mega IIe project video is almost 30: th-cam.com/video/gFCD4s_hsb4/w-d-xo.html

  • @ccshello1
    @ccshello1 2 หลายเดือนก่อน +2

    If you read "composite artifact colors" from that what i know place, you can find apple took advantage of the fairly loose tolerance of consumer grade analog ntsc color monitor to mimic the more stringent standard (and got away from it.)
    In reality, those numbers used in color ntsc have perfect relationships:
    - 4 times color subcarrier 3579545 Hz = 14.318 MHz, a common X'tal freq
    - field rate of 59.94 (frame rate 29.97) mimic B&W era's 60Hz
    - 59.94 x 525 /2 (525 lines per frame, 262.5 per field due to interlaced format) = 15734.25 lines/sec
    - While 3579545Hz color burst frequency divided by 15734.25 yield 227.5. Double it becomes 455, which is a product of 3 prime numbers 5x7x13. It all carefully designed to avoid aliasing and human visible artifacts.
    Call it the magic of year 1953.

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      Yup. I didn't get into Wozniak's idea of an "average" horizontal scan rate being close enough. I'd prefer to cover that in a different context. Here, I focused on the PH0 clock because during my work on the Mega IIe, I kept seeing it and never explained to myself (or anyone else) why.

    • @jnharton
      @jnharton 2 หลายเดือนก่อน +1

      The whole video signal is "fudged" if I remember correctly...

  • @raysoucie489
    @raysoucie489 2 หลายเดือนก่อน

    Let's "Re-cap"?? Good pun

  • @KyleGP
    @KyleGP 2 หลายเดือนก่อน

    When you realise that scope is worth $23K.

  • @Alpine_flo92002
    @Alpine_flo92002 2 หลายเดือนก่อน +1

    Sooo...how much is that scope...

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      About the same as any 8-channel scope in its class. A 5-digit number.

    • @Alpine_flo92002
      @Alpine_flo92002 2 หลายเดือนก่อน

      @@AddOhms To be fair...5 digit is quite a big range from "reasonable" to "selling a kidney"

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน +1

      I don't have exact pricing on it. But based on bandwidth, (maybe memory depth), channel count, and software options I saw prices from the $18k to $60k. So you're right, it's quite a big range.

    • @Alpine_flo92002
      @Alpine_flo92002 2 หลายเดือนก่อน

      @@AddOhms Yeaaahhhhh Imma stay with my Siglent SDS1104X-E. Still pissed I bought it a year early before the Rigol DHO800 and DHO900 series came out :c

    • @AddOhms
      @AddOhms  2 หลายเดือนก่อน

      Those are all great general purpose scopes.

  • @toxicore1190
    @toxicore1190 2 หลายเดือนก่อน

    until you posted a short video, your channel was shadow banned for me although I am a long time subscriber

  • @trevoro.9731
    @trevoro.9731 2 หลายเดือนก่อน

    I find the Apple one big glitch.