* FILE HEADER FOR LP120 DRIVER PROGRAMS
* COPYRIGHT 1990-1999 BY LUCID TECHNOLOGIES
* WRITTEN BY BRIAN BEARD, OWNER AND PRESIDENT
* ALL RIGHTS RESERVED
*
*6801/6803/6303R MPUs MAY ALL BE USED IN MODE 2.
*PORTS 3 AND 4 COMPRISE A MULTIPLEXED ADDRESS AND DATA BUS.
*CRYSTAL = 3.6864 MHZ, E = 921600 HZ, 1.085 uSEC PER CYCLE.
*EXECUTABLE PROGRAMS MUST LOAD TO RAM BETWEEN $0020 AND THE 
* THE LP120 RESERVED RAM (RESRAM).  IF OTHER THAN $0100, THE 
* START ADDRESS MUST BE CONTAINED IN THE S9 RECORD.  THIS MAY 
* REQUIRE EDITTING THE OUTPUT OF THE ASSEMBLER.
*
*MEMORY MAP (MODE 2) ------------------------------------------
* $0000-$001F   MPU REGISTERS
* $0020-$007F   EXTERNAL RAM, 62256
* $0080-$00FF   INTERNAL RAM, 6803/6303R
* $0100-$7FFF   EXTERNAL RAM, 62256
* $8000-$9FFF   EXTERNAL RAM, 6264
* $A000-$A3FF   UNUSED
* $A400-$A7FF   PIA ZERO
* $A800-$ABFF   PIA ONE
* $AC00-$BFFF   UNUSED
* $C000-$FFFF   EXTERNAL EPROM, 27128
*
*MPU PORT AND I/O USAGE ---------------------------------------
*PORT 1
* P10   MAX522 CHIP SELECT, ACTIVE LOW     OUTPUT  PULLUP
* P11   MAX522 SERIAL CLOCK                OUTPUT  PULLUP
* P12   MAX522 SERIAL DATA                 OUTPUT  PULLUP 
* P13   PMVcc SWITCH, ACTIVE LOW           OUTPUT  PULLUP
* P14   PMVfw SWITCH, ACTIVE LOW           OUTPUT  PULLUP
* P15   UNUSED                                     PULLUP
* P16   UNUSED                                     PULLUP
* P17   UNUSED                                     PULLUP
*
*PORT 2
* P20   MODE SEL                           INPUT   PULLUP
* P21   MODE SEL                           INPUT   PULLUP
* P22   MODE SEL/EXTERNAL BAUD CLOCK       INPUT
* P23   SCI RX DATA                        INPUT
* P24   SCI TX DATA                        OUTPUT
*
*INTERRUPTS
* NMI   UNUSED                             INPUT   PULLUP
* IRQ   PIA-0                              INPUT   PULLUP
*
*MPU EQUATES --------------------------------------------------
P1DDR   EQU     $00     *PORT 1 DATA DIRECTION REGISTER
P2DDR   EQU     $01     *PORT 2 DATA DIRECTION REGISTER
P1DAT   EQU     $02     *PORT 1 DATA REGISTER
P2DAT   EQU     $03     *PORT 2 DATA REGISTER
TCSR    EQU     $08     *TIMER CONTROL AND STATUS REGISTER
CNTR    EQU     $09     *2-BYTE COUNTER VALUE, $09=MSB
OUTCR1  EQU     $0B     *2-BYTE OUTPUT COMPARE REGISTER
INCAP   EQU     $0D     *2-BYTE INPUT CAPTURE REGISTER
RMCR    EQU     $10     *RATE AND MODE CONTROL REGISTER
TRCSR   EQU     $11     *TX/RX CONTROL AND STATUS REGISTER
RXDAT   EQU     $12     *RECEIVE DATA REGISTER
TXDAT   EQU     $13     *TRANSMIT DATA REGISTER
*
*PIA (6821) ADDRESS EQUATES -----------------------------------
* A-SIDE PORTS HAVE INTERNAL PULLUP RESISTORS.
P0A     EQU     $A400   *PIA-0 DDR OR DATA FOR A-SIDE
P0ACR   EQU     $A401   *PIA-0 CONTROL REGISTER FOR A-SIDE
P0B     EQU     $A402
P0BCR   EQU     $A403
P1A     EQU     $A800
P1ACR   EQU     $A801
P1B     EQU     $A802
P1BCR   EQU     $A803
*
*MISC. EQUATES ------------------------------------------------
TRUE    EQU     $FF
FALSE   EQU     $00
*
*ASCII EQUATES ------------------------------------------------
BELL    EQU     $07     *BEEP
BS      EQU     $08     *BACK SPACE
LF      EQU     $0A     *LINE FEED
CR      EQU     $0D     *CARRIAGE RETURN
ESC     EQU     $1B     *ESCAPE
SPACE   EQU     $20     *SPACE CHARACTER
*
*TOOLBOX EQUATES ----------------------------------------------
RESET   EQU     $C000   *JMP HERE TO TERMINATE DRIVER
DLY_B   EQU     $FF6C   *JSR
GETVPP  EQU     $FF70   *JSR
GETVPS  EQU     $FF74   *JSR
DWNMOT  EQU     $FF78   *JSR
DWNHEX  EQU     $FF7C   *JSR
RX4HEX  EQU     $FF80   *JSR
RX3HEX  EQU     $FF84   *JSR
RX2HEX  EQU     $FF88   *JSR
RX1HEX  EQU     $FF8C   *JSR
TX2ASC  EQU     $FF90   *JSR
TX4ASC  EQU     $FF94   *JSR
EXITMM  EQU     $FF98   *JMP HERE FOR LP120 MAIN MENU
BINBCD  EQU     $FF9C   *JSR
UPMOT   EQU     $FFA0   *JSR
ADRMOT  EQU     $FFA4   *JSR
UPHEX   EQU     $FFA8   *JSR
ADRHEX  EQU     $FFAC   *JSR
VPPSET  EQU     $FFB0   *JSR
VPP_NC  EQU     $FFB4   *JSR
VPSSET  EQU     $FFB8   *JSR
VPS_NC  EQU     $FFBC   *JSR
PWROFF  EQU     $FFC0   *JSR
PIAOFF  EQU     $FFC4   *JSR
PIADAT  EQU     $FFC8   *JSR
PIADDR  EQU     $FFCC   *JSR
ASCHEX  EQU     $FFD0   *JSR
HEXASC  EQU     $FFD4   *JSR
MSGOUT  EQU     $FFD8   *JSR
SCITX   EQU     $FFDC   *JSR
SCIRX   EQU     $FFE0   *JSR
RXECHO  EQU     $FFE4   *JSR
RXWAIT  EQU     $FFE8   *JSR
DLY_A   EQU     $FFEC   *JSR - APPROX (50 uSEC)*X
*
*RESTRICTED AREA ----------------------------------------------
RESRAM  EQU     $9C00   *START OF LP120 RESERVED RAM,
	ORG     RESRAM  * FOR SYSTEM VARIABLES, STACK, ETC.
	RMB     $03FF   *  $9C00-$9FFF = 1K
*
*====================== VARIABLE STORAGE ======================
	ORG     $0020

*
*====================== EXECUTABLE CODE =======================
	ORG     $0100

*

