diff --git a/HP2100/hp2100_diag.txt b/HP2100/hp2100_diag.txt index 012a1304..538d75c0 100644 --- a/HP2100/hp2100_diag.txt +++ b/HP2100/hp2100_diag.txt @@ -1,6 +1,6 @@ SIMH/HP 21XX DIAGNOSTICS PERFORMANCE ==================================== - Last update: 2014-12-18 + Last update: 2016-12-18 The HP 24396 diagnostic suite has been run against the SIMH HP 21xx simulation. @@ -118,7 +118,7 @@ Part Number DSN Diagnostic Name Code Vers. Result 20433-60001 -- HP 3030 Magnetic Tape Subsystem -- - Not tested 22682-16017 177777 HP 2100 Fixed Head Disc/Drum (277x) 1612 3.3-0 Passed 24197-60001 -- 12875 Processor Interconnect Cable B 3.7-1 Passed -24203-60001 -- HP2100A Cartridge Disc Memory (2871) A 3.3-0 Partial +24203-60001 -- HP2100A Cartridge Disc Memory (2870) A 3.3-0 Partial The following online diagnostics were run for devices not supported by the @@ -3299,7 +3299,7 @@ TEST RESULT: Passed. ----------------------------------------------------------------- -DSN (none) - HP2100A Cartridge Disc Memory (2871) (multiple unit) +DSN (none) - HP2100A Cartridge Disc Memory (2870) (multiple unit) ----------------------------------------------------------------- TESTED DEVICE: DP (hp2100_dp.c) @@ -3307,10 +3307,10 @@ TESTED DEVICE: DP (hp2100_dp.c) BINARY TAPE: 24203-60001 Rev. A CONFIGURATION: sim> set DPC 12557A - sim> attach DPC0 scratch.U0.2871.disc - sim> attach DPC1 scratch.U1.2871.disc - sim> attach DPC2 scratch.U2.2871.disc - sim> attach DPC3 scratch.U3.2871.disc + sim> attach DPC0 scratch.U0.2870.disc + sim> attach DPC1 scratch.U1.2870.disc + sim> attach DPC2 scratch.U2.2870.disc + sim> attach DPC3 scratch.U3.2870.disc sim> deposit S 002211 sim> reset sim> go 2 @@ -3370,7 +3370,7 @@ TEST NOTES: Four passes are required to test all head/unit combinations. -------------------------------------------------------------------- -DSN (none) - HP2100A Cartridge Disc Memory (2871) (user interaction) +DSN (none) - HP2100A Cartridge Disc Memory (2870) (user interaction) -------------------------------------------------------------------- TESTED DEVICE: DP (hp2100_dp.c) @@ -3378,7 +3378,7 @@ TESTED DEVICE: DP (hp2100_dp.c) BINARY TAPE: 24203-60001 Rev. A CONFIGURATION: sim> set DPC 12557A - sim> attach DPC0 scratch.U0.2871.disc + sim> attach DPC0 scratch.U0.2870.disc sim> deposit S 002211 sim> reset sim> go 2 diff --git a/HP2100/hp2100_dp.c b/HP2100/hp2100_dp.c index 5dd2b9b9..11d0dc2c 100644 --- a/HP2100/hp2100_dp.c +++ b/HP2100/hp2100_dp.c @@ -23,9 +23,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. - DP 12557A 2871 disk subsystem + DP 12557A 2870 disk subsystem 13210A 7900 disk subsystem + 09-Nov-16 JDB Corrected disk subsystem model number from 2871 to 2870 13-May-16 JDB Modified for revised SCP API function parameter types 30-Dec-14 JDB Added S-register parameters to ibl_copy 24-Dec-14 JDB Added casts for explicit downward conversions diff --git a/HP2100/hp2100_dr.c b/HP2100/hp2100_dr.c index fdb33eeb..9ac83407 100644 --- a/HP2100/hp2100_dr.c +++ b/HP2100/hp2100_dr.c @@ -26,6 +26,7 @@ DR 12606B 2770/2771 fixed head disk 12610B 2773/2774/2775 drum + 10-Nov-16 JDB Modified the drc_boot routine to use the BBDL 05-Aug-16 JDB Renamed the P register from "PC" to "PR" 13-May-16 JDB Modified for revised SCP API function parameter types 30-Dec-14 JDB Added S-register parameters to ibl_copy @@ -704,37 +705,110 @@ else { return SCPE_OK; } -/* Fixed head disk/drum bootstrap routine (disc subset of disc/paper tape loader) */ -#define BOOT_START 060 +/* Basic Binary Disc Loader. -static const BOOT_ROM dr_rom = { /* padded to start at x7760 */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0020010, /*DMA 20000+DC */ - 0000000, /* 0 */ - 0107700, /* CLC 0,C */ - 0063756, /* LDA DMA ; DMA ctrl */ - 0102606, /* OTA 6 */ - 0002700, /* CLA,CCE */ - 0102611, /* OTA CC ; trk = sec = 0 */ - 0001500, /* ERA ; A = 100000 */ - 0102602, /* OTA 2 ; DMA in, addr */ - 0063777, /* LDA M64 */ - 0102702, /* STC 2 */ - 0102602, /* OTA 2 ; DMA wc = -64 */ - 0103706, /* STC 6,C ; start DMA */ - 0067776, /* LDB JSF ; get JMP . */ - 0074077, /* STB 77 ; in base page */ - 0102710, /* STC DC ; start disc */ - 0024077, /*JSF JMP 77 ; go wait */ - 0177700 /*M64 -100 */ + The Basic Binary Disc Loader (BBDL) contains two programs. The program + starting at address x7700 loads absolute paper tapes into memory. The + program starting at address x7760 loads a disc-resident bootstrap from the + 277x fixed-head disc/drum. Entering a BOOT DRC command loads the BBDL into + memory and executes the disc portion starting at x7760. The bootstrap issues + a CLC 0,C to clear the disc track and sector address registers and then sets + up a 64-word read from track 0 sector 0 to memory locations 0-77 octal. It + then stores a JMP * instruction in location 77, starts the read, and jumps to + location 77. The JMP * causes the CPU to loop until the last word read from + the disc overlays location 77 which, typically, would be a JMP instruction to + the start of the disc-resident bootstrap. + + In hardware, the BBDL was hand-configured for the disc and paper tape reader + select codes when it was installed on a given system. Under simulation, we + treat it as a standard HP 1000 loader, even though it is not structured that + way, and so the ibl_copy mechanism used to load and configure it must be + augmented to account for the differences. + + + Implementaion notes: + + 1. The full BBDL is loaded into memory, even though only the disc portion + will be used. + + 2. For compatibility with the ibl_copy routine, the loader has been changed + from the standard HP version. The device I/O instructions are modified + to address locations 10 and 11. +*/ + +static const BOOT_ROM dr_rom = { + 0107700, /* ST2 CLC 0,C START OF PAPER TAPE LOADER */ + 0002401, /* CLA,RSS */ + 0063726, /* CONT2 LDA CM21 */ + 0006700, /* CLB,CCE */ + 0017742, /* JSB READ2 */ + 0007306, /* LEDR2 CMB,CCE,INB,SZB */ + 0027713, /* JMP RECL2 */ + 0002006, /* EOTC2 INA,SZA */ + 0027703, /* JMP CONT2+1 */ + 0102077, /* HLT 77B */ + 0027700, /* JMP ST2 */ + 0077754, /* RECL2 STB CNT2 */ + 0017742, /* JSB READ2 */ + 0017742, /* JSB READ2 */ + 0074000, /* STB A */ + 0077757, /* STB ADR11 */ + 0067757, /* SUCID LDB ADR11 */ + 0047755, /* ADB MAXAD */ + 0002040, /* SEZ */ + 0027740, /* JMP RESCU */ + 0017742, /* LOAD2 JSB READ2 */ + 0040001, /* ADA B */ + 0177757, /* CM21 STB ADR11,I */ + 0037757, /* ISZ ADR11 */ + 0000040, /* CLE */ + 0037754, /* ISZ CNT2 */ + 0027720, /* JMP SUCID */ + 0017742, /* JSB READ2 */ + 0054000, /* CPB A */ + 0027702, /* JMP CONT2 */ + 0102011, /* HLT 11B */ + 0027700, /* JMP ST2 */ + 0102055, /* RESCU HLT 55B */ + 0027700, /* JMP ST2 */ + 0000000, /* READ2 NOP */ + 0006600, /* CLB,CME */ + 0103710, /* RED2 STC PR,C */ + 0102310, /* SFS PR */ + 0027745, /* JMP *-1 */ + 0107410, /* MIB PR,C */ + 0002041, /* SEZ,RSS */ + 0127742, /* JMP READ2,I */ + 0005767, /* BLF,CLE,BLF */ + 0027744, /* JMP RED2 */ + 0000000, /* CNT2 NOP */ + 0000000, /* MAXAD NOP */ + 0020000, /* CWORD ABS 20000B+DC */ + 0000000, /* ADR11 NOP */ + + 0107700, /* DLDR CLC 0,C START OF FIXED DISC LOADER */ + 0063756, /* LDA CWORD */ + 0102606, /* OTA 6 */ + 0002700, /* CLA,CCE */ + 0102611, /* OTA CC */ + 0001500, /* ERA */ + 0102602, /* OTA 2 */ + 0063777, /* LDA WRDCT */ + 0102702, /* STC 2 */ + 0102602, /* OTA 2 */ + 0103706, /* STC 6,C */ + 0102710, /* STC DC */ + 0067776, /* LDB JMP77 */ + 0074077, /* STB 77B */ + 0024077, /* JMP77 JMP 77B */ + 0177700 /* WRDCT OCT -100 */ }; +#define BBDL_MAX_ADDR 0000055 /* ROM index of the maximum address word */ +#define BBDL_DMA_CNTL 0000056 /* ROM index of the DMA control word */ +#define BBDL_DISC_START 0000060 /* ROM index of the disc loader */ + t_stat drc_boot (int32 unitno, DEVICE *dptr) { const int32 dev = drd_dib.select_code; /* data chan select code */ @@ -745,9 +819,13 @@ if (unitno != 0) /* boot supported on dri if (ibl_copy (dr_rom, dev, IBL_S_NOCLR, IBL_S_NOSET)) /* copy the boot ROM to memory and configure */ return SCPE_IERR; /* return an internal error if the copy failed */ -WritePW (PR + IBL_DPC, dr_rom [IBL_DPC]); /* restore overwritten word */ -WritePW (PR + IBL_END, dr_rom [IBL_END]); /* restore overwritten word */ -PR = PR + BOOT_START; /* correct starting address */ +WritePW (PR + BBDL_MAX_ADDR, ReadPW (PR + IBL_END)); /* move the maximum address word */ +WritePW (PR + BBDL_DMA_CNTL, dr_rom [BBDL_DMA_CNTL] + dev); /* set up the DMA control word */ + +WritePW (PR + IBL_DPC, dr_rom [IBL_DPC]); /* restore the overwritten word */ +WritePW (PR + IBL_END, dr_rom [IBL_END]); /* restore the overwritten word */ + +PR = PR + BBDL_DISC_START; /* select the starting address */ return SCPE_OK; } diff --git a/HP2100/hp2100_release.txt b/HP2100/hp2100_release.txt new file mode 100644 index 00000000..30ad894e --- /dev/null +++ b/HP2100/hp2100_release.txt @@ -0,0 +1,334 @@ + SIMH/HP 2100 RELEASE NOTES + ========================== + Last update: 2017-01-11 + + +This file documents the release history of the simulator for the Hewlett-Packard +2114, 2115, 2116, 2100, 1000-M, 1000-E, and 1000-F machines. + +The SIMH project does not issue discrete releases. Instead, the current +simulator code base is available at: + + https://github.com/simh/simh + +...and may be downloaded at any time. A code snapshot is identified by the "git +commit ID" that is displayed by the simulator welcome banner. + +Therefore, HP 2100 releases are simply documentation checkpoints that describe +the changes that have occurred since the last checkpoint. Generally, a release +is written when one or more major changes have been incorporated. Minor bug +fixes will be available immediately from the repository but only noted as part +of the next release document. + + + +=================== +General Information +=================== + +The simulator passes the HP 24396 offline diagnostic suite with some expected +failures due to unimplemented features. For example, the disc diagnostic +error-correction logic tests and the tape diagnostic CRCC and LRCC tests fail, +as these features are not supported. However, all features that are required +for operation of the supported HP operating systems pass their respective +diagnostic tests. See the accompanying "hp2100_diag.txt" file for details. + +The simulator has been tested with the following operating systems: + + - 2000E, 2000F, and 2000/Access Time-Shared BASIC. + + - DOS, DOS-M, and DOS-III. + + - RTE-II, RTE-III, RTE-IVB, and RTE-6/VM. + +The user's manual for the simulator is provided in Microsoft Word format in the +"doc" subdirectory of the code base snapshot downloaded from the github site. A +PDF version of the same manual is available at: + + http://alum.mit.edu/www/jdbryan/hp2100_doc.pdf + + +------------------ +Available Software +------------------ + +A preconfigured RTE-6/VM disc image containing the operating system, the MACRO +assembler and Fortran 77 compiler, a selection of tape backup and restore +programs (READT/WRITT, READR/SAVER, FC, TF, and FST), an example programs +(/KENC/HELLO.FTN), and the Mystery Mansion game (MMM) is available from +Bitsavers at: + + http://www.bitsavers.org/bits/HP/tapes/rte-6vm/rte6200/ + +The archive contains instructions and simulator command files that allow +ready-to-run operation. + +The Computer History Museum has graciously arranged with HP to offer the HP 1000 +Software Collection with a sublicense for non-commercial use by private +individuals. The Collection is hosted by Bitsavers at: + + http://www.bitsavers.org/bits/HP/HP_1000_software_collection/ + +A preconfigured RTE-IVB disc image containing the operating system, the ASMB +assembler and FORTRAN IV compiler, and the READR/SAVER and FC tape backup and +restore programs is available from the HP Computer Museum at: + + http://www.hpmuseum.net/display_item.php?sw=565 + +The archive contains instructions and a simulator command file. + +QCTerm, an HP 700 terminal emulator for Microsoft Windows, is available from the +HP Computer Museum at: + + http://www.hpmuseum.net/display_item.php?sw=585 + +Use of an HP terminal via a serial port or terminal emulator via Telnet enables +more advanced screen editing features of the RTE operating systems. + +Manuals describing the operation of HP software are available from Bitsavers at: + + http://www.bitsavers.org/pdf/hp/1000/ + http://www.bitsavers.org/pdf/hp/2000TSB/ + http://www.bitsavers.org/pdf/hp/21xx/ + +...and from the HP Computer Museum at: + + http://www.hpmuseum.net/collection_document.php + + +---------------- +Year 2000 Issues +---------------- + +RTE-6/VM Revision 6200 is Y2K compliant, except for the READR and SAVER +programs. The errors are cosmetic only. + +RTE-IVB Revision 5010 is not Y2K compliant. All of the failures are in +subsystems; the operating itself (time-of-day clock) accommodates dates through +2059. All of the errors are cosmetic. Typically, punctuation characters appear +in the years, e.g., "19:0" for 2000. The RTE-IVB software kit from the HP +Computer Museum includes fixes for the affected modules to bring the system into +compliance. + +All other HP operating systems are not Y2K compliant. + + +----------------------------- +Bugs in RTE-IVB Revision 5010 +----------------------------- + +Testing during simulator development revealed the presence of a bug in RTE-IVB +Revision 5010: + + - The $BALC module in the system library has a bug that causes memory + corruption. This module is used by the ACCTS program and manifests itself by + printing gibberish after the "PLEASE LOG ON:" prompt. + + Specifically, the internal MXEV routine performs a cross-store indirect via a + location in Table Area II (XSA $MAXI+0,I). This fails because the indirect + chain is resolved in the user map, but TA II is not in the user map of + large-background programs, such as ACCTS. Therefore, the location in the + user map corresponding to $MAXI in the system map is used as the pointer to + the location to store. + + A corrected version of $BALC is present on cartridge GF of the disc image + supplied with the RTE-IVB software kit at the HP Computer Museum. + + + +====================== +Release 25, 2017-01-11 +====================== + +This is the initial checkpoint release of the HP 2100 simulator, corresponding +to the 25th set of changes to the 4.0 code base. The following devices are +currently simulated: + + - 2114C CPU with up to 16 KW of memory + - 2115A CPU with up to 8 KW of memory + - 2116C CPU with up to 32 KW of memory + - 2100A CPU with up to 32 KW of memory + - 1000 M/E/F-Series CPU with up to 1024 KW of memory + - EAU, FP, IOP, DMS, FFP, DBI, VIS, and SIGNAL microcode extensions + - RTE-IV EMA or RTE-6/VM OS and VMA microcode extensions + - 12531C Buffered Teleprinter Interface with one 2752 Teleprinter + - 12539C Time Base Generator + - 12557A Disc Controller with four 2870 drives + - 12559C Magnetic Tape Controller with one 3030 drive + - 12565A Disc Controller with two 2883 drives + - 12566B Microcircuit Interface with a loopback connector + - 12578A Direct Memory Access Controller + - 12581A Memory Protect + - 12597A Duplex Register Interface with one 2748 Paper Tape Reader + - 12597A Duplex Register Interface with one 2895 Paper Tape Punch + - 12606B Fixed Head Disc Controller with one 2770/2771 drive + - 12607B Direct Memory Access Controller + - 12610B Drum Controller with one 2773/2774/2775 drive + - 12620A Privileged Interrupt Fence + - 12653A Printer Controller with one 2767 Line Printer + - 12792C 8-Channel Asynchronous Multiplexer + - 12821A Disc Interface with four 7906H/7920H/7925H drives + - 12845B Printer Controller with one 2607 Line Printer + - 12875A Interprocessor Link + - 12892B Memory Protect + - 12895A Direct Memory Access Controller + - 12897B Dual-Channel Port Controller + - 12920A 16-Channel Terminal Multiplexer + - 12936A Privileged Interrupt Fence + - 12966A Buffered Asynchronous Communications Interface + - 13037D Disc Controller with eight 7905/7906/7920/7925 drives + - 13181A Magnetic Tape Controller with four 7970B drives + - 13183A Magnetic Tape Controller with four 7970E drives + - 13210A Disc Controller with four 7900 drives + +The "HP 2100 Simulator User's Guide" manual describes the configuration and +operation of each of these devices in detail. + + +-------------------- +Implementation Notes +-------------------- + + - New bug fixes will now be listed in this file under the associated release + rather than in their previous location (hp2100_bugfixes.txt). + + - Starting with the next release, the LOAD command will restrict its operation + to the addresses occupied by the bootstrap loaders, i.e., the last 64 + locations in memory (up to 32K), unless forced by the addition of the "-F" + switch. The LOAD command is not designed for general loading of absolute + binary files, as it does not initialize the A and B registers as some HP + software expects. It is intended only to install bootstrap loaders. The + BOOT PTR command is the proper simulation of the hardware absolute paper tape + loader. + + +---------- +Bugs Fixed +---------- + + 1. PROBLEM: DPC device documentation uses the wrong disc drive model number. + + VERSION: Release 24. + + OBSERVATION: The comments in the hp2100_dpc.c source file and Section 2 of + the "HP2100 Simulator User's Guide" say that the DPC device supports the + 2871 disc drive, while Section 2.6.1 of the User's Guide says that the + support is for the 2781 disc drive. Neither of these model numbers is + correct. + + Contemporaneous literature (e.g., the "2116B Computer Price List," dated + June 1970) states that the disc memory subsystem consists of the HP 2870A + Moving Head Disc, HP 2871A Disc Controller, HP 2881A Power Supply, and HP + 2882A Cabinet. + + CAUSE: The controller model number is used instead of the drive model + number, while the "2781" number is a transposition of "2871." + + RESOLUTION: Modify the initial comments in the DPC device source file + (hp2100_dpc.c) and modify the sections of the HP2100 Simulator User's Guide + to use the correct disc drive model number (2870). + + STATUS: Fixed in Release 25. + + + 2. PROBLEM: The BOOT DRC command does not execute correctly. + + VERSION: Release 24. + + OBSERVATION: Attempting to boot DOS from a fixed-head disc or drum does + not work. The CPU sits in a loop waiting for DMA to finish, but it never + does. + + CAUSE: The DMA control word in the DR device bootstrap is not configured + during BOOT DRC processing, so DMA is communicating with the wrong device. + + RESOLUTION: Modify "drc_boot" (hp2100_dr.c) to set the fixed disc/drum + select code into the DMA control word before returning. + + STATUS: Fixed in Release 25. + + + 3. PROBLEM: The valid command "DEPOSIT 2000 JMP 2001" is rejected. + + VERSION: Release 24. + + OBSERVATION: Regarding symbolic input, the HP2100 User's Manual says that + the "C" and "Z" flags, signifying a current-page or zero-page reference, + respectively, are not needed "...when entering [memory reference] + instructions into CPU memory; the simulator figures out from the target + address what mode to use." While the valid command "DEPOSIT 1000 JMP 1001" + correctly enters a zero-page jump into memory, the valid command "DEPOSIT + 2000 JMP 2001" does not enter a current-page jump. Instead, an "Invalid + argument" error occurs. + + CAUSE: The "parse_sym" routine looks for the optional "C" or "Z" flag when + parsing memory reference instructions and sets a flag if either is + specified. The test for a current-page reference is performed only if the + reference type was not explicitly specified. However, the sense of the + test is reversed. + + RESOLUTION: Modify "parse_sym" (hp2100_sys.c) to correct the test for C/Z + option specification. + + STATUS: Fixed in Release 25. + + + 4. PROBLEM: The invalid command "DEPOSIT 2000 JMP C 2001" is accepted. + + VERSION: Release 24. + + OBSERVATION: Regarding symbolic input, the HP2100 User's Manual says that + "The address is an octal number in the range 0 - 77777; if C or Z is + specified, the address is a page offset in the range 0 - 1777." However, + specifying a page offset > 1777 is accepted without complaint if it is + within the current page range. + + CAUSE: Error checking for memory reference instruction entry is + incomplete. + + RESOLUTION: Modify "parse_sym" (hp2100_sys.c) to ensure that the range + check is enforced if either C or Z is specified. + + STATUS: Fixed in Release 25. + + + 5. PROBLEM: Punched output does not appear on TTY devices lacking a paper + tape punch. + + VERSION: Release 24. + + OBSERVATION: Running the HP contributed library program "HP 2000F BASIC + for DOS-M/DOS III" does not produce any console output when using terminal + driver DVR00 as required by the program. When using alternate terminal + driver DVR05, console output appears but console input does not work + properly. + + CAUSE: DOS-M and DOS-III support two modes of console I/O: ASCII mode and + binary mode. ASCII mode appends carriage-return/line-feed characters on + output and strips them on input. Binary mode sends and receives bytes + exactly as supplied. + + DVR00 is required because DVR05 does not support the binary I/O mode + required by the program. However, DVR00 assumes that a binary write is to + be directed to the console's paper tape punch rather than the console + printer and therefore sets the TTY interface's "punch flip-flop" instead of + the "print flip-flop" to accompany the text output. The simulation of the + HP 12531 interface card associated with the TTY device discards output if + the punch flip-flop is set and the punch unit (TTY2) is not attached. + + The problem occurs because only a connected HP 2754 teleprinter (a modified + Teletype ASR35) reacts to the print and punch flip-flop signals. All other + supported terminal devices ignore the signals and print whatever output is + supplied (an HP 2752 -- a rebadged ASR33 -- has a manual control for the + punch, but the punch and printer operate together when the punch is on). + The 2000F BASIC program apparently was designed for use with one of these + other terminals, which print normally even though only the punch flip-flop + is set. + + RESOLUTION: Modify "tto_out" (hp2100_stddev.c) to honor the print and + punch flip-flop settings and separate the output as directed only if the + console punch unit is attached (simulating an HP 2754). When the unit is + detached, all output is delivered to the console printer, regardless of the + flip-flop settings (simulating all other console devices). + + STATUS: Fixed in Release 25. diff --git a/HP2100/hp2100_stddev.c b/HP2100/hp2100_stddev.c index c056da96..b9ad5ea2 100644 --- a/HP2100/hp2100_stddev.c +++ b/HP2100/hp2100_stddev.c @@ -28,6 +28,7 @@ TTY 12531C buffered teleprinter interface TBG 12539C time base generator + 30-Dec-16 JDB Modified the TTY to print if the punch is not attached 13-May-16 JDB Modified for revised SCP API function parameter types 30-Dec-14 JDB Added S-register parameters to ibl_copy 24-Dec-14 JDB Added casts for explicit downward conversions @@ -116,6 +117,7 @@ pass its clock calibration test. */ + #include "hp2100_defs.h" #define TTY_OUT_WAIT 200 /* TTY output wait */ @@ -204,7 +206,6 @@ t_stat tty_reset (DEVICE *dptr); t_stat tty_set_opt (UNIT *uptr, int32 val, CONST char *cptr, void *desc); t_stat tty_set_alf (UNIT *uptr, int32 val, CONST char *cptr, void *desc); t_stat tto_out (int32 c); -t_stat ttp_out (int32 c); IOHANDLER clkio; t_stat clk_svc (UNIT *uptr); @@ -746,7 +747,36 @@ return SCPE_OK; } -/* Terminal I/O signal handler */ +/* Terminal I/O signal handler. + + Output Word Format: + + 15 |14 13 12 |11 10 9 | 8 7 6 | 5 4 3 | 2 1 0 + +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + | 1 | I | P | N | - - - - - - - - - - - - | control + +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + | 0 | - - - - - - - | output character | data + +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + + Where: + + I = set the interface to output/input mode (0/1) + P = enable the printer for output + N = enable the punch for output + + + Input Word Format: + + 15 |14 13 12 |11 10 9 | 8 7 6 | 5 4 3 | 2 1 0 + +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + | B | - - - - - - - | input character | + +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + + Where: + + B = interface is idle/busy (0/1) + +*/ uint32 ttyio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data) { @@ -895,28 +925,39 @@ uptr->wait = sim_rtcn_calb (POLL_RATE, TMR_POLL); /* calibrate poll timer sim_activate (uptr, uptr->wait); /* continue poll */ tty_shin = 0377; /* assume inactive */ + if (tty_lf) { /* auto lf pending? */ c = 012; /* force lf */ tty_lf = 0; } + else { - if ((c = sim_poll_kbd ()) < SCPE_KFLAG) return c; /* no char or error? */ - if (c & SCPE_BREAK) c = 0; /* break? */ - else c = sim_tt_inpcvt (c, TT_GET_MODE (uptr->flags)); + c = sim_poll_kbd (); + + if (c < SCPE_KFLAG) /* no char or error? */ + return c; + + if (c & SCPE_BREAK) /* break? */ + c = 0; + else + c = sim_tt_inpcvt (c, TT_GET_MODE (uptr->flags)); + tty_lf = ((c & 0177) == 015) && (uptr->flags & UNIT_AUTOLF); } + if (tty_mode & TM_KBD) { /* keyboard enabled? */ tty_buf = c; /* put char in buf */ uptr->pos = uptr->pos + 1; ttyio (&tty_dib, ioENF, 0); /* set flag */ - if (c) { + if (c) tto_out (c); /* echo? */ - return ttp_out (c); /* punch? */ - } } -else tty_shin = c; /* no, char shifts in */ + +else /* no, char shifts in */ + tty_shin = c; + return SCPE_OK; } @@ -931,47 +972,86 @@ t_stat r; c = tty_buf; /* get char */ tty_buf = tty_shin; /* shift in */ tty_shin = 0377; /* line inactive */ -if ((r = tto_out (c)) != SCPE_OK) { /* output; error? */ - sim_activate (uptr, uptr->wait); /* retry */ - return ((r == SCPE_STALL)? SCPE_OK: r); /* !stall? report */ + +r = tto_out (c); /* output the character */ + +if (r != SCPE_OK) { /* if an error occurred */ + sim_activate (uptr, uptr->wait); /* then schedule a retry */ + return (r == SCPE_STALL ? SCPE_OK : r); /* report a stall as success */ } ttyio (&tty_dib, ioENF, 0); /* set flag */ -return ttp_out (c); /* punch if enabled */ +return SCPE_OK; } +/* TTY output routine. + + The 12531C Buffered Teleprinter Interface connects current-loop devices, such + as the HP 2752A (ASR33) and 2754A (ASR35) teleprinters, as well as EIA RS-232 + devices, such as the HP 2749A (ASR33) teleprinter and HP 2600 terminal. For + output, the control word sent to the interface may set the print flip-flop, + the punch flip-flop, or both flip-flops. These flip-flops generate the PRINT + COMMAND and PUNCH COMMAND output signals, respectively. Setting either one + enables data transmission. + + Only the 2754A responds to the PRINT and PUNCH COMMAND signals. All of the + other devices ignore these signals and respond only to the serial data out + signal. (The paper tape punches on the 2749A and 2752A teleprinters must be + enabled manually at the console and operate concurrently with the printers.) + + This routine simulates a 2754A if the punch unit (TTY unit 2) is attached and + a generic terminal when the unit is detached. With the punch unit attached, + the punch flip-flop must be set to punch, and the print flip-flop must be set + to print. These flip-flops, and therefore their respective operations, are + independent. When the punch unit is detached, printing will occur if either + the print or punch flip-flop is set. If neither flip-flop is set, no output + occurs. Therefore, the logic is: + + if punch-flip-flop and punch-attached + then punch character + + if print-flip-flop or punch-flip-flop and not punch-attached + then print character + + Certain HP programs, e.g., HP 2000F BASIC FOR DOS-M/DOS III, depend on the + 2752A et. al. behavior. The DOS and RTE teleprinter drivers support text and + binary output modes. Text mode sets the print flip-flop, and binary mode + sets the punch flip-flop. These programs use binary mode to write single + characters to the teleprinter and expect that they will be printed. The + simulator follows this behavior. +*/ + t_stat tto_out (int32 c) { -t_stat r; +t_stat r = SCPE_OK; -if (tty_mode & TM_PRI) { /* printing? */ - c = sim_tt_outcvt (c, TT_GET_MODE (tty_unit[TTO].flags)); - if (c >= 0) { /* valid? */ - r = sim_putchar_s (c); /* output char */ - if (r != SCPE_OK) - return r; - tty_unit[TTO].pos = tty_unit[TTO].pos + 1; +if ((tty_mode & TM_PUN) /* if punching is enabled */ + && tty_unit [TTP].flags & UNIT_ATT) /* and the punch is attached */ + if (putc (c, tty_unit [TTP].fileref) == EOF) { /* then output the character; if it fails */ + perror ("TTP I/O error"); /* then report an error */ + clearerr (tty_unit [TTP].fileref); /* clear the error */ + r = SCPE_IOERR; /* and stop the simulator */ + } + + else /* otherwise the output succeeded */ + tty_unit [TTP].pos = ftell (tty_unit [TTP].fileref); /* so update the file position */ + +if ((tty_mode & TM_PRI) /* if printing is enabled */ + || (tty_mode & TM_PUN) /* or punching is enabled */ + && (tty_unit [TTP].flags & UNIT_ATT) == 0) { /* and the punch is not attached */ + c = sim_tt_outcvt (c, TT_GET_MODE (tty_unit [TTO].flags)); /* then convert the character */ + + if (c >= 0) { /* if the character is valid */ + r = sim_putchar_s (c); /* then output it to the console */ + + if (r == SCPE_OK) /* if the output succeeded */ + tty_unit [TTO].pos = tty_unit [TTO].pos + 1; /* then update the file position */ } } -return SCPE_OK; -} - -t_stat ttp_out (int32 c) -{ -if (tty_mode & TM_PUN) { /* punching? */ - if ((tty_unit[TTP].flags & UNIT_ATT) == 0) /* attached? */ - return IOERROR (ttp_stopioe, SCPE_UNATT); - if (putc (c, tty_unit[TTP].fileref) == EOF) { /* output char */ - perror ("TTP I/O error"); - clearerr (tty_unit[TTP].fileref); - return SCPE_IOERR; - } - tty_unit[TTP].pos = ftell (tty_unit[TTP].fileref); - } -return SCPE_OK; +return r; /* return the result */ } diff --git a/HP2100/hp2100_sys.c b/HP2100/hp2100_sys.c index 016adbc7..2e33add2 100644 --- a/HP2100/hp2100_sys.c +++ b/HP2100/hp2100_sys.c @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 30-Dec-16 JDB Corrected parsing of memory reference instructions 13-May-16 JDB Modified for revised SCP API function parameter types 19-Jun-15 JDB Conditionally use Fprintf function for version 4.x and on 18-Jun-15 JDB Added cast to int for isspace parameter @@ -656,21 +657,35 @@ if (opcode[i]) { /* found opcode? */ case I_V_MRF: /* mem ref */ cptr = get_glyph (cptr, gbuf, 0); /* get next field */ - k = strcmp (gbuf, "C"); - if (k == 0) { /* C specified? */ - val[0] = val[0] | I_CP; - cptr = get_glyph (cptr, gbuf, 0); + + if (gbuf [0] == 'C' && gbuf [1] == '\0') { /* if the C modifier was specified */ + val[0] = val[0] | I_CP; /* then add the current-page flag */ + cptr = get_glyph (cptr, gbuf, 0); /* and get the address */ + k = 0; /* clear the implicit-page flag */ } - else { - k = strcmp (gbuf, "Z"); - if (k == 0) /* Z specified? */ - cptr = get_glyph (cptr, gbuf, ','); + + else if (gbuf [0] == 'Z' && gbuf [1] == '\0') { /* otherwise if the Z modifier was specified */ + cptr = get_glyph (cptr, gbuf, 0); /* then get the address */ + k = 0; /* and clear the implicit-page flag */ } - if ((d = get_addr (gbuf)) < 0) return SCPE_ARG; - if ((d & VAMASK) <= I_DISP) val[0] = val[0] | d; - else if (cflag && !k && (((addr ^ d) & I_PAGENO) == 0)) - val[0] = val[0] | (d & (I_IA | I_DISP)) | I_CP; - else return SCPE_ARG; + + else /* otherwise neither modifier is present */ + k = 1; /* so set the flag to allow implicit-page addressing */ + + d = get_addr (gbuf); /* parse the address and optional indirection indicator */ + + if (d < 0) /* if a parse error occurred */ + return SCPE_ARG; /* then return an invalid argument error */ + + if ((d & VAMASK) <= I_DISP) /* if a base-page address was given */ + val[0] = val[0] | d; /* then merge the offset into the instruction */ + + else if (cflag && k /* otherwise if an implicit-page address is allowed */ + && ((addr ^ d) & I_PAGENO) == 0) /* and the target is in the current page */ + val[0] = val[0] | d & (I_IA | I_DISP) | I_CP; /* then merge the offset with the current-page flag */ + + else /* otherwise the address cannot be reached */ + return SCPE_ARG; /* from the current instruction's location */ break; case I_V_ESH: /* extended shift */ diff --git a/doc/hp2100_doc.doc b/doc/hp2100_doc.doc index 13d16124..44b7dc79 100644 Binary files a/doc/hp2100_doc.doc and b/doc/hp2100_doc.doc differ