6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 20, 2024 11:53 am

All times are UTC




Post new topic Reply to topic  [ 544 posts ]  Go to page Previous  1 ... 26, 27, 28, 29, 30, 31, 32 ... 37  Next
Author Message
 Post subject: Re: POC VERSION TWO
PostPosted: Thu Nov 16, 2017 9:38 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
I've looked to try and see how Commodore did it, but never found anything that really focused on it or how it worked. In my minor searches I didn't see anything glaring that suggested it was as orthogonal as what CIO does.


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 24, 2017 8:09 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
A little more progress. I've got interrupt-driven serial I/O working and can print the POST banner to the console.
Attachment:
File comment: POC V2.1 Banner Display
poc_v2_serial_test01.gif
poc_v2_serial_test01.gif [ 5.07 MiB | Viewed 2115 times ]
Attachment:
File comment: POC V2.1 Banner Display Closeup
poc_v2_serial_test02.gif
poc_v2_serial_test02.gif [ 3.06 MiB | Viewed 2115 times ]

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Fri Nov 24, 2017 8:28 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Looking good!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Fri Nov 24, 2017 8:44 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BigEd wrote:
Looking good!

Thanks!

BTW, I/O works on serial channels A, C and D at 115.2 Kbps. I brutalized the unit by writing a short program that was driving channels C and D at the same time, filling the screens with test phrases that were unique to each channel. It was interesting watching the /IRQ circuit while that was going on. :shock: I haven't tried driving A, C and D simultaneously because I only have two terminals with which to test.

I won't be able to test channel B until the firmware is finished, as that channel is wired to interconnect to one of my Linux boxes for software transfer. Much of the firmware can be "imported" from POC V1, with changes to adapt to POC V2's architecture. I'm particularly eager to see how the monitor will work with all that additional RAM.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Fri Nov 24, 2017 9:27 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1382
Congrats on getting POCV2 operational, very nice!

I've been using the FTDI Serial to USB adapters for several years now. Within a Windows 7 VM (yea, using the WDC Tools code and ExtraPutty) I've had 3 terminal windows active concurrently running tests simultaneously for weeks at a time.

My next SBC will have multiple UART channels... hopefully not another 3 years in the making.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Fri Nov 24, 2017 3:55 pm 
Offline
User avatar

Joined: Sun Oct 18, 2015 11:02 pm
Posts: 428
Location: Toronto, ON
Nice to see serial I/O working BDD.

I use an FTDI adapter as well, but I must say, nothing like the glow of a real terminal to take you back (especially for a console). :)

_________________
C74-6502 Website: https://c74project.com


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Fri Nov 24, 2017 8:56 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
Drass wrote:
Nice to see serial I/O working BDD.

Thanks! After the debacle with POC V2.0 (which I someday will make operational, once I figure out the mysteries of the SC28C94's interrupt features) I feel like I'm making some headway.

Quote:
I use an FTDI adapter as well, but I must say, nothing like the glow of a real terminal to take you back (especially for a console). :)

I have a little project that has been patiently waiting for me. It's a version of Geoff Graham's ASCII VT100 terminal, which I hope to eventually incorporate into POC V3. The project will make the terminal an add-on to POC V2, which has circuitry already in place to support the terminal's operation. Once I get it built I should be able to work out any hardware kinks, plus develop a VT100 driver to replace the WY60 driver current in use. Assuming I integrate the terminal into POC V3's design, all that would be needed to have a working console would be to connect a standard PS/2 keyboard and VGA monitor. In other words, POC V3 would be a true stand-alone computer.

Incidentally, Geoff's VT100 gadget also supports USB, which could be useful to some here. I have no interest in USB, so I'm just going to leave out that part of it. Geoff also makes the source code for the terminal's PIC microcontroller, so mods to the terminal emulation are theoretically possible.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Tue Nov 28, 2017 8:15 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
Hmm...I seem to have a problem with V2.1's programmable logic. The function that maps out ROM and exposes RAM at the same address is not working as it should. The test was to "shadow" ROM at $00E000 into RAM at the same address. The logic is supposed to automatically direct a write on an address where ROM is exposed into the RAM at the same address, a feature that I had verified in POC V2.0. In 2.1, shadowing fails and if the HMU (hardware management unit) is told to map out ROM in the $00E000 range and expose RAM, the machine crashes. The CUPL code that I developed for the CPLD correctly simulates and if I read the CPLD after programming, it exactly matches the JEDEC fuse map from which it was programmed. 'Tis a strange problem.

