Loading ...
Sorry, an error occurred while loading the content.

2464Re: [Altair Computer Club] Patches to Run Altair BASIC on Z-80

Expand Messages
  • D. Hugh Redelmeier
    Jun 10, 2011
      | From: toml_12953 <tlake@...>
      |
      | Does anyone here remember the patches necessary to run the various
      | versions of Altair BASIC (4K, 8K and Extended - ver 4.0 and later) on a
      | Z-80? They involve the Status byte after certain arithmetic operations.
      | When I replace my 8080A CPU card with a Z-80 card, I can't assign a
      | value to single precision variables. Ex:

      I don't have it at hand.

      The theory is explained in:
      <ftp://computer-refuge.org/bitsavers/1401/simh_v2.9/AltairZ80/altairZ80.txt>

      The 8080 has a status bit for "parity" of the last thing that went
      through the ALU.

      The Z80 uses the same status bit for "overflow" for arithmetic
      instructions and parity for logical instruction.

      Gates (or Allen) probably saved an instruction by using the parity status
      after an arithmetic instruction.

      (This is from my non-parity-checked memory, so it could be wrong.)

      I imagine that a day of work would be all it would take to rediscover
      the fix.

      Being lazy, I'd instrument SIMH to find where execution diverged under
      the two processors. Or I'd just scan for opcode JPO, JPE, CPO, CPE,
      RPO, or RPE in the code. The first two are way more likely than the
      others.

      There seem to be two JPO instructions in this code:
      <http://www.interact-sw.co.uk/altair/math_dis_10.htm>

      These are involved with printing numbers. So they might explain the wrong
      number being printed but they don't explain the for loop not terminating.

      They both involve testing the result of FCompare. The Z80 and 8080 might
      set the parity/overflow bit differently on the paths through SignToInt.
      <http://www.interact-sw.co.uk/altair/math_dis_5.htm#SignToInt>
      I think that only gets called when one of the operands is zero.

      | You type: A=5:PRINT A
      |
      | Altair prints 0, should print 5
      |
      | You type FOR I=1 TO 10:PRINT I;:NEXT I
      |
      | Altair prints
      |
      | 0 0 0 0 0 0 0 0 0 ....
      |
      | Loop never ends since I is never incremented.
      |
      | Please help! TIA
    • Show all 2 messages in this topic