Shop OBEX P1 Docs P2 Docs Learn Events
pm85 - 8085 DRC — Parallax Forums

pm85 - 8085 DRC

pullmollpullmoll Posts: 817
edited 2011-04-23 10:34 in Propeller 1
Since the Z80 recompiling core is too big to throw an instruction exerciser at, I decided to make a stripped down 8085 only version from it. Renamed all functions to 8085ish, threw out the Z80 only opcodes and inserted the 8085 ones for them. This one should at some point run the EX8080.COM test, at least I hope it will. The pm85_demo code contains a small BDOS emulation for the functions 2 (char out) and 9 (string out), just enough to get the test going. The EX8080.COM is loaded at 100H, where also CP/M would load it. Then the code is run.

Right now it seems to be stuck forever in the initmask loop (see EX.MAC) and I have no clue why. You can see the compiler read the 3 consecutive RRC opcodes ($0f) and the surrounding code. It must be one of the more elementary opcodes that is broken in a way that prevents the initmask function from finishing its job. For some reason HL and DE point to 0 at the start, while they should point to the table in EX.MAC as far as I understood the code.

Oh, I should perhaps explain the debug output. The numbers in the columns are, from left to right:
<Z80 PC>:<opcode> <DE> <HL> <AF> <length of code snippet> <total cog longs to execute>
The 1s pause is right before each compiled output is executed.

Edit: After nailing some bugs here is version 0.0.3 for you to peek at.
0.0.2 - This also introduces an 8080 vs. 8085 compile time switch.
0.0.3 - Changed everything to byte sized registers B, C, D... composing BC, DE, HL on occasion only. This saves many longs.

Juergen

PS: Thanks to Cluso99 for the fine Debug_1pinTV code.

He died at the console of hunger and thirst.
Next day he was buried. Face down, nine edge first.

Post Edited (pullmoll) : 3/11/2010 12:00:44 PM GMT