Code:
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                                 *
*                 W65C816S PROOF OF CONCEPT SINGLE-BOARD COMPUTER                 *
*                                                                                 *
* =============================================================================== *
*                                                                                 *
*     Copyright (c)1991-2017 by BCS Technology Limited.  All rights reserved.     *
*                                                                                 *
* Permission is hereby granted to use, copy, modify and distribute this software, *
* provided this copyright notice remains unaltered in the source code and  proper *
* attribution is given.  Redistribution, in any form, must be at no charge to the *
* end user.  This code or any part  thereof, including any derivation, MAY NOT be *
* incorporated into any package intended for sale unless written permission to do *
* so has been granted by the copyright holder.                                    *
* ------------------------------------------------------------------------------- *
* THERE IS NO WARRANTY OF ANY KIND WITH THIS SOFTWARE.                            *
*                                                                                 *
* While it is believed that all code will perform as intended,  the user  assumes *
* all risk in connection with the incorporation of this software into any system. *
*                                                                                 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

* * * * * * * * * *
* VERSION HISTORY *
* * * * * * * * * *

Ver    Rev Date    Revision
--------------------------------------------------------------------------------
1.0.0  2014/11/25  Original version.
1.1.0  2016/08/16  Added D-block RAM decoding & HIRAM write protection.
1.2.0  2017/02/19  Added another I/O chip select.  Removed inverted reset
                   logic & renamed RST pin to IO5.  This version is for use with
                   POC V2.1 & is incompatible with POC V2.0.
--------------------------------------------------------------------------------
*/

Name        glue;
PartNo      B402170001;
Date        2017/02/19;
Revision    1.2.0;
Designer    BDD;
Company     BCS Technology Limited;
Assembly    POC V2.1;
Location    U3;
Device      f1504ispplcc44;

/*
                           R     P
                     V  A  E  R  H  G  A  A
            D  D  D  C  1  S  W  I  N  1  1
            1  2  3  C  5  B  B  2  D  4  3
         ____________________________________
        /   6  5  4  3  2  1 44 43 42 41 40  \
   TDI |  7                                39 | A12
    D0 |  8                                38 | TDO
   IO0 |  9                                37 | A11
   GND | 10                                36 | A10
   IO2 | 11                                35 | VCC
   IO3 | 12            ATF1504             34 | A9
   TMS | 13          44-Lead PLCC          33 | A8
   ROM | 14                                32 | TCK
   VCC | 15                                31 | STP
   IO1 | 16                                30 | GND
   IO5 | 17                                29 | RAM0
       |   18 19 20 21 22 23 24 25 26 27 28   |
        \____________________________________/
            I  W  R  R  G  V  V  V  A  A  A
            O  D  D  A  N  C  D  P  1  1  1
            4        M  D  C  A  A  6  8  7
                     1
*/

property   atmel {cascade_logic=off};
property   atmel {fast_inlatch=on};
property   atmel {logic_doubling=off};
property   atmel {output_fast=on};
property   atmel {pin_keep=off};
property   atmel {preassign=keep};
property   atmel {security=off};
property   atmel {xor_synthesis=on};
property   atmel {err_file=glue.err};

