/*****************************************************************************
*           Change Log
*  Date     | Change
*-----------+-----------------------------------------------------------------
* 15-Dec-85 | [1.209] Created
* 25-Feb-86 | [1.379] include <> => include ""
* 18-Nov-91 | [1.428] <jmn> memory.h => mem1401.h, avoid ANSI name
*****************************************************************************/
#include "boolean.h"
#include "btypes.h"
#include "mem1401.h"
#include "mach.h"
#include "diag.h"
#include "alerts.h"
#include "w.h"
#include "p.h"

/*****************************************************************************
				1401 Simulator

		     Write Line and Punch Card Instruction


		    Write Line and Punch Card (One Address)
		    ---------------------------------------
Instruction format

Mnemonic	Op Code	I-address
--------        ------- ---------
WP		6	III		

Function: This is the same as the write-line-and-punch-card instruction,
except the next instruction is taken from the I-address instead of from the
next sequential instruction address.  The program branch occurs after the card
has been punched and the output line written.

Word Marks:  Word marks are not affected

Address Registers After Operation: (without indexing special feature)

I-Add		A-Add		B-Add
-----           -----           -----
NSI		BI		181

NOTE: THIS HAS BEEN REINTERPRETED ACCORDING TO THE INDEXING SPECIAL 
FEATURES ADDENDUM:

I-Add		A-Add		B-Add
-----           -----           -----
NSI		BI		NSI



Chaining: N/A

		    Write Line and Punch Card (No Address)
		    --------------------------------------
Instruction format

Mnemonic	Op Code	
--------        ------- 
WP		6	

Function: This operation combines the operations of Write Line and Punch Card.

The contents of locations 101-180 are transferred to the punch.

The contents of locations 201-332 are transferred to the printer.

Word Marks:  Word marks are undisturbed

Address Registers After Operation:

I-Add		A-Add		B-Add
-----           -----           -----
NSI		Ap		181

Chaining:  The instruction does not chain
	
*****************************************************************************/


/****************************************************************************
*                                   inst_WP
* Result: boolean
*       true if operation succeeded (excluding card punch errors)
*	false if operation failed
* Effect: 
*	Punches the contents of locations 101-180;
*       Writes the contents of locations 201-332 to the printer
****************************************************************************/

boolean inst_WP()
    {
     tell_op(op_A);

     /* Do write first, in case punch should fail */

     if(!inst_W()) 
	return false;
     if(!inst_P()) 
	return false;

     return true;
    }
