home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / m6809 / 587 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  2.0 KB

  1. Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!newshost!rpb
  2. From: rpb@psy.ox.ac.uk (Ray Bellis)
  3. Newsgroups: comp.sys.m6809
  4. Subject: Re: PD m6809 asm/disasm/sim
  5. Message-ID: <RPB.93Jan22121602@brain.psy.ox.ac.uk>
  6. Date: 22 Jan 93 12:16:02 GMT
  7. References: <C0v2us.3Ko@shograf.com> <RPB.93Jan16141030@brain.psy.ox.ac.uk>
  8.     <74017@cup.portal.com>
  9. Organization: Dept. of Experimental Psychology, Oxford, England.
  10. Lines: 69
  11. In-reply-to: blackbelt@cup.portal.com's message of 21 Jan 93 03:13:19 GMT
  12.  
  13. In article <74017@cup.portal.com> blackbelt@cup.portal.com (Ben - Williams) writes:
  14.  
  15.    flags &= ~(V)[D
  16.  
  17.    darn line noise... one more time
  18.  
  19.    flags &= ~(V);
  20.    flags |= vtable[(operand1 << 8)+operand2]; and you've got it.
  21.  
  22.    if you need carry, you add that too. :^)
  23.     Or, you can use two tables, based on whether you have carry or not.
  24.  
  25.    you really only need 8k of memory per table, but your effciency falls
  26.    out the window.
  27.  
  28. I'm using a function like the following to do an entire `adc' along
  29. with the `h' bit:
  30.  
  31. adc(Byte& x)
  32. {
  33.     Byte    m = fetch_operand();
  34.  
  35.     {
  36.         Byte t = (x & 0x0f) + (m & 0x0f) + cc.bit.c;
  37.         cc.bit.h = btst(t, 4);
  38.     }
  39.  
  40.     {
  41.         Byte t = (x & 0x7f) + (m & 0x7f) + cc.bit.c;
  42.         cc.bit.v = btst(t, 7);
  43.     }
  44.  
  45.     {
  46.         Word t = (Word)x + m + cc.bit.c;
  47.         cc.bit.c = btst(t, 16);
  48.         x = (Byte)t;
  49.     }
  50.  
  51.     cc.bit.v ^= cc.bit.c;        // V = Cout7 XOR Cout6
  52.     cc.bit.z = !x;
  53.     cc.bit.n = btst(x, 7);
  54. }
  55.  
  56. This works, but needs a fair bit of CPU time to calculate.  I've
  57. implemented all of the address mode decoding and now I'm in the
  58. process of writing functions like the above for every instruction.
  59.  
  60. I wrote a simple loop:
  61.  
  62. start    addb    #$01
  63.     bne    start
  64.     adda    #$01
  65.     bne    start
  66.     *halt*
  67.  
  68. and got around 450,000 `read accesses' per second on a SPARC IPX.
  69.  
  70. Ray.
  71.  
  72.  
  73.  
  74. --
  75. ------------------------------------------------------------------------------
  76. R. P. Bellis                E-Mail:    <rpb@psy.ox.ac.uk>
  77. Dept. of Experimental Psychology    Whois:    (RB83)
  78. University of Oxford            Tel:    +44 865 271419
  79. South Parks Road            Fax:    +44 865 310447
  80. Oxford OX1 3UD
  81. ------------------------------------------------------------------------------
  82.