/*
===============
PIN ASSIGNMENTS
===============
*/
pin    33 = A8;                                   /* address line          */
pin    34 = A9;                                   /* address line          */
pin    36 = A10;                                  /* address line          */
pin    37 = A11;                                  /* address line          */
pin    39 = A12;                                  /* address line          */
pin    40 = A13;                                  /* address line          */
pin    41 = A14;                                  /* address line          */
pin     2 = A15;                                  /* address line          */
pin    26 = A16;                                  /* address line          */
pin    28 = A17;                                  /* address line          */
pin    27 = A18;                                  /* address line          */
pin     8 = D0;                                   /* data line             */
pin     6 = D1;                                   /* data line             */
pin     5 = D2;                                   /* data line             */
pin     4 = D3;                                   /* data line             */
pin     9 = !IO0;                                 /* I/O device 'A' select */
pin    16 = !IO1;                                 /* I/O device 'B' select */
pin    11 = !IO2;                                 /* I/O device 'C' select */
pin    12 = !IO3;                                 /* I/O device 'D' select */
pin    18 = !IO4;                                 /* I/O device 'E' select */
pin    17 = !IO5;                                 /* I/O device 'F' select */
pin    43 = PHI2;                                 /* system clock          */
pin    29 = !RAM0;                                /* RAM chip select       */
pin    21 = !RAM1;                                /* RAM chip select       */
pin    20 = !RD;                                  /* read data             */
pin     1 = RESB;                                 /* system reset          */
pin    14 = !ROM;                                 /* ROM chip select       */
pin    44 = RWB;                                  /* read/write            */
pin    31 = STP;                                  /* wait-state control    */
pin    24 = VDA;                                  /* valid data address    */
pin    25 = VPA;                                  /* valid program address */
pin    19 = !WD;                                  /* write data            */

/*
==========================================================
MACHINE ARCHITECTURE & HARDWARE MANAGEMENT UNIT DEFINTIONS
==========================================================

           +--------------------------+ $0FFFFF
           |                          |
           |                          |
           |  Extended RAM  (960 KB)  |
           |                          |
           |                          |
   +-------+--------------------------+ $010000
   |       |                          |
   | HIRAM |       HIROM (8 KB)       |
   |       |                          |
   +-------+--------------------------+ $00E000
           |                          |
           | Hardware Management Unit |
           |                          |
           +--------------------------+ $00DF00
           |                          |
           |      D8RAM (1.75 KB)     |
           |                          |
   +-------+--------------------------+ $00D800
   |       |                          |
   | IORAM |       IODEV (2 KB)       |
   |       |                          |
   +-------+--------------------------+ $00D000
   |       |                          |
   | LOROM |       LORAM (4 KB)       |
   |       |                          |
   +-------+--------------------------+ $00C000
           |                          |
           |      BASRAM (48 KB)      |
           |                          |
           +--------------------------+ $000000

                1 KB = 1024 bytes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  HMU
Register   Address   Register Description   Type  Bit  Function
------------------------------------------------------------------------------------------
hmumcfg    $00DF00   System configuration:   R/W   0   0: RAM at $00C000-$00CFFF (default)
                                                       1: ROM at $00C000-$00CFFF
                                                   1   0: ROM at $00E000-$00FFFF (default)
                                                       1: RAM at $00E000-$00FFFF
                                                   2   0: I/O at $00D000-$00D7FF (default)
                                                       1: RAM at $00D000-$00D7FF
                                                   3   0: HIRAM write-enabled    (default)
                                                       1: HIRAM write-protected
------------------------------------------------------------------------------------------
Notes:  1) Writing to ROM "bleeds through" to RAM at same address.  This behavior will be
           inhibited when writing to HIROM if HIRAM has been write-protected.
        2) The HMU itself is read/write & cannot be mapped out.
*/

$DEFINE   cblkmap   hmumcfg0                      /* LORAM/LOROM control */
$DEFINE   eblkmap   hmumcfg1                      /* HIROM/HIRAM control */
$DEFINE   dblkmap   hmumcfg2                      /* IODEV/IORAM control */
$DEFINE   eblkctl   hmumcfg3                      /* HIRAM write control */

/*
================
NODE ASSIGNMENTS
================
*/
pinnode   = [blatch0..3];                         /* bank address latches                 */
pinnode   = [hmumcfg0..3];                        /* hardware management unit latches     */
pinnode   = [wsff0..1]                            /* wait-state generator flip-flops      */