Comments

  • SapiehaSapieha Posts: 2,964
    edited 2010-03-10 18:00
    Hi pullmoll

    Sorry as I say it ¨- But it is only PM8080 not PM8085 simulation.

    To 8085 it needs some more Restart instructions.
    RST55
    RST65
    RST75

    Not mention as Intels 8085 Had some Undocumented instruction's

    Regards

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • heaterheater Posts: 3,370
    edited 2010-03-10 18:46
    Sapieha:

    Perhaps so but the EX instruction set exerciser that Pullmoll is running does not need any RST or undocumented instructions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • SapiehaSapieha Posts: 2,964
    edited 2010-03-10 19:11
    Hi heater

    I know excerciser not ned them.
    But many programs I used on 8085 need that RST instructions.
    Undocumented instructions are mostly curiosa - But much usable on this CPU in advanced programing --- NOT needed for CP/M

    Regards

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • heaterheater Posts: 3,370
    edited 2010-03-10 19:15
    True enough, the original MicroSoft 4K BASIC for Altair (pre CP/M) needs RST xx. For example.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • pullmollpullmoll Posts: 817
    edited 2010-03-10 20:04
    Sapieha said...
    Hi pullmoll

    Sorry as I say it ¨- But it is only PM8080 not PM8085 simulation.

    To 8085 it needs some more Restart instructions.
    RST55
    RST65
    RST75

    Not mention as Intels 8085 Had some Undocumented instruction's

    Regards

    I know about the differences between the 8085 and the 8080. They are rather well documented in MAME and I just introduced a compile time define to produce either a 8080 core or an 8085. The next version will contain both options. If and when interrupts come into play depends on what this core will be used for.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.
  • pullmollpullmoll Posts: 817
    edited 2010-03-10 20:09
    heater said...
    True enough, the original MicroSoft 4K BASIC for Altair (pre CP/M) needs RST xx. For example.

    There's a difference between the software RST opcodes and the 8085 multi level prioritized RST x.5 hardware interrupts. This allowed for easier fine grained hierarchy of external hardware, for example higher priority floppy disk, middle timer interrupt, and low keyboard. Further the 8085 had two serial I/O pins that could be set and read by software. The 8080 did not have such a thing.

    Well, babbling too much, back to coding [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.
  • pullmollpullmoll Posts: 817
    edited 2010-03-10 20:35
    Good god! How stupid!

    Question: what's wrong about this code to exchange HL and DE (i.e. EX DE,HL)?
    '*******************************************************
    ' eb Exchange DE with HL
    '
    i_ex_de_hl    long    (:end - $ - 1)
            xor    HL, DE
            xor    DE, HL
            xor    HL, HL
    :end
    
    


    See it? No? Me neither for some days...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-03-10 20:51
    Ok I'll be the first to show stupidy.

    XOR HL, HL will just clear HL. doesn't it ????

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • pullmollpullmoll Posts: 817
    edited 2010-03-10 21:17
    Toby Seckshund said...
    Ok I'll be the first to show stupidy.

    XOR HL, HL will just clear HL. doesn't it ????

    Yes, indeed. It should read "xor HL, DE" of course. The three lines is a nifty trick to swap 2 variables without intermediate buffer, and though it isn't strictly necessary in this case (I have temp buffer) I used it. So this happens if you want to be cooler than cool.

    LOL! See the attachment.. that was quick! This thing is playing games with me. There is more than just 1 test, stupid! smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.

    Post Edited (pullmoll) : 3/10/2010 9:25:44 PM GMT
    1024 x 768 - 212K
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-03-10 21:26
    Bits of Z80 ASM are lodged it the brain, I thought I remember that XOR A was a simple clear of A.

    About a year ago I found a camera battery charger with a 8085 in it, with a 81xx ram and I/O chip. Like an idiot I chucked it out, I never dreamt that it would handle CP/M.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • pullmollpullmoll Posts: 817
    edited 2010-03-10 21:35
    Toby Seckshund said...
    Bits of Z80 ASM are lodged it the brain, I thought I remember that XOR A was a simple clear of A.

    Exactly. And OR A was a short hand for "CLC" i.e. clear carry. They have forgotten this instruction. There's SCF to set and CCF to complement the carry, but noone would use SCF/CCF to clear the carry smile.gif
    Toby Seckshund said...
    About a year ago I found a camera battery charger with a 8085 in it, with a 81xx ram and I/O chip. Like an idiot I chucked it out, I never dreamt that it would handle CP/M.

    Haha.. perhaps some old school engineer designed the charger and decided to go with parts he knew. "Hey, what does your battery charger run?" "It runs MP/M with 6 users, all watching out for the battery level in turns around the clock."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.
  • pullmollpullmoll Posts: 817
    edited 2010-03-11 09:23
    Version 0.0.2 is in the first post. This one runs the first test of EX8080.COM with success, then dies when trying to return from the exercise subroutine (stt). I am searching for the instruction that may cause this. Possibly an instruction that modifies the stack contents (call/ret/push/pop/xthl).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.
  • heaterheater Posts: 3,370
    edited 2010-03-11 09:50
    Is this some weird interaction between the way EX uses self-modifying code and the dynamic compilation?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • pullmollpullmoll Posts: 817
    edited 2010-03-11 11:06
    heater said...
    Is this some weird interaction between the way EX uses self-modifying code and the dynamic compilation?
    No. As far as I understand the code the patching is always far from the code doing the patches. I think I have to add the FullDuplex object and log the registers to a local terminal. I saw the point when it leaves the sane execution path and jumps into the wild (somewhere at fffX), then the PC wraps back to 0 and the thing is restarted, but then it scrolled out of view too fast. No button to stop the run smile.gif

    I now wrote a variant of pm85 where the registers are 8 bit and BC, DE, HL are composed whenever they are used as 16-bit. This saves several dozen longs, because decomposing the 8 bit registers from the words is more complicated. After all the changes, this variant behaves exactly the same with regards to EX8080.COM, so I know I haven't touched the buggy opcode... also 8080 and 8085 do the same, so it's not in the 8085 only opcodes either.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    He died at the console of hunger and thirst.
    Next day he was buried. Face down, nine edge first.

    Post Edited (pullmoll) : 3/11/2010 11:11:57 AM GMT
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-04-23 10:34
    hi,
    please give some good link to start 8085........
Sign In or Register to comment.