pinnode   = bank0;                                /* 1 = address is $000000-$00FFFF       */
pinnode   = basram;                               /* 1 = address is $000000-$00BFFF       */
pinnode   = bavalid;                              /* 1 = bank address valid               */
pinnode   = cblk;                                 /* 1 = address is $00C000-$00CFFF       */
pinnode   = dblk;                                 /* 1 = address is $00D000-$00DFFF       */
pinnode   = eblk;                                 /* 1 = address is $00E000-$00FFFF       */
pinnode   = extram;                               /* 1 = address is $010000-$07FFFF       */
pinnode   = hmusel;                               /* 1 = HMU being accessed               */
pinnode   = hiramwp;                              /* 1 = HIRAM write-protected            */
pinnode   = ioblk;                                /* 1 = I/O address space being accessed */
pinnode   = iosel;                                /* 1 = I/O device selected              */
pinnode   = mcfgsel;                              /* 1 = HMU configuration being accessed */
pinnode   = ramsel;                               /* 1 = RAM selected                     */
pinnode   = rhflag;                               /* 1 = data fetch on high clock         */
pinnode   = romsel;                               /* 1 = ROM selected                     */
pinnode   = wsext;                                /* 1 = hold bus & control states        */
pinnode   = vab;                                  /* 1 = address bus valid                */
pinnode   = wdflag;                               /* 1 = data store                       */
pinnode   = whflag;                               /* 1 = data store on high clock         */
pinnode   = wsflag;                               /* 1 = wait-state required              */

/*
===================
RESETS, CLOCKS, ETC
===================
*/
$REPEAT i = [0..3]
    hmumcfg{i}.AR = !RESB;
$REPEND
$REPEAT i = [0..1]
    wsff{i}.CK = PHI2;
$REPEND

/*
==========================
INTERMEDIATE CONTROL LOGIC
==========================
*/
vab        = VDA # VPA;                           /* true if valid address       */
bavalid    = vab & !PHI2;                         /* true if bank address valid  */
rhflag     = RWB & PHI2;                          /* true if fetch on high clock */
wdflag     = !RWB;                                /* true if store               */
whflag     = !RWB & PHI2;                         /* true if store on high clock */

/*
======================
A16-A19 LATCHING LOGIC
======================
*/
[blatch0..3].LE = bavalid & !wsext;               /* open latches, unless in wait-state */
[blatch0..3].L  = [D0..3] & bavalid & !wsext;     /* capture bank, unless in wait-state */
bank0     = [blatch0..3]:'b'0000;                 /* true if bank = $00                 */
extram    = !bank0;                               /* true if bank > $00                 */

/*
======================
MEMORY MAP BASIC LOGIC
======================
*/
basram    = bank0 & !(A15 & A14);                 /* $000000-$00BFFF */
cblk      = bank0 & A15 & A14 & !A13 & !A12;      /* $00C000-$00CFFF */
dblk      = bank0 & A15 & A14 & !A13 & A12;       /* $00D000-$00DFFF */
eblk      = bank0 & A15 & A14 & A13;              /* $00E000-$00FFFF */

ioblk     = dblk & !A11;                          /* $00D000-$00D7FF */
d8ram     = dblk & A11 & !(A10 & A9 & A8);        /* $00D800-$00DEFF */
hmu       = dblk & A11 & A10 & A9 & A8;           /* $00DF00-$00DFFF */

/*
=========================
RAM & ROM SELECTION LOGIC
=========================
*/
ramsel    = basram # (cblk & wdflag) # (cblk & !cblkmap) # (ioblk & dblkmap) # d8ram # (eblk & wdflag) # (eblk & eblkmap) # extram;
romsel    = (cblk & cblkmap & RWB) # (eblk & !eblkmap & RWB);
ram0sel   = !blatch3 & ramsel;
ram1sel   = blatch3 & ramsel;
hiramwp   = ram0sel & eblk & eblkctl;             /* true if HIRAM is write protected */

/*
===========================
I/O DEVICES SELECTION LOGIC
===========================
*/
iosel     = vab & ioblk & !dblkmap;               /* $00D0xx-$00DExx if mapped */

/*
================
WAIT-STATE LOGIC
================
*/
wsflag    = iosel # romsel;                       /* wait-state if I/O or ROM selected   */
wsff0.AR  = !wsflag;                              /* reset when wait-state initiated     */
wsff1.AP  = !wsflag;                              /* start low when wait-state initiated */
wsff1.D   = wsff0;                                /* chain                               */
wsff0.D   = !wsff1;                               /* feedback                            */
wsext     = PHI2 # !wsff1;                        /* 1 = wait-state in progress          */

/*
=========================
CONTROL OUTPUT STATEMENTS
=========================
*/
[A16..18] = [blatch0..2] & vab;                   /* A16-A18 address bits                */
IO0       = iosel & !A10 & !A9 & !A8;             /* I/O device 'A' select               */
IO1       = iosel & !A10 & !A9 &  A8;             /* I/O device 'B' select               */
IO2       = iosel & !A10 &  A9 & !A8;             /* I/O device 'C' select               */
IO3       = iosel & !A10 &  A9 &  A8;             /* I/O device 'D' select               */
IO4       = iosel &  A10 & !A9 & !A8;             /* I/O device 'E' select               */
IO5       = iosel &  A10 & !A9 &  A8;             /* I/O device 'F' select               */
RAM0      = ram0sel & vab;                        /* RAM0 chip enable                    */
RAM1      = ram1sel & vab;                        /* RAM1 chip enable                    */
RD        = RWB & wsext & vab;                    /* read data                           */
STP       = wsff1;                                /* MPU wait-state input                */
STP.oe    = wsflag;                               /* active if wait-stating              */
ROM       = romsel;                               /* ROM chip enable                     */
WD        = wdflag & wsext & vab & !hiramwp;      /* write data to unprotected RAM & I/O */

/*
==================================
HMU REGISTER READ/WRITE STATEMENTS
==================================
*/
[D0..3].oe       = hmu & rhflag;                  /* enable output on D0-D3   */
[D0..3]          = hmu & [hmumcfg0..3] & rhflag;  /* HMU bit pattern on D0-D3 */

[hmumcfg0..3].LE = hmu & whflag;                  /* open HMU latches         */
[hmumcfg0..3].L  = hmu & [D0..3] & whflag;        /* D0-D3 bit pattern on HMU */
                   
/* * * * *   E N D   O F   F I L E   * * * * */

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 02, 2017 9:09 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
You may recall I couldn't seem to get interrupt-driven serial I/O working with POC V2.0 and decided to shelve V2.0 and take off in another direction. This wasn't to say that I hadn't continued to think about why V2.0 was being so obdurate. A few months ago, I had finally figured out the mysteries of the 28C94's interrupt "bidding" system, which is inadequately documented in the QUART's data sheet. What was helpful was reading the data sheet for the SC28L194, which is also a QUART with interrupt bidding. The description is more lucid and helped me "connect the dots."

As I have a significant hardware bug in V2.1 that is doing a good job of being elusive, I decided to set that unit aside for a while (usually a period of "inattention" results in me figuring out the problem) and see if I could get interrupt-driven serial I/O (SIO) working on POC V2.0. I was confident that I finally understood the QUART's interrupt bidding setup well enough to make it work. Yet I still couldn't get things going. As soon as a write to the console channel (channel A in the QUART) occurred, /IRQ would go low and stay there, and the machine would crash. Clearly the MPU wasn't able to service the IRQ, and I knew to a certainty at this point that the hardware itself was working as designed. It had to be something else that I was overlooking. The solution was to be found by examining the SIO driver code for POC V1.1, which had been used as a test bed to prove the theory behind my "vectored" driver that could be scaled to as many SIO channels as could be built into a system.

The vectored driver consists of a set of foreground routines for sending and receiving datums, and a interrupt handler for driving the UART. As there are multiple channels to process, there is a set of direct (zero) page pointers that point to the relevant chip registers and the circular FIFOs (CFIFOs) maintained in RAM for temporarily holding incoming and outgoing datums. Registers and CFIFOs are selected by passing a zero-based channel index to the driver code. Ultimately, (<dp>,X) addressing is employed to read and write registers and CFIFOs, in which the value in .X is the channel index times two. It's typical 6502 programming.

Code:
         lda <chan>          ;zero-based channel number
         asl A               ;double for offset
         tax
         lda (siosr,x)       ;get channel status

   ...do some processing based upon channel status...

         sta (sioio,x)       ;write to transmitter

   ...etc...

This technique was tested on V1.1 and V2.1, and worked without a hitch. It should have worked on POC V2.0 as well, but all sorts of bizarre things would happen when SIO was attempted.

Within the firmware is a set of tables that is used to populate the direct page pointers during POST. I don't know why, but my attention got focused on the the source code used to produce those tables and in it, I found an error that resulted in some data being transposed. Cheerfully assuming that fixing that error would fix V2.0, I copied the table code I had used in V1.1's firmware over to V2.0's source file. Following assembly, burning a ROM and flipping on the power, I was greeted with the following display on the console screen.

Attachment:
File comment: POC V2.0 POST Screen Display
pocv2.0_post_display.gif
pocv2.0_post_display.gif [ 3.62 MiB | Viewed 1988 times ]

The above proved that interrupt-driven SIO was working. Also, I have a 100 Hz jiffy IRQ running for timekeeping, which was verified by putting some gratuitous time delays into the code and determining if the delay period was about right.

So it looks as though I'm back on POC V2.0 for a while. :?

Incidentally, here is the code that generates the tables used to populate the driver's direct page pointers.

Code:
;SERIAL I/O DRIVER DIRECT PAGE POINTER SETUP TABLE
;
sioiptab =*
;
;
;   QUART register pointers...
;
.i       .set 0                ;status
         .rept n_nxpchn        ;N_NXPCHN is the number of channels
             .word io_quart+nx4sr+.i
.i           .= .i+s_nxpcsp    ;S_NXPCSP is channel "spacing" in bytes
         .endr
;
.i       .set 0                ;command
         .rept n_nxpchn
             .word io_quart+nx4cr+.i
.i           .= .i+s_nxpcsp
         .endr
;
.i       .set 0                ;RHR/THR
         .rept n_nxpchn
             .word io_quart+nx4sio+.i
.i           .= .i+s_nxpcsp
         .endr
;
.i       .set 0                ;interrupt
         .rept n_nxpcbk
             .rept n_nxpcpb
                 .word io_quart+nx4isr+.i
             .endr
.i           .= .i+s_nxpcbk
         .endr
;
;
;   circular FIFO (CFIFO) pointers...
;
.addr    .set siocfifo         ;receive CFIFO base address
         .rept n_siobix        ;N_SIOBIX is number of indices per CFIFO
.i           .set 0
             .rept n_nxpchn
                 .word .addr+.i
.i               .=.i+s_siofif ;S_SIOFIF is size of a CFIFO in bytes
             .endr
         .endr
;
.addr    .set siocfifo+.i      ;transmit CFIFO base address
         .rept n_siobix
.i           .set 0
             .rept n_nxpchn
                 .word .addr+.i
.i               .=.i+s_siofif
             .endr
         .endr
;
sioipend =*

The above is "self-configuring," in that the tables are generated according to the number of serial I/O channels defined by the symbol N_NXPCHN. In POC V1.1's firmware, N_NXPCHN is 2, since there is one DUART. In POC V2.1's firmware, N_NXPCHN is 4, owing to the presence of two DUARTs. As the 28C94 QUART can be logically considered to be two DUARTs in one package, the principle holds—it will work for any number of channels, as long as the number of channels is always a multiple of 2.

There are several assumptions designed into the above that if violated will break the code. The first assumption and the one where my error was located, is that the order of the direct page pointers exactly matches the order in which the pointer tables are generated. A simple loop is used to mass-copy the above tables to direct page, which is why the tables and the direct page pointers have to match in sequence. I had the status and command tables reversed in the above, which meant when the interrupt handler tried to read channel status to determine the source of the interrupt it was instead doing a read of the channel's command register. A read of command is marked "reserved" in the 28C94 data sheet, which means there is no telling how the QUART might react and also no telling what was being read by the MPU. Needless to say, the interrupt wasn't being properly serviced.

The other assumptions are the CFIFOs are contiguous in memory, have a size equal to that of a 6502 page or equal to an integral submultiple of a 6502 page size, and that the CFIFO base address (defined by SIOCFIFO) is on a page boundary. These assumptionss simplify the management of the CFIFO pointers and also make it possible for the size of each CFIFO to be smaller than 256 bytes—I use a CFIFO size of 128, which has proved to be more than adequate.

So now that I have working SIO on POC V2.0 I can "flesh out" the rest of the firmware and make some progress. An interesting exercise will be in writing the memory test routines that will scan the total RAM in the system and report how much was found.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: POC VERSION TWO: Update
PostPosted: Sat Apr 28, 2018 8:01 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
It has been a while since I posted on this topic, for reasons mentioned elsewhere. While I was out of commission a lot of business matters were not being handled. So in the six weeks since I finally got back home I have been playing catch-up. Needless to say, there wasn't much computer playtime to be had with all that.

I'm hoping to get back on POC stuff very soon. I've blown the dust off the hardware and have looked at my "notes"—earlier posts in this topic—to see where it was I left off. Also, one of our members requested a PCB so he could build a POC unit. As the firmware is nowhere near ready, I've got to get on the stick¹ and start writing code.

Stay tuned... :D

—————
¹According to legend, we have the Royal Air Force to thank for the "get on the stick" expression.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Mon Apr 30, 2018 1:57 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
Great to have you back on this!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: POC VERSION TWO
PostPosted: Mon Apr 30, 2018 8:01 pm 
Offline

Joined: Thu Apr 19, 2018 12:53 pm
Posts: 25
Hello,
Some posts back, I read a bit about Multi-user and Multi-processes.
Altough I don't understand some of that, I'd like to point out an OS that had a bit of this.
It may be an open door, I don't know. :wink:
For the 6809 there was an OS called Flex. And later came Uni-Flex.
For Flex, I've seen source code. (Some 30+ years ago) and I think the Uni-Flex is also available.
I've found a site about this, please see attchment.
There may be some usefull data there.
BR/
Guus


Attachments:
The Missing 6809 UniFLEX Archive.pdf [33.44 KiB]
Downloaded 124 times
Top
 Profile  
Reply with quote  
PostPosted: Sun May 20, 2018 9:59 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
I have been cogitating about an apparent hardware/logic flaw present in both of my POC V2 designs, one that may be contributing to instability. It all may be due to an oversight on my part concerning how the 65C816 behaves when RDY is brought high following a wait-state. In fact, I believe that past presentations on how to properly wait-state the 65C02 and 65C816 may be flawed for the same reason I'm having trouble. I'm going to elaborate a bit and see what sort of response I get from the others here. I'll focus on the '816, but this should be applicable to both MPUs.

First, here's the 65C816 timing diagram as redrawn by Dr Jefyll. Unlike the WDC version, Jeff's is proportionate to the passage of time during a machine cycle.

Attachment:
File comment: 65C816 Timing Diagram (by Jeff Laughton)
65816 timing_scaled.gif
65816 timing_scaled.gif [ 48.31 KiB | Viewed 1442 times ]

Of interest is the timing for IRQB, NMIB, RESB and RDY. Note that none of these inputs is sampled until the fall of Ø2, assuming setup time is observed. Therefore, a wait-state cannot actually begin until the fall of Ø2. Less clear is the fact that a wait-state cannot end until the fall of the Ø2 clock, which is briefly mentioned in the description of the RDY pin in the 65C816 data sheet:

    2.24 Ready (RDY)

    The Ready is a bi-directional signal. When it is an output it indicates that a Wait for Interrupt instruction has been executed halting operation of the microprocessor. A low input logic level will halt the microprocessor in its current state. Returning RDY to the active high state releases the microprocessor to continue processing following the next PHI2 negative transition....

There is some ambiguity in the above. What exactly is meant by the "...the microprocessor [continues] processing following the next PHI2 negative transition" statement? Is the data sheet saying the MPU will resume completion of the current instruction on the next fall of Ø2, or is it saying the MPU would move on to the next instruction on the next fall of Ø2? All along, I assumed that the latter would happen. However, now that I have two pieces of hardware with wait-stating capabilities that are misbehaving in the same fashion, I'm thinking the former interpretation of what happens when RDY is returned high is correct.

Assuming I'm not off the rails with this, what this means is the glue logic has to not only release (or drive high) RDY at the desired end of the wait-state period, it has to maintain all logic conditions that existed at the start of the wait-state period for an additional Ø2 cycle after the expiration of the wait-state. This is because the MPU will not complete the wait-stated operation until the completion of that following Ø2 cycle.

Again, assuming I'm understanding this as I should, the wait-state logic I concocted for POC V2 would seem to be wrong. The logic is based upon a simulation I did using a GAL, which design had came from a discrete circuit that 8Bit (Daryl Rictor) had presented in December 2010:

Attachment:
File comment: Discrete Wait-State Circuit
rictor_ws_discrete.gif
rictor_ws_discrete.gif [ 3.29 KiB | Viewed 1442 times ]

The simulation of the GAL version (also by Daryl) of the discrete circuit looked like this:

Attachment:
File comment: Wait-State Simulation
rictorwssim.gif
rictorwssim.gif [ 29.18 KiB | Viewed 1442 times ]

The above appears to be correct, but to my revised thinking, is not. The flaw in the logic would be at vector 18, which is when the wait-state period has come to an end. Although RDY (bottom of the graph) returns high at vector 15, the MPU doesn't actually restart until at vector 17, coinciding with the fall of Ø2. However, the logic's assumption at vector 18 is the event that required the wait state is over and the MPU has moved on to the next instruction. I don't believe this to be the case, which would mean the glue logic would no longer agree with what the MPU is up to.

Opinions?

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Sun May 20, 2018 10:43 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1005
Location: Canada
It seems to me if the CPU was in a write cycle it may have just completed an instruction when Phi2 goes low and the asserted /RDY takes effect. In which case I would expect the CPU would move on the next instruction when /RDY is released and Phi2 goes low again. However, if it had just fetched an opcode or was part way through a multi-cycle instruction when halt takes effect, I would expect it to continue with that last instruction once the halt is over.

It seems discarding a partially executed instruction could end up corrupting the stack or something else, leaving it in a unknown or unwanted state. Or am I crazy?

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: POC VERSION TWO
PostPosted: Sun May 20, 2018 10:54 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8389
Location: Midwestern USA
BillO wrote:
It seems to me if the CPU was in a write cycle it may have just completed an instruction when Phi2 goes low and the asserted /RDY takes effect. In which case I would expect the CPU would move on the next instruction when /RDY is released and Phi2 goes low again. However, if it had just fetched an opcode or was part way through a multi-cycle instruction when halt takes effect, I would expect it to continue with that last instruction once the halt is over.

It seems discarding a partially executed instruction could end up corrupting the stack or something else, leaving it in a unknown or unwanted state. Or am I crazy?

Therein lies the confusion. I reevaluated my thinking based on the following conditions:

  1. The MPU is in the opcode fetch stage of the instruction.

  2. The address placed on the bus is ROM and hence needs a wait-state.

  3. The MPU maintains the state of the address bus, as well as RWB as long as RDY is low (also VDA and VPA in the '816) so glue logic conditions remain stable for the duration of the wait-state.

Obviously the MPU can't move on to the next instruction at the expiration of the wait-state, since it hasn't finished the current instruction. So just what does it do when RDY returns high and Ø2 goes low again?

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Mon May 21, 2018 4:27 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 544 posts ]  Go to page Previous  1 ... 26, 27, 28, 29, 30, 31, 32 ... 37  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 80 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: