r~emuuu - PockEmul

The Technical Reference Manual has been written on the assumption that the ..... interpreter s up-versloned in the future Use the 1OCS routines for access to the ..... LINPTN (F097H=low byte; F098H=high byte). = Line pattern. Return. Xl POS.
54MB taille 2 téléchargements 255 vues
POCKET COMPUTER

I,%,% à aS

J%k%

r~emuuu

TECHN~CALREFEFIiENCE MANUAL,

\~ ~

~

r;

Ç

T

I

~~\Ç

\

-~

:~

:T~T I

art

~

e~e~

POCKET COMPUTER

PC-1600 TECHNICAL REFERENCE MANUAL

FORWARD



The PC-1600 Technical Reference Manuai describes the specifications and usage of the 1OCS (Input/Output Contrai System), which controis the i/O operations of the PC-1600 main unit and the peripherais, and gives information regarding the PC-1600 hardware and its interfaces (system bus, RS-232C, etc.) The Technical Reference Manuai has been compiled to provide the IOCS interface information that may be needed when advanced users and programmers write more sophisticated application programs using the machine tanguage of the PC-1600 and to give the hardware information necessary for construction of an application hardware system using the PC-1600. This manual also contains PC-1600 programming know-how and considerations sa that PC-1600 users can make the most of the PC-1600 system. The Technical Reference Manual has been written on the assumption that the reader is already familiar with the basic knowledge of PC-1600 and the general information about computer hardware and programming (especially of Z80 CPU). Many commercial publications are available describing general computer architecture and Z80 CPU. Read them, if necessary, in addition ta this manual. We hope that PC-1600 users, software house programmers and system house engineers will use this manual ta develop various kinds of application programs for the PC-1600 system and PC-1600-based application systems. SHARP CORPORATION Information Systems Group

CONTENTS FORWARD CHAPTER 1 T

SYSTEM CONFIGURATION

CHAPTER 2 Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA 2 1 Memory Map 2 2 BASIC Commands Related to Machine Language

CHAPTER 3 IOCS 31 DISPLAY 3 11 IOCS Routines for LCD 3 1 2 Work Area used for IOCS Routines for LCD 3 1 3 Character Font

3.2 KEY INPUT 3 2 1 tOCS Routines for Key Input 3.2.2 Work Area used for IOCS Routines for Key Input 3.2.3 Scanning of ON (BREAK) Key 3.2.4 Entry of International Characters and Symbols 3 2 5 Data FIow from Key Scanning to KEYGET Routine 3 2 6 Re-definition of Keys 33 FILES 3.3.1 Files Handled in BASIC 3.3.2 IOCS Routines for Files

3.5

T



3.3.3 Structure of Memory File 3.4 INTERRUPT HANDLtNG 3.4.1 Interrupt Handling 3.4.2 Work Area used for Interrupt handling SYSTEM START-UP 3.5.1 Processing at Power On 3.5.2 Execution of Boot Program 3.6 RS-232C AND SIO 3.6.1 Handling RS-232C and SlO in BASIC 3.6.2 Data Format of Communications 3.6.3 IOCS Routines for RS-232C and Sl0 3.7 PRINTER 3.7.1 IOCS Routines for Printer (1) 3.7.2 IOCS Routines for Printer (2) 3.8 DISK 3.8.1 Floppy Disk Format 3.8.2 Specifications of Floppy Disk 3.8.3 File Management 3.8.4 IOCS Routines for Floppy Disk 3.8.5 Processing at Power-On Time 3.9 TIMER/ANALOG PORT 3.10 BEEP 3.11 TAPE RECORDER 3.11.1 PC-l600Mode(Mode0) 3.11.2 PC-1500/PC-1500A Mode (Mode 1)

1

5 6 7 11 12 12 28 29 30 30 37 38 38 38 39 45 45 48 53 58 58 61 62 62 63 65 65 67 67 75 75 76 94 94 95 95 97 103 104 114 117 117 122

~.11.3 Work Area Used for Cassette Tape Recorder aiz MEMORY 3~12.1 Slots and Memory Modules 3.12.2 Work Area Used for Memory 3.12.3 IOCS Routines for Memory Control 3.13 MEMORY MODULE 3.13.1 Location of Memory Module 3.13.2 Type of Memory Module 3.13.3 Header Structure of Memory Module

CHAPTER 4 BAS~CRNTERPRETER 4.1

FUNCTIONS HANDLING AND INTERNAL EXPRESSION 4.1.1 Intermediate Codes of Functions 4.1.2 Arithmetic Registers 4.1.3 InternaI Expression of Numeric Values and Strings 4.1.4 Function Operation Subroutines 4.2 BASIC PROGRAM TEXT HANDLING 4.2.1 Subroutines for Numeric Value Handling 4.2.2 Subroutines for ASCII Code Conversion 4.2.3 Subroutines for Evaluation of Expressions 4.2.4 Subroutines for BASIC Text 4.2.5 Intermediate Code Table

CHAPTER 5 OTHER FUNCTIONS AND PRECAUT~ONS 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 5.15 5.16

AUTOMATIC LOADING AND RUNNING 0F BASIC PROGRAM FILE (AUTORUN.BAS) CHANGING DISPLAY CHARACTER FONT EXTENDED FUNCTION 0F KEYSTAT COMMAND SEGMENTING ONE RAM MODULE FOR DIFFERENT USES FILE FORMAT DATA INPUT/OUTPUT TO FILE DEVICE PRECAUTIONS FOR USE 0F SERIAL PORT (RS-232C AND 510) TRANSFERRING A BASIC PROGRAM BETWEEN PC-1600 AND OTHERMACHINE MERGING PROGRAM FILES SAVING AND LOADING THE RESERVE AREA DISABLING THE KEY INTERRUPT DUE TO ON KEY STATEMENT CE-153 CONTROL UT1LITY (FOR PC-1600) RST COMMANDS 0F SC-7852 (Z-80) SC-7852 (Z-80) AND LH-5803 MICROPROCESSORS COMPATIBILITV WITH PC-1500 PRECAUTIONS FOR APPLICATION PROGRAM DEVELOPMENT

CHAPTER 6 WORK AREA USED FOR BAS~C 6.1 OVERVIEW 0F WORK AREA 6.2 EXPANSION 0F WORK AREA AND BUFFER 6.3 WORK AREA MAP

CHAPTER 7 PC-1600 HARDWARE 7.1

CPU 7.1.1 Specifications of SC-7852

125 127 127 128 130 135 135 135 136 137 138 138 140 141 143 148 148 149 150 152 157 163 164 164 165 166 167 168 171 176 179 180 181 182 186 187 188 191 195 196 197 200 207 208 208

7 72 7

î

73 74 75 76

7 1 2 Specifications of LH-5803 7 1 3 Specifications of LU57813P 7 1 4 Interface Between SC-7852 (Z-80) and LH-5803 1 5 Interface Between Sub-CPU and Main CPU MEMORY 2 1 Memory Map Viewed from SC-7852 (Z-80) 7 2 2 Memory Chip Select SignaIs 7 2 3 Memory Map Viewed from LH-5803 LCD KEYBOARD BUZZER RS-232C/SIO INTERFACE

77 POWER SUPPLY 7 7 1 Kinds of Suppiy Voltages 7 7 2 Kinds of Power Supplies 78 GATE ARRAY 79 CONTROL 0F I/O PORT CONTROLLER

CHAPTER 8 HARDWARE 0F PER~PHERALDEVIICES î

r:

215 218 222 222 223 223 225 225 226 227 227 227 231 231 231 232 234

81 CE-1600P 8 2 CE-1600F/CE-1650F

237 238 245

8.3 84 85 8.6 8.7

248 251 260 260 261

CE-1600M CE 1620M/CE 1601 E/PROM PROGRAMMER CE-1600L/CE-1601T CE-1601L CE-1605L CE-1 6OCA ...

CHAPTER 9 CIIRCUPT D~AGRAM 9.1

CIRCUIT DIAGRAM 0F PC-1600

263 264

9.2

C1RCUIT DIAGRAM 0F PERIPHERAL DEVICES

268

CHAPTER 10 APPEND~CES 10.1 10.2 10.3 104 10.5

CHARACTER CODE TABLE KEV CODE TABLE CONNECTOR PIN CONFIGURATION Z-80 MNEMONIC CODES MNEMONIC CODES 0F 1H-5803

273 274 275 278 281 297

CHAPTER 1 SYSTEM

E

CONFIGURATION

1

SYSTEM CONFIGURATION The PC-1600 can be connected with various kinds of optional peripheral devices. The following figure shows the system configuration of the PC-1600 and these peripherals. Since the system bus of the PC-1600 is compatible with that of the PC-1500 serial, the PC-1600 can use most of the PC-1500/PC1500A peripheral devices.

PC-1600 System Configuration CE-1600? Printer with Cassette interface

Tape recorder connection cables (standard accessories of CE-1 600P)

~2—EE~ I Cassette CE-152 Recorder II

CE-16001 Optical Fiber Cabie

Optical Seriai Port

IIL~~~ I ~1 I~ I II

liii

~DDaEJD C~D~Dt~

~

I ~

CE-1602T Converteri

~F

Bar-code pen readej CE-1601N

Analog Input Port

Bar-code pen reader

CE-158 Seriai and Paraiiei interface Unit

CE-1FO1A

[L-

I

utility program

J

Siot 2Modules Siot t1 I‘t RAM CE-161 CE-151 / i~~i CE-1600M c~ 620M CE-155 CE-159 ~ CE-1600M CE-1620M

II

iJ~i j

-

-

/

/ /I I I I/ /

I ‘////I II /

~/~~1CassetteCE-152 Recorder II Tape recorder conriection cabies (standard accessories

CE-150 Printer with Cassette interface

0f CE-150)

CE-5 16L CE-5l5pPrinter CE-516PPrinter

Cabie

Acoustic Coupler or Direct Modem

I

L

MZ-5500, MZ-5600

E

I j

Personal computers I PC-5000 Portable Computeri I CE-158 Serial and i I ParallelinterfaceUnit I 1 IPC-7000 Personal Compute~ ~

J

IBM Personal Computer

ESeriai RS-232C Port

J

Open

CE-160 iL Cable CE-16021 Cabie CE-16031 Cabie CE-1 604L Cabie

Cable

Note: Connection of CE-1600F requires CE-1600P. CE-158 and CE-162E cannot be connected to CE-1600P.

9

SYSTEM CONFIGURATION



(1) Perlpheral devlces for PC 1600 CE-1 600P: A4-size 4-color plotter-printer CE-1600F: 2.5-inch floppy disk drive CE-1600M: 32KB RAM module CE-1650F: 2.5-inch floppy disk package (10 disks) CE-1 602T: SIO/RS-232C converter CE-1600L: Optical fiber cable CE-1601 L: Cable for modem/acoustic coupler CE-1 602L: RS-232C cable for MZ-5600 and MZ-5500 CE-1 603L: RS-232C cable for PC-5000 and CE-158 CE-1620M: PROM module (32KB ROM) CE-1601N: Bar-code pen reader CE-1 FO1A: Bar-code pen reader utility program (floppy disk) CE-1604L: RS-232C cable for IBM-PC and PC-7000 CE-1 605L: RS-232C cable (open end) (2) Peripheral devices for PC-1500



F».

CE-150:

Color graphics printer

CE-151: CE-152:

Memory module (4KB RAM) Cassette tape recorder

CE-155:

Memory module (8KB RAM)

CE-158: CE-159: CE-161: CE-162E:

RS-232~/ParalIelinterface Program module (8KB RAM) Program module (16KB RAM) ParaIIeI/Cassette interface

Note: CE-150 and CE-158 cannot be used together with CE-1600P.

.fr

L

CHAPTER2 Z-80 MACHINE LANGUAGE

I t

PROGRAMSAND

LOAD AREA

I

p

I’ t

I. .1•

I~.

5

Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA

2.1 Memory Map The following figure shows the PC-1600 memory map viewed from SC-7852 (Z-80). As shown in the figure, the memory space is extended by the bank switching. The bank switching is accomplished in the way: the 64KB memory space of Z-80 is segmented into four 16KB areas, and to each area is allocated one ofthe memory blocks (16KB/block) belonging to that area. Refer to section 3.12.3 for the bank switching procedures. Address

0000 H internai ROM 4000 H InternaI ROM

Module SI 2 (C)

internaI ROM

CE-1 600P Printer Unit

ROM

8000 H

C000 H

Module SIot2 (C) (D)

Module Sioti (A) (B)

internaI ROM

~T

Internai RAM FFFF H BankNo.

0

1

2

3

4

5

Overall Memory [Viewed from Z-80A processorj Address Module SIot 1

Module SIot2

4000 H

I

InternaI RAM

i ~

I

8000 H CE-158 ROM

CE-158 ROM

A000 H CE-150 ROM

CE-150 ROM

C000 H InternaI

ROM FFFF H

BankNo.

2j3~ L~i~

Overali Memory [Viewed from 1H-5803 Sub-Processor]

6

6

Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA The PC-1600 can address 8 mermory banks (bank O to bank 7). The first four banks are allocated to

• •

RAM. Banks 4 to 6 hold internaI system ROMs and peripheral memory. Bank 7 is unused, but is addressable. Address C000 H Header C008 H ReserveProgram Area CØC5H

[Allocatablej Machine Program Area

-

-~



BASIC Program Area User Area 11834 Bytes



-

VariablesArea (F000 H, Work Area FFFFH Bankø Internai RAM [Viewed from Z-80A Processor] With no modules in the expansion slots, the internaI RAM has 11834 bytes of user area. The above memory map shows some of the user area allocated for machine language programs. This machine program area can be set to O with the NEW Command.

2.2 BASIC Commands Rellated to Machine Language (1) NEW command To use the machine language, reserve a machine language program area with NEW command. “SO:” NEW “Si:” ,

where specifies a value of (the desired machine language program area size in bytes) plus C5H. When this command is executed, the memory area from the the star-ting address of the memory in the slot plus C5H to the memory starting address plus minus 1 is allocated for the machine language program area. (Exa m pIe) When CE-159 and CE-1600M are set respectively in slots 1 and 2, both as the program module.

7

Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA

When the following NEW commands are executed: NEW “Sl:”,&lOOO NEW “S2:”,&5000 NEW “SO:”,&l 000 the following memory areas can be used for the machine language program: Bank Bank Bank Bank

O: 2: 3: O:

AOC5H to AFFFH 80C5H to BFFFH 8000H to 8FFFH COC5H to CFFFH

(2) PEEK command PEEK #(,-) This command reads the contents of the memory address specified by of the specified . If the memory address you want to read is between C000H and FFFFH, you can use the foilowing format: PEEK (3) POKE command POKE [#-,]-,,... This command writes data items specified by , consecutively into the memory area whose bank and starting address are specified respectively by and . If no bank is specified, bank 0 is selected. (Example) When the following command is executed: POKE &C700,&O1 ,&02,&O3 data (01H, 02H and 03H) are written into the memory as follows. ...

Address

Data

C700H C7O1H C7O2H

01H 02H 03H

II»

Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA



i

4) CALL

• • •





CALL [#,J[,] This command executes a machIne language program that is stored in the memory area whose bank and starting address are specified by and . Control returns from the machine Ianguage program when RET command is executed. If no bank is specified, bank O is seiected. If is a numeric variable (value: —32768 to 32767), the following operations are executed: (1) transfer the value of the variable to DE register, (2) execute the machine language program, and (3) when returning from the machine language program, if there is a carry, transfer the contents of DE register to the specified variable. If is a string variable, the following operations are executed: (‘I) transfer the starting address of the string variable to DE register, (2) execute the machine language program, and (3) when returning from the machine language program, if the carry flag is 1, transfer the character string whose starting address is specified by DE register and whose length is

specified by B register into the string variable.

I

Ipl W: W. rI,

Z-80 MACHINE LANGUAGE PROGRAMS AND LOAD AREA Machine Language Programs The PC-1600 can be programnied directly in Z-BOA Assembler code by the advanced programmer. BASIC Machine Language Related Commands BASIC supports a number of commands to load, save, access and calI machine language routines, or to control the machine I/O ports directly. Some of them address the main Z-80A processor, and some address the LH-5803 sub-processor. They are: BLOAD, BSAVE, CALL, CLOADM, CSAVEM, INP, OUT, PEEK, POKE, XCALL, XPEEK, XPEEK#, XPOKE, XPOKE# Memory Allocation for Machine Language Programs Internai RAM can be ailocated for machine language programs with the NEW command, which sets the Iower address of the BASIC program area. The user can also access system utilities in other memory areas, or the peripheral device ROMs, but this needs a detailed knowledge of the memory allocation of the PC-1600 above the covered in this manual.

Compatibîlity with the PC-1500 The following table lists the PC-1600 machine language related commands which are different from the PC-1500 command set: COMMAND NAME PC-1600

PC-1500

XCALL

CALL

POKE

Writes data to LH-5801/3 memory space. Writes data to main Z-80A processor memory space.

POKE XPEEK

Runs machine language program for LH-5801/3 sub-processor. Runs machine language program in PC-1 600’s main processor (Z-80A).

CALL XPOKE

FUNCTION

PEEK

Reads data from LH-5801/3 memory area. Reads data from main Z-80A processor memory area.

PEEK XPOKE#

POKE#

Sends data byte to LH-5801/3 machine i/O port.

XPEEK#

PEEK#

Returns data byte from LH-5801/3 machine I/O port.

J (5

t

CHAPTER 3

I.

I

lacs

1~~

t

Iv. A W PI

W

~r..

1~• p. W

11

IOCS The PC-1600 has many IOCS routines that perform various kinds of basic input and output operations of the PC-1600 The user may use these routines to efficiently develop a machine language program The eritry addresses of the IOCS routines will not be changed even when the PC-1600 BASIC interpreter s up-versloned in the future Use the 1OCS routines for access to the I/O If you write a program that directly access the I/O (i.e., a program that accesses the I/O with OUT and IN (INP) commands without IOCS routines), the program may not ruri properiy on a new machine that will be released

as a up-graded model of PC-1600 The IOCS routines described in this manual are aIl for the SC-7852 (Z-80) mode. The terms used in the explanations of the 1OCS routines have the following meanings: e Entry address Most of the IOCS routines are executed by directly cailing the entry address of each routine. • IOCS number Some of the IOCS routines are executed by calling a certain address with the particular IOCS number set in C register. • Function Describes the operation of the IOCS routine. e Parameter Some 1OCS routines require the parameter that prescribes the operation of the routine. Set the parameter in memory or registers before calling the routine. e Return Some IOCS routines return data when the routine is completed and control returns from the routine. These returri data are set in memory or registers. e Affected register When a routine is executed, the contents of some reg isters or memory locations are destroyed.

3.1 D~SPLAY 3.1.1 IIOCS Rout~nesfor LCD The following table Iists the names, functions and entry addresses of the IOCS routines. Use the following format to call up these IOCS routines: CALL Entry-address

The LCD related IOCS routines are for displaying data on a single une only: the data are not displayed over more than one line. Function

Name

Entry address

PRTANK

O100H

Display one character.

PRTASTR

OOEBH

Display a string of characters.

CRSRSET

01 15H

Set the cursor position.

CRSRPOS

0118H

Read the Current cursor position.

CRSRSTAT

011 EH

Specify the cursor ‘type.

UPSCRL

012DH

Scroll up the screen.

DWNSCRL

0130H

Scroll down the screen.

1NS1LN

0142H

lnserta blankline.

ERS1LN

0145H

Erasethecontentsofa une.

.4(5

•~

,

Name

Entry address

ERSSTR

O13FH

Display a specified number of

SMBLSET

O13CH

Set the state of the status une symbols.

SMBLREAD

0139H

Read the state of the status une symbots.

RVSC HR

011 BH

SETANK

0109H

Setthedisplaytothecharactermode.

DOTSET

01 27H

Display a dot in the set/presetlreverse mode.

DOTREAD

O12AH

Read the display state of a dot.

LINE

0121H

Drawa une.

BOX

01 24H

Draw a box.

O14BH

Set the graphics

GCRSRPOS

0148H

Read the current graphics cursor position.

PRTGCHR

O14EH

PRTGSTR

OOEEH

PRTGPTN

0154H

GPTNREAD

GCRSRSET

~:

I

Functi on

~.

.

Change the displaymode. of a string of characters currently on the screen to the reverse-video

Cursor position.

Display a character at the current graphics cursor position. Display a string

of characters from

the current graphics cursor position.

1

X

8 dot pattern at the current graphics cursor position.

015AH

Read the 1

X

8 dot pattern atthe

CGMODE

0133H

Change the character generator mode between the PC-1500 mode and the PC-1600 mode.

I

CPY1 500LCD

01 57H

Copy the

I

CLS

0112H

Clear the screen display.

;

BSPCTR

OOE5H

Enable/disable the LCD.

I

SAVELCD

01 5DH

Save the 156x 8 dot pattern of the specified me to RAM.

~

LOADLCD

0160H

Load the 156

~.

Display a

contents of the fourth

X

Current graphics cursor position.

Une of the screen to the PC-1500 mode

8 dot pattern from RAM to the specified une.

I0CS

PRTANK Entry Address

O100H

Function

Display the character of a character code set in A register at the current cursor

position, then move the cursor one column to the right. If the character is displayed at the right most column of the screen (i.e., if the X coordinate of the current cursor position is 25), then CF is set to 1, the cursor display is turned off, and the cursor remains et the same position. Parameter

A = Character code

Return

CF

Affected Register

AF, CRSRX (Cursor X coordinate: FO6OH), CRSRST (Cursor type: F067H)

1 if the character is displayed at the right most column of the screen.

=

PRTASTR Entry Address

OOEBH

Function

Display consecutively from the current cursor position a string of characters whose character codes are stored in consecutive memory locations. This routine displays starting from the beginning of the contents of the memory locations whose starting address is given in DE register pair until it encounters a character whose code is given in A register (this code is not included in the screen display). If the routine displays characters up to the right most coiumn of the screen, then CF is set to 1, the cursor display is turned off, and the cursor remains at the right most position.

Parameter

DE A

Return

=

=

DE

CF

Starting address of the memory locations that contain the char-acter codes Char-acter code of the character (when the routine encounters this code, it terminates the current display operation, not including that code in the screen display.)

=

=

(Address of the memory location which contains the character code of the character last dispiayed) + 1 1 if e character is dispiayed et the right most column of the screen.

Affected Register

AF, DE, CRSRX (Cursor X coordinate: FO6OH), CRSRST (Cursor type: FO67H)

Example

When char-acter codes (41H, 42H, 43H and 44H) are stored in memory locations from C000H to COO3H, set DE = C000H A

=

44H

and execute CALL OOEBH then “ABC” is displayed consecutively from the current cursor position on the screen. (The letter “D” (code 44H) is flot displayed.)

!OCS

CRSRSTAT Entry Address

011 EH

Function

Specify whether or not to display the cursor, and the cursor type if displayed.

Parameter

A=OOH: Turn off the cursor display. A=O1H: Display the underline cursor.

A=02H: Display the square cursor in blinking. A=03H: Display the space cursor in blinking. Return

none

Affected Register

CRSRST (Cursor type: F067H)

CRSRPOS Entry Address

01 18H

Function

Read the current cursor position. (Character mode)

Parameter

none

Return

D

=

Cursor X coordinate

E

=

Cursor Y coordinate

Affected Register

DE

CRSRSET Entry Address

0115H

Function

Set the cursor position. (Char-acter mode)

Parameter

D

=

E

Cursor X coordinate Cursor Y coordinate

Return

CF

Affected Register

AF, CRSRX (Cursor X coordinate: FO6OH), CRSRY (Cursor Y coordinate: FO5FH)

=

11f the specified position is out of the displayable range of LCD.

IoCS

UPSCRL EntryAddress

O12DH

Function

Scroil up the screen one une. The bottom line is cieared and the cursor display is turned off.

Parameter

none

Return

none

Affected Register

none

DWNSCRL Entry Address

O’130H

Function

Scroil down the screen one Une. The top une is cleared and the cursor dispiay is turned off.

Parameter

none

Return

none

Affected Register

none

INSILN Entry Address

0142H

Function

Insert one biank Une at the specified Une position of the screen. The screen contents on that Une and the beiow are scrolled down one Iine. The cursor display is turned off.

Parameter

A

Return

none

Affecte.d Register

AF

=

Une position (0 to 3)

IOCS

ERSILN Entry Address

0145H

Function

Clear the specified Iine of the screen. The line remains as a blank line. A

Une position (0 to 3)

=

~:eturn

none

Mfected Register

AF

.ERSSTR ~try

Address

O13FH

~rctron

Display as many space characters as specified by the number given in B reglster from the specified position of the screen.

~~ameter

A



~turn

•&~iectedRegister Pemarks

O: Character mode

=

A

=

B

=

CF

D

=

E

=

X coordinate of the screen position Y coordinate of the screen position

1: Graphics mode DE = X coordinate of the screen position HL = Y coordinate of the screen position Number of spaces =

0: Normal termination 1: Some of the specified number of spaces could flot be displayed. B register stores the number of the spaces that could not be dispiayed

AF, BC, DE The position and state of the cursor remain unchanged.

.SMBLREAD ~t~y Address W~nction

0139H Read the state of the status line symbols.

The state of a set of symbols specified by B register is read into A register.

17

socs Parameter

B

Symbol set number (0 to 2)

=

B

=

0011

DEF

I

II

B

=

0111

//“

RUN

PRO

B

=

0211

KBU

UI

/ //

SMALL

,,/“

~,,/“

RAD

/

SHIET

BUSY

G

DE

CTRL

ba~e~

MSB

LSB

Content of A register

Return

A

=

1

ON

=

State of sym bois (If a bit of A register is 1, this means the symbol corresponding to that bit is displayed on the status line of the screen. if a bit is 0, the symbol is flot displayed.)

Affected Register

•.1W

AF

SMBLSET Entry Address

013CH

Function

Set a set of symbois specified by B register ta the state specified by A register.

Parameter

B A B

=

B

B

= =

Symbol set number (0 to 2) Symbol state (expressed by bit pattern)

0011

01M

=

02M MSB

LSB Content of A register

1

=

ON

Return

none

Remarks

If either of KBU or ~ is set ta 1, ~ symbol is displayed.

.4fl

IOCS

RVSCHR





Entry Address

O11BH

Function

Change the display of a string of characters currently on the screen to the reverse-video mode. (Character mode)

Parameter

D = X coordinate of the beginning of the string E = Y coordinate of the beginning of the string A = Number of the characters to be displayed in reverse video

Return

CF

Remarks

The cursor display is turned off.

=

1 if the specified coordinates are out of the range.

SETANK Entry Address

0109H

Function

Set the display mode to the character mode and move the cursor ta the home position (0,0).

Parameter

none

Return

none

Affected Register

CRSRX (Cursor X coordinate: FO6OH), CRSRY (Cursor Y caordinate: FO5FH)

DOTSET Entry Address

01 27H

Function

Give the same function as the PSET commands of BASIC.

Parameter

DOTSOP (F096H)

00H: Dot set 01H: Dot reset 02H: Invert the current dot state Xl POS (FO8EH=low byte; FO8FH=high byte) = X coordinate (—32768 to 32767) Y1POS (FO9OH=Iow byte; F091 H=high byte) = Y coordinate (—32768 to 32767)

Return

none

=

19

I OCS Affected Register

AF, LINPTN (F097H, F098H), DOTSOP (F096H)

Remarks

The effective dot addresses of the screen are: O

X

.~

.~.

155 and O

Y

31.

Specifying a dot address out of these ranges causes nothing.

Specify X and Y coordinate values in two bytes each (a negative value in the complement expression). That is, O ta 32767 is expressed as 0000H ta 7FFFH, and —32768 to —1 as 8000H to FFFFH. Exampie

The foilowing will give the same results as the PSET(100,11),X statement in BASIC. POKE &FO8E,&64,&0O,&OB,&00 POKE &F096,&02 CALL &0127

uNE Entry Address

0121 H

Function

Give the same function as the LINE command of BASIC.

Parameter

DOTSOP (F096H)

00H Dot set 01H Dot reset 02H: Invert Xl POS (FO8EH=low byte; FO8FH=high byte) = X coordinate of the starting point (—32768 ta 32767) Y1POS (FO9OH=Iow byte; FO91H=high byte) = Y caordinate of the starting point (—32768 ta 32767) X2POS (F092H=Iow byte; F093H=high byte) = X coordinate of the end point (—32768 ta 32767) Y2POS (F094H=low byte; F095H=high byte) = Y coordinate of the end point (—32768 to 32767) LINPTN (F097H=low byte; F098H=high byte) = Line pattern

Return

Xl POS Y1POS LINPTN

= =

Contents of X2POS Contents of Y2POS Line patter-n ta be drawn next time (the Iine patter-n made by rotating the line pattern used this time one dot ta the left)

Affected Register AF, BC, DE, HL, X1POS, Y1POS, LINPTN Remarks

The effective dot addresses of the screen are: O X 155 and O Y ~ 31. Specify X and Y coordinate values in twa bytes each (a negative value in the camplement expression). That is, O ta 32767 is expressed as 0000H ta 7FFFF-i. —32768 to —1 as 8000H ta FFFFH. Make a Une pattern (LINPTN) in the same manner as far the LINE command BASIC. For exampie, ta make the fallowing une patter-n: .~.

On

~.

.~

IocS

—•

•—••

••••—•.

.•

••._a•

write ADA9H in LINPTN (i.e., write A9H in F097H and ADH in F098H.) Example

The following will give the same results as the LINE(—5,—3)--(100,50),,&ADA9 statement in BASIC. POKE &FO8E,&FB,&FF,&FD,&FF,&64,&O0,&32,&00 POKE &F096,&00,&A9,&AD CALL &O121

DOTREAD Entry Address

01 2AH

Function

Give the same function as the POINT command of BASIC.

Parameter

X1POS (FO8EH=Iow byte; FO8FH=high byte) = X coordinate (in graphics made) Y1POS (FO9OH=Iow byte; FO91H=high byte) = Y coordinate (in graphics made)

Return

A

=

00H: A dot is flot currently displayed et the specified point an the screen.

01H: A dot is currently displayed at the specified point on the screen. Affected Reg ister

AF

Remarks

If the specified point is out of the displayable range of the screen, the routine returns A=OOH. Specify X and Y coordinate values in twa bytes each (a negative value in the compiement expression). That is, O ta 32767 is expressed as 0000H to 7FFFH, and

—32768 to —l as 8000H to FFFFH.

PRTGCHR Entry Address .~inction

O14EH

Display a character whose char-acter code is given in A register at the current graphics cursor position, then move the graphics cursor 6 dots ta the right (i.e., add 06H ta the X coordinate of the graphics cursor.)

21

focs Parameter 1*

A = Char-acter codé DOTSOP(F096H) =

=

=

00H: Display the new char-acter- patter-n, er-asing the pr-eviously displayed 6 X 8 dot patter-n. 01H Display the ORed patter-n of the new char-acter patter-n and the pr-eviously displayed 6 X 8 dot pattern. 02H Display the XORed patter-n of the new char-acter patter-n and the pr-eviously displayed 6 X 8 dot patter-n.

Return

none

Affected Register

AF GCRSRX (Graphics cur-sor- X coor-dinate F099H=low byte FO9AH=high byte)

• j~.

SAVELCD



Entry Address

01 5DH

Function

Save the contents (the bit image data of 156 bytes) of a screen une specified by A r-egister, into the sequential memory locations whose starting addr-ess is specified by DE register-.

Parameter

DE = Starting addr-ess of the memory locations in which the line data are saved A = Line position on the scr-een (00H ta 03H: 00H designates the first une of the screen.)

Return

none

Affected Register

AF, DE

Example

The following wili save the contents of the fir-st line cf the scr-een ta the memory locations fr-om E000H to EO9BH. LD DE, E000H

:~

•iii.

LD A, 00H

CALLO15DH LCD

2 3

Memory

IfE000H

EO9BH

92

ocs

PRTGSTR E~tryAddress

OOEEH

•~unction

Display consecutively from the current graphics cursor position a string of char-acter-s whose char-acter- codes are stor-ed in consecutive memary locations. This routine displays starting from the beginning of the contents of the memory

locations whose starting addr-ess is given in DE register pair until it encaunters a char-acter whose code is given in A register (this cade is not included in the

screen display). DE

• ~a’~ameter

A

=

Starting addr-ess cf the memor-y locations that contain the char-acter codes

Char-acter code cf the char-acter (when the routine encounters this cade, it ter-minates the current display oper-atian, not inciuding that cade in the screen display.) DOTSOP (F096H) = 00H: Display the new char-acter patterns, erasing the pr-eviously displayed 6x8 dot patterns. = 01H: Display the ORed patterns cf the new char-acter patterns and the previously displayed 6X8 dot patterns. = 02H: Dispiay the XORed patter-ns of the new char-acter patterns and the pr-eviously displayed 6x8 dot patter-ns. =

(Addr-ess cf the memory location which cantains the char-acter- code of the char-acter- last displayed) + 1 GCRSRX = X coor-dinate of the gr-aphics cur-sor for the next dispiay position DE

H. .&~ctedRegister

=

DE, AF, GCRSRX (FO99H=low byte, FO9AH=high byte)

T~TGPTN •~~yAddress

O154H Display the content cf A register- as e 1 x 8 dot patter-n at the cur-rent graphics cur-sor- position, then maye the graphics cursor one dot te the right (i.e., add 01H to the gr-aphics cursor- X coordinate.) A

=

Dot patter-n

uExample of dot pettern]

4

X

.

cursor position

______________— A register 1 ON O OFF 1 O —~.A=9DH LSB

~i!111 MSB

00

IoCs DOTSOP (F096H) = 00H: Display the new 1 x 8 dot patter-n, erasing the pr-evicusly displayed 1 X 8 dot patter-n. = 01H: Display the ORed patter-n cf the new 1 X 8 dot patter-n and the previously displayed 1 X 8 dot patter-n. 02H: Display the XORed pattern cf the new 1 X 8 dot patter-n and the pr-evicusly displayed 1 x 8 dot patter-n. Return

none

Affected Register

AF, GCRSRX

• :,

GPTNREAD Entry Address

O15AH

Function

Read the 1

X

8 dot pattern fr-om the current graphics cursor position toward the

positive direction of Y axis inta A register. The dot patter-n is r-ead into A register- in the same manner- as described in “Example of dat patter-n” of PRTGPTN routine. If part cf the 1 x 8 dot patter-n ta be r-ead exceeds the screen area, those dots cf the exceeded part are r-ead ta be O.

:1W.~. Parameter

none

Return

A = One binary byte expr-essing the dot patter-n

Affected Register

AF

CGMODE Entry Address

0133H

Function

Change the char-acter- generatar made between the PC-1500 mode and the PC-1600 made.

Parameter

A

Return

none

Affected Register

AF, LCDWK1 (FO5DH)

=

0: PC-1600 mode 1: PC-1500 made

(5 A

IocS

CPV~500LCD ~try Address

0157H

Fu nction

Copy the contents cf the faurth line of the screen (dot patter-n cf 156 bytes) ta the PC-1500 display RAM (7600H to 764FH; or 7700H to 774FH (addr-ess on LH-5803)) with the bit configuration changed for- the PC-1500 format. The state cf the status Une symbols is eIsa copied.

a’ameter

none none

~ected Register

none

CRSRPOS E:y Address





01 48H

~r~ctjOfl

Read the current graphics cursor position.

~ameter

none

~jrn

DE BC

ected Register ~arks

= =

X coordinate (—32768 X 32767) Ycccrdinate (—32768.~.Y.~ 32767) .~.

.~

DE, BC

X and Y coor-dinates are returned as a twa-byte value (e negative value in the complement expression). That is, O to 32767 is expressed as 0000H ta 7FFFH, and —32768 ta —l as 8000H ta FFFFH.

BOX ~try

Address

O124H Dr-aw a box with the inside filled in.

~.r~rneter

DOTSOP (F096H)

00H: Dot set 01H: Dot reset 02H: Invert X1POS (FO8EH=low byte; FO8FH=high byte) = X coor-dinate cf the starting point cf the diagonal (—32768 ta 32767)

(n:

fOCS Y1POS (FO9OH=iow byte; FO91H=high byte) Y coordinate of the starting point cf the diagonal (—32768 to 32767) X2POS (F092H=low byte; F093H=high byte) = X coor-dinate cf the end point of the diagonal (—32768 ta 32767) Y2POS (F094H=low byte; FO95H=high byte) = Y coar-dinate of the end point of the diagonal (—32768 ta 32767) LINPTN (F097H=Iow byte; F098H=high byte) Line patter-n =

Return

X1POS = Contents of X2POS Yl POS = Contents cf Y2POS LINPTN = Line patter-n te be dr-awn next time (the une patter-n made by ratating the line patter-n used this time one dot ta the left)

Affected Register

AF, BC, DE, HL, Xl PaS, Y1POS, L1NPTN

Remarks

The effective dot addresses cf the screen are: OX~ 155 and 0~Y 31. Specify X and Y coor-dinate values in twa bytes each (a negative value in the complement expression). That is, O ta 32767 (s expr-essed as 0000H ta 7FFFH, and —32768 ta —1 as 8000H to FFFFH. Make e une patter-n (LINPTN) in the same manner as for the LINE command of BASIC. Far example, te make the fallowing une patter-n:



_

write ADA9H in LINPTN (i.e., write A9H in F097H and ADH in F098H.) Exampie

The foliowing will give the same results as the LINE(—5,—3)—(100,50),,&ADA9,BF statement in BASIC. POKE &FO8E,&FB,&FF,&FD,&FF,&64,&OO,&32,&00 POKE &F096,&00,&A9,&AD CALL &0124

GCRSRSET Entry Address

O14BH

Function

Set the graphics cur-sor- position.

Parameter

DE BC

=

=

X caor-dinate (—32768 X 32767) Y coar-dinate (—32768 Y~.32767)

Return

none

Affected Register

GCRSRX, GCRSRY

Remarks

Specify X and Y coor-dinate values in two bytes each (a negative value in the compiement expression). That is, O ta 32767 is expressed as 0000H to 7FFFH, and —32768 te —1 as 8000H ta FFFFH.

fOCS

•~ntryAddress

0112H

~inction

Clear the screen display.

~meter

none

mn

none

fecled Register

none The cursor display is turned off.

-

.

~CTR .Address

OOE5H Enabie/disable the LCD.

~Teter

A

=

01H: Enabie the LCD. 00H: Disabie the LCD.

none sted Register

~-I

AF

(~fl

Address Function

0160H Load 156 bytes of data fr-om the sequential memary locations whase starting address (s specified by DE register, as the 156 X 8 dot patter-n ta a screen line specified by A register.

Parameter

DE

Return

A = Line position on the screen (00H ta 03H) nane

Affected Reg ister

AF, DE

=

Starting address cf the memory locations from which the 156x8 dot patter-n are loaded

07

tocs

3.1.2 Work Area used for IIOCS Rout~nesfor LCD Work name

Address

FO5DH

LCDWK1

Bytes

Description

1

The bits of FO5DH have the following meanings. Bit 2: Specifies the selected character font set. O = PC-1600 font 1 = PC-1500 font Bit 3: Specifies whether or flot ta use the character font of the char-acter codes 00H to 1FH. o = The character codes 00H te 1DH and 1FH are pr-ocessed as a space, and 1EH as an insert mark “~j~”. 1 = The character font for the codes 00H to 1FH uses the user-defined character font data that are stored in the memory locations specified by CTRCGA and CTRCGB. Bit 4: Specifies the cursor blinking speed. O Normal speed 1 = Double speed =

.4v.

CRSRX

FO6OH

1

Cursor X coordinate

CRSRY

FO5FH

1

Cursor Y coordinate

CTRCGA

FO6IH (Low byte) F062H (High byte)

2

Starting address of the memory locations which contain the char-acter font data for the char-acter codes 00H to 1 FH (The starting address must be greater than 8000H.)

CTRCGB

F063H

1

Bank number (0 to 7) of the memory locations which contain the character font data for the character codes 00H te 1FH

UPAGGA

F064H (Low byte) F065H (High byte)

2

font data for the character codes 80H te FFH

F066H

1

Bank number (0 to 7) of the memor-y locations which contain the character font data for the character codes BOH to FFH

1

Cursor type 00H = Cursor display OFF 01H = Underline cursor 02H = Blinking square cursor 03H = Blinking space cursor

UPAGGB

F067H

CRSRT

Starting address of the memory locations which contain the char-acter ~ (The starting address must be greater than 8000H.) I



~ FO8EH

X1POS

(Low byte) ~ FO8FH ~ (High byte)

~

I

2

~ —..—•••——————

FO9OH

Y1POS

(Low byte) F091H

2 I

(High byte)

~J__________

F092H

X2POS

(Low byte) F093H

1I

2

(High byte) ——

I

F094H

Y2POS

(Low byte) F095H

2

(High byte)

~ ~ I

DOTSOP

F096H

1

00H ==Dot 01H OR or setdot reset 02H = XOR or invert

fors

f OCS Work name

Address

LINPTN

(Low byte) F098H

I..

Bytes

Description

F097H

2

(High byte)

1~ ~ t..

n

F099H (Low byte) FO9AH (High byte)

GCRSRX

Line patter-n

I I

I

2

Graphics cursor X coordinate

2

Graphics cursor Y coordinate

I

FO9BH

GCRSRY

(Low byte) FO9CH (High byte) II

3.1.3 Character Font

I!

The char-acter fonts used in PC-1600 are composed cf 6 by 8 dots each and the char-acter font data are stored in the character generator table in the fallowing far-mat: each 8-dot corumn cf one char-acter font is expressed in one byte and one char-acter font is for-med by arranging six column data (6 bytes) from the left end te the right end of the font. (See the figure below.) LSB

~Ii~

II

Font data in character table

MSB

generator

II

—*~

L

3EH

41H

L

~

49I~4

~ 39H —~

00M Higher address end

t. t’

The PC-1600 has three char-acter generatar- tables: (1) Char-acter- generatcr table for those characters cf codes 20H to 7FH This table is in the main ROM and the fonts of these char-acter-s cannot be changed by the user. (2) Char-acter- generator table for those char-acter-s cf codes 80H to FFH This table is in the main ROM. The user can use differ-ent fonts for these codes by preparing user-defined fonts in RAM and changing the Contents cf UPAGGA and UPAGGB. (3) Char-acter gener-ator- table for those char-acter-s cf codes 00H ta 1 FH

No font data exist in the main ROM. The user- can define his own fonts for these cades: pr-epare user-defined fonts in RAM, change the contents of CTRCGA and CTRCGB, and set bit 3 cf LCDWK1 ta “1”. As described above, the user- can change the char-acter gener-ator tables (2) and (3) ta the user-defined tables prepared in RAM. In this case, since aIl char-acter- fonts cf the codes assigned te each table are ta be changed, the user- must prepar-e font data for aIl cf these codes in RAM.

‘.5(5

fOCS

3~2KEY INPUT 3.2.1 tOCS Routines for Key Input The failowing table lists the names, entry addr-esses and functions cf the IOCS routines for key input. Refer to sectian 10.2 for the key ccdes and the codes handled in the key buffer. Name

Entr-y address

Function

KEYGET

0166H

KEYGETR

0169H

Same function as KEYGET except the routine does net wait for a key input even if the key buffer is empty.

KBUFSET

016CH

Load data inte the key buffer or clear the key buffer-.

BREAKCHK

01 6FH

Read the state cf the BREAK key.

CURUDCHK

0172H

Read the state cf the ~f or

KEYDIRECT

0175H

Scan the keys and read the key cade cf the key that has been pressed when the routine is called.

KEYSTRB

O178H

Scan one row of keys te identify a particular ene of more than one key pressed at the same time.

KEVAUX

01 18H

Specify the key input device (main keyboard or RS-232C).

KEYSTATSET

O17EH

Specify the key repeat function and the key click function.

KEYSTATREAD

0181H

Read the settings cf the key repeat and click functions and the cur-r-ent

OFFCI-IK

0184H

Read the state cf the OFF key.

KEYGETND

0187H

Read the first char-acter in the key buffer without changing the contents of the key buffer.

BREAKRESET

O18AH

Clear the latch cf the BREAK key.

Read cne character from the key buffer-. If the key buffer- is empty, the

routine waits for e key input.

m key.

key input device.

tocs

KEYGET Entry Address

01 66H

Function

Read one char-acter from the key buffer- (64 bytes). If the key buffer (s empty, the routine waits for- a key input. When the auto power--off function (s enabied, if no key input occurs for- about 10 minutes, the power- is automatically turned off. In this state, if the BREAK[ON] key (s pr-essed, the routine is restarted.

Parameter

none

Return

CF

Affected Register

AF

=

Key cade 1: The routine has resulted in a timeaut er-r-ar-. (That is, when this rautine was caiied, the key buffer was empty and no key input occurr-ed within 10 minutes. If this happens, the key wait abort bit (bit 4 of KEYWK2 (FO7AH)) is set ta 1.) 0: Normai ter-minatian

A

=

KEYG ETR

n

EntryAddress

0169H

Function

Same as the KEYGET routine except the routine does not wait far- e key input even if the key buffer is empty

Parameter

nane

Return

CF

Affected Register

AF

=

11f the key buffer- is empty.

KBUFSET Entry Address

O16CH

Function

Clear- the key buffer, then load as many data as specified by A r-egister-, fr-om the memor-y locations whose star-ting address is specified by DE r-egister- into the key buffer-.

While the routine is being executed, the key scan inter-r-upt is disabled.

tocs Parameter

DE A

Starting address cf the memory locations wher-e data are stored Num ber of data to be loaded (1 ~ A ~ 63; If A=O, then the key buffer is clear-ed.)

Return

none

Affected Register

DE

Remarks

Data ta be Icaded te the key buffer- must be within only one bank.

=

BREAKCHK :

~

Entry Address

016FR

Function

Read the state of the BREAK key. if the BREAK key has been pressed, the key buffer is clear-ed.

Parameter

none

Return

CF

Affected Register

AF

=

1: The BREAK key has been pressed. O The BREAK key has not been pressed

t.

CURUDCHK Entry Address

0172H

Function

Check whether- or- net the

Parameter

none

Return

CF

Affected Register

AF

rn ar- [fl key has been pressed.

rn rn rn

O: Neither II nor key has been pressed. 1: The and/or key has been pressed. A = Kind cf the key(s) pressed (If bit 7 is 1, the key has been pressed, and if bit 6 (s 1, the been pressed.)

rn

m key has

focs KEYDORECT Entry

Address

0175H

Read the cade cf the key that has been pr-essed when the routine is called. While

Function

the routine is being executed, the key scan interrupt is disabled. The key buffer (s

aIse cleared. Parameter

none

Return

A

Affected Register

AF

KEYSTRB

Key code (A

=

=

00H if no key has been pr-essed.)

.

Entry Address

0178H

Function

Read the state of the keys corresponding ta the specified key strobe. Thase bits car-responding te the keys pr-essed are read te be 0. While the rcutine is being executed, the key scan interrupt is disabled.

Parameter

A

Return

A = State cf the keys

Affected Register

AF

=

Str-obe number (00H te 08H)

----i

r

r—-

r~i

Strobe 8

ri ri ri ri as

KB5

CTP.L

oN

L__j L__J L_.1 L_.~j Strobe7 Strobe6 Strobe5 Strobe4 Strobe3 Strobe2 Strobel StrobeO

MSB

LSB Key state data O 1

= =

The key bas been pressed. The key bas not been pressed.

focs

KEVAUX Entry Address

O17BH

Function

Specify the key input device (main keybaard or RS-232C).

Parameter

A

=

00H: Main keyboard 02H: RS-232C

Return

CF

Affected Register

AF

Remarks

If RS-232C is seiected as the key input device, KEYGET, KEYGETR and KEYDIRECT routines are executed ta RS-232C.

=

1: Parameter speclfication error

KEYSTATSET Entry Address

O17EH

Function

Specify the key repeat function and the key click function.

Parameter

A

=

Functian A : bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit O Don’t care

Ail keys are allowed ta be repeated Keys other than special keys are allowed ta be repeated Key repeat ON Only the cursor keys are allowed ta be repeated Key clicking ON Key clicking OFF

= = = = = =

1 O 1 O 1 O

____________ __________________

Return

none

Affected Register

none

Remarks

The special keys described in “Par-ameter” are: CTRL, SHIFT, SML, keys, KBU, RCL, MODE, ON, and OFF.

~, functicn

tocs

KEYSTATREAD Entry Address

0181H

Function

Read the settings cf the key repeat and click functions and the cur-rent key input device.

Parameter

none

Return

A

=

Settings cf the functions A: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit O uncertain Main keyboard = RS-232C = Ail keys are allowed ta be repeated = Keys other than special keys are allowed ta be repeated = Key repeat ON = Only the cursor keys are allawed ta be repeated = Key clicking ON = Key clicking OFF

O 1 1 O 1 O 1 O

_________

0

_______________________ ______________________________

Affected Reg ister

AF

Remarks

The special keys descr(bed in “Return” are: CTRL, SHIFT, function keys, KBII, RCL, MODE, SML, ~, ON, and OFF.

OFFCHK Entry Address

0184H

Function

Read the state cf the OFF key.

Parameter

none

Return

CF

Affected Register

AF

=

0: The OFF key has not been pr-essed. 1: The OFF key has been pressed.

KEYGETND Entry Address

0187H

Function

Read one byte cf key cade fr-om the beginning of the key buffer- without changing the contents cf the key buffer.

•~tfr

~i.

tocs

Parameter

none

Return

CF

Affected Register

none

=

O: A key cade was read. A Key code 1: The key buffer- was empty.

BREAKRESET Entry Address

018A1-I

Function

Whether cr- net the BREAK key has been pressed can be known by checking the state cf bit 1 cf the contents cf the I/O address 1BH: if bit 1 (s “0”, the BREAK key has nat been pr-essed, and if bit lis “1”, the BREAK key has been pressed. This routine resets the ccntent cf that bit. The key buffer- is clear-ed when the routine (s called.

Parameter

none

Return

none

Affected Register

AF

(‘c

iocs

3.2.2 Work Area used for tOCS Routines for Key Input The following table shcws the wcr-k area map for key input.

t:

Contents

Address

t, t t.

F079H

Key function flag Bit 0: Disable the key scan interrupt. Bit 1: Enabie the key clicking. Bit 2: Key repeat Bit 3: Range of keys to be repeated 0: AIl keys other- than the special keys 1: AIl keys including the special keys Bit 4: Delay before starting the key repeat 0: Long 1: Short Bit 5: Conditions for key repeat O: If the same key code is generated consecutively, only cne key code is accepted into the key buffer. 1: Even the same key code is repeated. Bit 6: Repeat pitch 0: Slow 1: Fast Bit 7: Disable the key code conversion upcn execution of the KEYGET ‘r-butine.

FO7BH

Key function flag Bit 1: Disable the auto power-off function. Bit 2: Disabie the OFF key.

FO7FH

Key buffer write pointer This pointer specifies the position in the key buffer to which the next key data is to be written. if

I. .11:

I~.

I

the key buffer- is full, MSB is set te “1”. FO8OH

Key buffer read pointer This pointer- specifies the position in the key buffer frcm which the next key data is te be read. If the read pointer has the same value as the write pointer, this means ther-e is no data ta be read.

F083H

Key code last r-eturned

F084H

Bank nurnber of the key code conversion table for SHIFT made

F085H FO8SH

Address of the key code conversion table for SHIFT mode This specifies the star-ting address cf the key code conversion table used in the SH1FT mode upcn execution cf the KEYGET routine.

F087H

Bank number of the key code conversion table for KBII mode





F088H F089H



Address of the key code conversion table for KBII mode This specifies the starting address of the key code conversion table used in the ~ mode upon execution ofthe KEYGET routine.

FO8AH

Bank number of the key code conversion table for SHIFT-KBII mode

FO8BH FO8CH

Address 0f the key code conversion table for SHIFT-KBII mode Th(s specifies the starting address of the key code ccnvers(on table used in the SHlFT-f~Jmode I

FODFH —FilER F11FH

F12OH

upon executien of the KEYGET routine. Key buffer Bank number of the key code table

1 Address ofthe key code table

This specifies the starting address of the key matrix to key code conversion table used in the key scan rcutine.

37

tocs

3~23Scanning of ON (BREAK) Key Whether- or net the BREAK key has been pressed can be known by checking the state cf bit 1 cf the contents cf the i/O address 1BH: if bit lis “O”, the BREAK key has nat been pr-essed, and if bit lis “1”, the BREAK key has been pressed. This state cf bit 1 is Iatched. To reset it, execute BREAKRESET routine (entry addr-ess O18AH). The key buffer is cleared when the routine (s executed.

3.2.4 Entry 0f International Characters and Symbots When the KBII and/ar- SHIFT symbol is on, executicn of KEYGET ar- KEYGETR key input IOCS rcutine allcws ta enter the international char-acter-s and symbais.

3.2.5 Data Ftow from Key Scanning to KEYGET Routine (1) 1/64-sec interrupt handiing routine

Key matrix

Key code conversion table

J

Key code

C

Key buffer~)

(2) KEYGET routine

Reference af status une symbols Normal

Key data are made as described above. The key code table and the other tables are assigned by specifying the starting address cf each table in RAM with a pointer-. Therefare, the user can make his own key layout by changing the cantents cf these pointer-s so as ta point the user-defined tables. (See also section 3.2.6.)

tocs

3.2.6 Re-definition of Keys (1) Key tables The PC-1600 has four- kinds cf standard key tables in ROM. Since the PC-1600 uses these tables by specifying the starting address of each table with e pointer, the user can use his cwn tables by changing the contents cf these pointer-s.

Pointer Table

Function Name

Address

(in Size bytes) I

Contents

r

I Starting address cf the key

Key code table

Convert key matrix to key code. ~

KEYCDA

F12OH

KEYCDB

F11FH

I

SHIFT code table

Convert key code te SHIFT code.

SFTCDA

F084H

SFTCDB

F086H

2

~‘

Banknumberofthekey code table

2

Starting address SHIFT code table (in the order 0f the low and the high bytes)

1

Bank number of the SHIFT code table

2

codetable(intheorder-of the Iow and the high bytes)

-I~ n

I n

KNCD1A KBII code table

Convert key code te KBU code.

I

F087H

I

n

~KNCD1B

~

F089H

1

n

Star-ting address cf the KBII

Bank number cf the KB]I

code table Starting address ofthe

I

SHIFT-KBII code table

codetable(intheorderof ~the Iow and the high bytes)

KNCD2A

FO8AH

KNCD2B

F089H



Convert keycode. code to SHIFT-KB]1 ~

2

SHIFT-KBU code table (in the order- of the Iow and the high bytes) Banknumber-ofthe5HlFTKBII code table

(2) Structure of key table The structure cf each table is shown in the following source program Iist. Te make e user--defined table, use the same structure as that of these standard tables prcvided in ROM. The label names used in the source progr-am list are related te the tables as follows:

Table Key code table

Label name n

KYCDTB

SHIFT code table

SFTCDT

KBU code table

KNCDT1

SHIFT-KBU code table

KNCDT2

Each table must be made within one bank.

on

tocs ‘n

KYCDT~ FE37

n

I’

IJEFE1

Qil~-I

!JEFB DEFIJ DEFE1

03H 041-i 05H

IJEFB IJEFB EIEFE1 IJEFE1 IJEFB

DEFI3

331-I 36H

3

39H 47H 14H

9

DEFB

02H

DEFB DEFE1 LIEFE1 DEFB

52H 5~H 20H

DEFB EIEFB

~3EFB IJEFEi EIEFEi IJEFB EIEFD EIEFB

43H 19H

DEF}3 t3EFB

~:9H ‘ICH

DEFEi

IFH

DEFB

IJEFEi DEFB

1JEFB DEFB DEFB

IJEFE1 IJEFB DEFEC

DEFB tIEFIEI IJEFEI DEFB EIEFB

riqht

~srn~i1 k~y

;F3 ; sri~e PA4 / ;

-‘TSH

.

F’A3

F:$

~C rcl ;L

~O

4BH i~,î-f 49H 28H ØDH

31H 341-1 371-l 4Ç~H

;cur’sor ~rnodE ~c1

c~.ui”~or’1c~ft 5P

46H 13H

2BH 2f~H 2FH 44H 12H

IJEFB

F~5

3DH 0E3~1 SØH

do~-~ru

; def

SAH

DEFB

~cur’osr’ F~

ØCH 1FH

1EIH 41H 1BH ~51H

tIEFE1

;F4 T

54H 42H OAH

IJEFB IJEFB DEFB

DEFE1

DEFB

;E~5 r-t-t,

IJEFB EIEFE1 tJEFB

~n.

; ct r’ 1

1< ;F6 I ; enter

: FA2

;

1

;7 ~J

15H 4t1H 30H

SSH

O

---—PAl DEFE1 1TEFE3 n.

IJEFB

IJEFB DEFB

3EH ØFH

DEFB

53H 11H 57H

DEFS

51311 09H

tIEFEI

DEFEI DEFB DEFB

32H

DEFEI DEFI3 DEFB DEFB

48H 01H 59H 4EH

DEF8

F1

W X ; rot~y PAØ

k

———-

35H

38H

08H

;shi4t cLir’o~or up

focs ~FTCtlT: ——

IJEFB DEFB DEFB

DEFB DEFE3

DEFEI DEFEi DEFB IJEFB DEFEI DEFB EIEFEi EIEFB

DEF8 DEFI3

DEFB



;cursel ;rot~ry

ØAH

;

08H 1CR

; cursor

f~11JH 0EI~ ØFH

; 10H

0 21H 22H 23H 24H 25H 26H 0

enter

ON ~c:~FF ——

~r,o key ;F1 ; F2 ; F3 ; F4 ; F5 -

;ruo k~y ; CL

O

18H

~FCL ;no key ;EIEF ~no k~y

DEFB

0

;no kev

DEFEI

1FR

DEFB

EIEFB JJEFEI

JJEFB EIEFEI EIEFEI DEFB

DEFB DEFEI

O

;no kev 201—I

5EH 0 O 0 0 0 0

MODE

— -—

n o k ~v ;no k~tZi ~no ke~.’ ;no key ;

;no k~v ;no k~i

0 3CR 3EH

;

3AH 3EiH

rio k t~

H-

0

; no

2CH

;/

DEFI3

7CH

;0

DEFEI DEFB

5DH

DEF8 DEFB DEFB EIEFB IJEFB IJEFB IJEFB EIEFB DEFB DEFB

7IJH SCH 7EH 39H 0 O O 40H 0 0

DEFB

0 61H

DEFB

DEFEi DEFEI LIEFB DEFEI

EIEFB DEFE1 DEFB DEFEI DEFEI

DEFB DEFEI DEFB DEFE

DEFS DEFB

801-i 781-1

~4 ; 6

no k~v

;no ke’

;no k~ïy

40H

62H 63H 64H

ÔSH 66H 67H 68H 691-1 6AH

68H 6CH 68H

6EH 6FH

~v



5FR 3FR

DEFB IJEFJ3

. •

left

cur’osor

~ cursc,r

1AH 19l~ 0

DEF 8 DEFB DEFB ElEFEl DEFI3

-

1IJH

key code~

tlEFB EIEFEI EIEFB DEFEI IJEFEI

DEFEI



;shiFt 08H

no key ;no ke~’

;rio key

down Lf~

ï’

ight

‘t tocs DEFB DEFB DEFB DEFB DEFB DEFB DEFB

n

EIEFB

DEFB DEFB DEFB

SOI-4

70H

71H 7211 73H 74H 75H 76H 77H 78H 79H 7AH

;R ;S

; X

g NCDT1:

;

~.

03H EIEF8 DEFB

08H 09H

tIEFB

ØCH

tIEFB DEFB DEFB



;cur~o1 1~t ;rot~ry

ØAH 08H

curosor down ; cur~er up

ØDH

;enter

; cursor

DEFB DEFEI

ØEH ØFH

DEFEI DEF8

DEFB

DEFB

0 11H 12H 13H

~no key ;F1 ;F2 ;F3

DEFB DEFB DEFB DEFB

141-4 15H 16H 0

;F6

DEFB tIEFB

0 18H

10H

——

F5 ;no key CL ; RCL

DEFB DEFB DEFB DEFB

0 0 0 1FH

; no ke~y ~no kev ~no key ; MODE

DEFB

20H

DEFEI DEF8 DEFEI DEFB

0 0 0 O

DEFB

t’EFB DEFB tIEFEi DEFB DEF}3 DEFB DEFEI DEFF3 DEFB DEFF3

DEFB

~no key ;DEF

20H

——

spac~ ~no k~y :

O

;no ;no ;nçj ;no ;no ;no

0 O O9EH ø9Fl-1 2AH :281-I 0 28H 2Ell 2FH

;

(

key key

içey

ke~~’ k?v kev

;rio key —

30H

/ ——

tIEFEI DEFB DEFB DEF8 DEFD

301-i 31H 32H 33H 34H 35H 36H 37H 381-1

DEFB DEFEI DEFB

39H 0 0

9 ;no k~y ;no kc~v

DEFB DEFB DEFEI DEFB

0 3DH 0 0

;na keS,

DEFB DEFI3

DEFB

ri ght

~ON ~OFF

18H Ø8BH

DEFB DEFB

n

——



; 1

;7

;no key :n~ key

‘WIH

DEFB

DEFB

0 ~iAØF•i 097H 0381-1 ØÂ1H 08131-l ØA2H OA3H ØAIJH ØBFH ØASH 046H ØA7H Ø9EïH Ø9CH

DEFB

ØAEH

DEFEI DEFB DEFEI

0801-1 ØSEH 099H

DEFB L1EFB

092H

DEFE{ LIEFEI DEFEI DEFIJ

L~.n

DEFI3

DEFEi

DEFB DEFB LIEFE{ DEFS DEFB DEFB

W W t:

DEFB

t

W

——--

DEFEI

DEFEI DEFEi

t:

t

LIEFB DEFB DEFB

C ; D E (3 H ; I J

SØH

090H Ø9AH ~lj

095H 089H ØBÀH 098H ØOSH

Z

~NCDT2:

;shift ——

t’ •

IJEFB DEFB

1JJH 09H

DEFB

ØEIH ØEI-i

LIEFB DEFB DEFB

j:

DEFB DEFB

W: t’

DEFB DEFB EIEFB DEFB

;cur~o1 ; rot ary 1E~+t ; curo~ior’ dov~n ; cursor’ Lip

ØÀH 08H 1CR ØFH

;cur~or right 10H

;enter ; ON ; OFF

;no key

DEFB

23H 24H 25H

;F3 ;F4 ~F5

DEFB

26H

DEFEI DEFB DEFD

19H 0 181-4

LIEFB DEFE4 DEFB

21H 22H

1

2

~ ->

Ecs2~

E

C)~C

0)

E

E

E

E

E

o

E

o

(I)

C

.8

e

O

~‘ Q

Q.

Q. 5’ C)

2

Q.

(s C,

o,

n,

‘5 Q

0k

(s

ii.~ i~ (s

~

C

(s.Q~

X

(s)5~0

~

~—°

~

C

on,

X

XXXI Q — (N oooc~ e...

.0.50

~2ot

~n O (s

u-

E o

W

e

—o

c-4

Q r-. ‘Q

u, .5) C-)



(N

O LL Q W

~

E

0 t o )n(flQ (s

QQ o Q

(s Q

~ .8 ~

8 ~E

.9

E

0


o

e-

u-

Q ~

C) .8 0~0

0 (~)

O

u

e a~I

.0 U

O (N

.5

Q Q

e

0

~.~

5)

e .0

— (s

~

e.

ii~

e

e

ce



e

tocs

Recording format MODE 1

MODE 2

01H

00H

Machine language program

(a)

02H

01K

BASIC program (intermediate code format)

(e)

02H

02H

RESERVE contents (internai code format)

(a)

04H

04H

BASIC program (ASCII format)

(b)

04H

04H

08H

04H

File type

~.

~ format cf a file”.)

Data (ASCII format)

f

Data (special format)

F

(b) (c)

(3) Data block structure (See item (1) above.) (e) BASIC pregram (intermediate-coded), Machine language program, RESERVE contents Program data

WH

n bytes

=

Data aise

H

(b) BASIC program (ASCII saved), Data (ASCII format)

(c)

e ASCII data are hàndled in: blacks cf 256 bytes. e The end of e file is detected when an EOF cade (1AH) is enceuntered. e If the last black (the biock that includes an EOF code) is less than 256 bytes, meeningless data are automatically added et the end cf the data (the part indicated by * in the above figure) ta make it as e complete 256-byte block. Data (Special for-mat) • Status part The status part ccnsists of 5 bytes and hes the fallowing structure.

tocs

r a

b

c

d

bit7

b(tO

Number of characters )(n bytes) in the array elements 1 [ o Numericarray array 88H

~

J e String

...

...

J

J

Number 0f bytes in the Number oftwo-d(mensiona( array e)ements minus 1 (This (s 00(4 for one-d(mensional array variables or non-array variables.) Number ofor,e-dimensional array elements minus 1

array etements (50(4 max.) 1 ... Numer)c O ... String

(Thia is 00(4 for non-array variables.)

~-

.Date size of one srray element plus 3

Value of e, b, c, and d (hex)

Variable type

Data~size(bytes)

88

Numeric data (e.g., A, B)

8

00

10

String data (e.g., A$, B$)

16

19

00

88

@ (*)

208

O1A3

19

00

10

@$(*)

416

a

b

c

88

Numeric array

c

d

String array

a

b

c

d

000B

00

00

0013

00

OOD3

a

L

b

(b+1)~(C+1)~8

L

(b+1)~(C+1).~d

• Date part The data part contains the contents of one element of en ar-ray variable in the internai code format (see section 4.1.3).

[21 Cassette tape physical format (1) Bit structure One bit (SHORT...expr-esses the value “0”; LONG

...

expresses the value “1”) ccnsists cf the

follawing pulses. Pulse width (~.ts)

I 9fl

e

163

b

164

C

409

d

409

tOCS ~Thesepulse widths are the default values. They can be changed by changing the contents cf the cassette tape work area. (See section 3.11.3 for details.) (2) Header structure

Checksum (2 bytes)

(3) Data block structure

Checksum (2 bytes)

~ln the double write mode, the following contents are added at the position indicated by V. In principle, however-, the PC-1600 does net use the double write mode. I

SHORT (256 bits)

J

Data (header or data

block)

H

J

L

Checksum bytes)

(2

(4) Byte structure LONG (lb)t)

b(t 7

6

5

4

3

1

2

1

bit 0

byte

(5) Checksum structure The checksum (s the value et the lewer 2 bytes of the sum of ail LONG bits appearing in the data excluding the first LONG bit at the beginning cf each byte within the header or data block.

.4

n-4

tocs 3.11.2 PC-1500/PC-1500A Mode (Mode 1) [1] Cassette tape Iogic& format (1) Recording format cf a file (a) BASIC program, Machine language pregram, RESERVE contents V I

Leader

GAP (1) (260 ma)

Header

(8.01 sec.)

(b) Data Leader (8.01 sec.)

J

Header

Data black

GAP (1) (1026 ma)

J

Data 1 statue

GAP (1) (252 ms)

J~

Data 1

j

GAP (1) (1026 ms)

Data 2 status

*y: The cassette tape stops. V: The cassette tape starts.

e: Leader/GAP is Stop bit “1”. (see Bit structure) (2) Header structure 000000

0000000000 789ABCDEF

1111111111111111 012345 ~0 010 0 0 0 0 0 0 0 010 0 0 0 0 0 0

-~

H_[H

H

H

H

H

H

HIHILIHILIHIL

File name • Left-justified SA space, if any, ta filled with 00H codes. e If a file name is omitted, the area is filled with 00H codes.

Machine language program ...

Execution start address after loaded. (Ifthia is FFFFH, no execution address is asaumed.) • Otherthan machine language program ... 0000(4

f File mode I

• 00H: Machine language

• Data file ... 0000H • Other than data file ... Data size (bytes) minus 1

• 01H: BASIC program • 02H: RESERVE contents • 04(4: Data

• Machine language program address

...

Load start

• Otherthan machine language program undefined

1

A

0

1 1

111 111 234567

H

HH

(4H

Continue

HH

Header Mark

4 bit Data

I ‘V)

f

t~Çy

(3) Data block structure (See item (1) above.) (e) BASIC program, Machine language program, RESERVE contents

n bytes

=

Data sise

(b) Data • Status part The status part censists cf 5 bytes and has the following structure.

r

b

c

d bit7

• String array ...

Number 0f characters (in bytes) in the array elements • Numeric array ... 88H

~

Number 0ftwo-dimensiorjal array elements minus 1 )This la 00H for one-dimensional array variables or non-array variables.) Number

~I[J J I I II J tf

r’Jumber of bytes in the array elements I. 150H max.)

of one-dimensional array elementa minus 1

(This is 00H for non-array variables.)

bitO

1 O

... ...

Numeric String

~{ Data size of one array element plus 3) Value cf e, b, c, and d (hex) e

J

bi

c

d

Variable type

Data size (bytes)

000B

00

00

88

Numeric data (e.g., A, B)

8

0013

00

00

10

String data (e.g., A$, B$)

16

00D3

19

00

88

@ (~)

01A3

19

00

10

@$(~~)

e

b

c

88

a

b

c

d

f

Numeric array

String

208 416 (b+1)~(C+1)*8

(b+1)*(C+1)*d

e Date part The date part centains the contents cf one element cf an arr-av variable in the internaI code for-mat. (For details cf the internaI cade format, see section 4.1.3.ln section 4.1.3, it (s explained that the MSB cf the string starting addr-ess (s inverted. However, this does net apply here.)

I 9’~

tocs [2] Cassette tape physical format (1) Bit structure One bit (value “0” or- “1”) censists cfthefollowing pulses.

(2.54 kHz)

0:

I

L

11.27 kHz)

(2) Byte structure I

bit

bit 7

II

bit 6

II

I

I

bit 5 jJ bit jJ

IStop bit “l’

I

J

I~tartI I bit jI bit3 ~

bit 2

bit 1

I

bit 0

I

I

I

J

Stopbit”1’

[start~

(3) Header structure Leader (8.01 sec.l

IJ

Jj

Header

Jj

Checkaum Space



1260 ms for data file 260 mc for otherthan data file

J

j

Data

The checksum lathe value 0f the Iower 2 bytes of the sum of ail ~ bytes appearing in the data excluding the first digit 0f the headér (code AH).

(4) Data black structure (e) BASIC program, Machine language pr-ogr-em, RESERVE contents

J

80 bytes of data

J J Check-j sum

LLower

80 bytes of data

0f data

‘Check-’ sum

) ~

j

~st data biock

J

Check..I sum j

J

Space (262 ms)

55H

—*~FiIeEnd Code

Lower 2 bytes 0f the sum 0f aIl 80 bytes 0f data 0f tha L,,last data block (If the last data block is less than 80 bytes, the checksum is calculated to that number 0f data bytes.)

2 bytes 0f the sum 0f aIl 80bytes

(b) Data

I 9,1

tocs 3.11.3 Work Area used for Cassette Tape Recorder Address

Name

SHORT HIGH

SHORT LOW

Contents

F197H

• Specify the “high” period of the SHORT (0) pulse in the PC-1600 mode. e The default is 30. J11T1[ (See note 1)

F198H

• Speci~the “low” period of the SHORT (0) pulse in the PC-1600 mode. J e The default is 23. }iiiiiif (See note 1) ~ ~

j e Specify the “high”,period of the LONG (1) pulse in the PC-1600

LONG HIGH

F199H

mode. • The default is 79.

(See note 1)

• Specify the “iow” period cf the LONG(1) puise in the PC-1600 mode. • The defauit is 71. (See note 1)

LONG LOW

F19AH

CHECK SUM

F19B—’CH

INFORMATION LEADER

F19DH

• Specify the Iength cf the leader (no signal) part cf the header. •: The default (s 80. (See note 2)

INFORMATION TRAILER

F19EH

• Specify the Iength cf the trailer (no signal) part cf the header. • The default is 20. (See note 2)

INFORMATION SHORT 1

F19F—AOH

INFORMATION LONG 1

FiAi H

INFORMATION SHORT 2.

F1A2H

DATA SHORT 1

F1A3.—.4H

DATA LONG 1

F1A5H

• A data block gap parameter which specifies the number cf continucus LONG pulses for the first time. • The default is 20.

DATA SHORT 2

F1A6H

• A data biock gap parameter which specifies the number- cf continuous SHORT pulses for the second time. • The default (s 20.

DATA TRAILER

F1A7H

e Checksum calculation register-

A header gap parameter which specifies the number cf continuous SHORT pulses for the first time. e The default (s 10000. e

• A header gap parameter which specifies the number cf continuous LONG pulses for the first time. e The default is 40.

A header gap parameter which specifies the number of continuous SHORT pulses for the second time. • The default is 40. e

• A data block gap parameter which specifies the number cf continucus SHORT pulses for the first time.

• The default is 11000.

f

RPOINT

J

• Specify the length cf the traiier (no signal) part cf a data block. •

The default is 40.

(See note 2) Specifythe threshold level to be used for judgment whether e bit data read is e LONG or a SHORT pulse. If the bit data (s less than this threshold level, (t is judged as a SHORT pulse. • The default is 22. e

F1A8H

j9Ç

tocs 3.11.3 Work Area used for Cassette Tape Recorder Name

Address

Contents e Specify the “high”

SHORT HIGH

F197H

SHORT LOW

F198H

period cf the SHORT (0) pulse in the PC-1600

mode. (See note 1)

• The default is 30.

Specify the “low” period of the SHORT (0) pulse in the PC-1600 mode. e The default (s 23. (See note 1) e

Specify the “high” period cf the LONG (1) pulse in the PC-1600 mode. e The default is 79. (See note i) e

LONG HIGH

Fi 99K

LONG LOW

F19AH

J.

e

Specify the “low” period cf the LONG(1) pulsé in the PC-1600

e

The default is 71. mode. (See note 1)

CHECK SUM

F19B—CH

• Checksum calculation register

INFORMATION LEADER

F19DH

INFORMATION TRAILER

F19EH

INFORMATION SHORT 1

Fi9F’—AOH

• A header gap parameter which specifies the number cf continucus SHORT pulses for the first time. e The default (s 10000.

INFORMATION LONG 1

F1A1H

e A header gap parameter which specifies the number of continuous LONG puises for the first time. • The default (s 40.

INFORMATION SHORT 2

F1A2H

• A header gap paremeter which specifies the number cf continuous SHORT pulses for the second time. e The default (s 40.

Specify the Iength cf the leader (no signal) part cf the header. • The default (s 80. (See note 2) • Specify the Iength cf the trailer (no signal) part cf the header. • The default (s 20. (See note 2) e

.

DATA SHORT 1

F1A3—’4H

A data block gap parameter which specifies the number cf continucus SHORT pulses for the first time. • The default (s 11000.

DATA LONG 1

F1A5H

• A data black gap parameter- which specifies the number- cf continuous LONG pulses for the first time. e The default (s 20.

DATA SHORT 2

F1A6H

A data block gap parameter which specifies the number cf cont(nucus SHORT pulses for the second time. e The default is 20.

DATA TRAILER

F1A7H

e

e

length cf the trailer (no signal) part cf a data block. • The default (s 40. (See note 2) e Specify the

to be used for judgment whether a bit data read (s e LONG or a SHORT pulse. If the bit data is less than this threshold level, it (s judgeci as a SHORT pulse. • The defeult is 22. e Specifythe threshold Ievel

RPOINT

F1A8H

125

tocs ç 3.12 MEMORY ~.12.1Silots and Memory Modtiles

Banko

euuL.

Bankl Si ~

Bank2

Bank3

_~_—S2------.~~

rnnr Main memory

SIot 1 (Si)is allocsted to the memory locations 0f 8000H to BFFFH 0f bank O and 8000(4 to BFFFH 0f bank 1.

FFFF Slot 2 (S2) is allocated to the memory locations of 8000H to BFFFH of bank 2 and 8000H to BFFFH 0f bank 3. Each module uses a part 0f or the entire memory locations allocated to that siot as shown in the figures. Those memory Içcations ofthe shaded part are flot used. Note: Even when a memory modulais installed in 51 or S2, if if is used as an extension memory, it is referred toas SO.

These modulas can be installed onlyinslotl (51).

euuI, CE-181 These modules

can be installed in aither dot 1 (Si) orslot2 )S2).

BFFF 8000. CE-1600M BFFJ

I f~

7

tocs 3.12.2 Work Area used for Memory (1) Wdr-k area used te specify the order in which e BASIC pregram (s loaded into banks.

Contents

Name

Address

SOMTb

FO2AH

First bank cf SO

S1MTb

FO16H

First bankofthe program module in Si

S1MBb

F018H

Lest bank cf the program module in Si

S2MTb

FO2OH

Fîrst bank cf the program module (n S2

S2MBb

F022H

Last bank of the program module in S2

Name

Address

ADTBL+1

F1D6H

ADTBL+2

F1D7H

ADTBL+3

Fi 08H

ADTBL+4

F1D9H

ADTBL+5

F1DAH

The bank information is stored in bits 4 and 5 of each ofADTBL+1 to ADTBL+5. If the value of bits 4 and 5 is 00H, this means “unused”. (Example) 01H Indicate bank 0. 32H Indicate bank 3. 00H unused If SOMTb, Si MTb or S2MTb conta(ns e value between 1 te 5, the bank information is stored in the memery locations star-ting from ADTBL plus that value. For instance, if the value (s 5, the bank information is in locations starting from ADTBL+5. If the value is other than 1 ta 5, this means “un used”. Example 1: When installing CE-159 in Si and CE-1600M in S2 and using them as an extension memor-y ... ...

...

BankO

Bankl

Bank2

Bank3

~5i~~-S2~

E~EE~j~~” CE-159

Main memory FFFF

4 nt~

CE-1600M

SOMTb S1MTb S1MBb S2MTb S2MBb

03K The bank information is in the locations from ADTBL+3. FEH Si is flot used as a program module. ? J (lt is used scan extension memory.) FEH )~S2 is not used asa program module. ? J (It is used asan extension memory.)

ADTBL+1 ADTBL+2 ADTBL+3 ADTBL+4 ADTBL+5

00H 00(4 01M 22H 32(4

Unused Unused BankO Bank2 Bank3

In this example, theprogram is loaded into bank O, bank 2,bank 3 and the main memory in that order.

Bankl

Bank O

Bank2

Bank3

A000 r.nnr

L -

FFFF

Example 2: When installing CE-1600M (n module

BankO

Si

Bankl

and CE-161 in S2 and

Bank2

SOMTb S1MTb S1MBb S2MTb S2MBb

05(4

~ J

S2 is ADTBL+4.

ADTBL+i ADTBL+2 ADTBL+3 ADTBL+4 ADTBL+5

0011 B1H 11H A2H 00H

Unused BankO Bankl Bank2 (Jnused

BankO

Bank3

SO is from ADTBL+5.

~ } Si Is from ADTBL+2 to ADTBL-l-3.

Bankl

Bank2

I

Bank3

32 program loading order 1 program loading order

FFFF

using

‘SO program loading order

.4

them as an program

tocs 3.12.3 ROCS Routines for Memory Contr& This section describes the IOCS routines te be used for memory central. The table below Iists the names, entr-y addr-esses, and functions cf these routines. Name

Entry address

Function

MEMORYCHK

01 80K

Check whether or not memory exists et a specified location (bank and

BAN KSET

0190H

Change the bank of e specified page.

BAN KREAD

0i93H

Read the bank number cf a specified page.

SLOT1MAP

0196K

Setthe mapping cf slot 1.

SLOT2MAP

0199K

Set the mapping cf slot 2.

BANKJUMP

O19CH

Inter-bank jump

BANKCALL

Oi9FH

lnter-bank calI

BANKCALL2

0020H

lnter-bank calI using RST 20H

~6e. ~

Ou~i~ (~,P Li~ ~‘,(~)

cl

e~L L~!~~ iY.-~r

por

(~,f-

Lb

~I~)

A t’.

-~

L

-~

c~ALl—

ç)

Lt~.

~1On

MEMORYCHK Entry Address

O18DH

Function

Check whether or net memer-y exists at a specified location (bank and addr-ess).

Parameter

D = Bank number (00H ta 07M) E = Address: Upper 5 bits (40H te B8H) The other bits are aIl “0”.

Return

CF CF

Affected Register

= =

1 : No memery ex(sts et the specif(ed location. O : Bit O of A r-egister = 1 Bit 1 cf A register = 1 O

Memory exists.

The memory is ROM. The memory is RAM.

AF

BANKSET Entry Address

0190H

Function

Change the bank number of the page spec(fied by B register to the new bank number specified by A register.

Parameter

B A

= =

Return

CF

Affected Register

AF

=

Page number (01H ta 03H) Bank number (00H ta 07F-4) 1 : An (nvalid page number was specified.

Bank No.

Address

o

Page No. 2

3

1 ~1

tocs BANKREAD Entry Address

0193H

Function

Read the banknumber cf the page specif(ed by B register.

Parameter

B

=

Page number (01K te 03H)

Return

A

=

Bank number (00H to 07H)

Affected Register

AF, B Bank No. Address

Page No.

0

1

0000M





4UU1JII





snnn





r.nnnl.





2

3

4

6

2

3

SLOT1 MAP Entry Address

0196H

Function

Spec(fy ta which bank and page the Iast half 16 KB of slot 1 (s mapped.

Parameter

A A

00H : The lest half 16 KB of slot 1 (s mapped ta bank 1, page 2. 01H The last half 16 KB of•slat 1 is mapped ta bank 1, page 2 and bank 1, page 1. The fallowing shows the mapping diagrams of the above two cases. In the diagram, “a” and “f3” represent the fir-st half 16 KB and the last half 16 KB cf slct 1, respectively. =

=

O A=O

Page

O 1 2

e

3

Bank 1 2

3

o A=i Page

i 2

5

6

7

Address 0000(4

~H. ~L~._I

[._1

8000H C000H

Bank ~

4

234

6

7

Address 0000H 4000(4 8000H C000H

3

Return

none

Affected Register

AF

tOCS SLOT2MAP Entry Address

01 99H

Function

Specify ta which banks and pages the first half 16 KB and the last half 16 KB cf slot 1 are mapped.

Parameter

A = 00M

The fir-st half 16 KB cf slot 2 is mapped ta bank 2, page 2, and the last half 16 KB is mapped ta bank 3, page 2. A = 01H : The first half 16 KB of slot 2 (s also mapped te barik 1, page O. = 02H : The first half 16 KB cf slot 2 is mapped ta bank 1, page 1, and the Iast half 16 KB (s mapped te bank 1, page 0. However, if bank 1, page 1 (s used for slot 1, the first half 16 KB of slot 2 is flot mapped te that location. The following shows the mapping diagrams cf the above three cases. In the diagram, “ix” and “13” represent the first half 16 KB and the~iasthalf 16 KB of slot 2, respectively.

Bank i

o I

I—

O’ A=OOH Page

~

I

Page

01 1

4

5

6

2

C000H

3

4

5

6

e

o

8000H

I—

C000H

e 2

If bank 1, page lis used for slot 1 Bartk 0 1 2 3 4 5 6 7 Address

0000K

~ e

—i 4000H 8000H

o Page

i 2

C000H

none

Affected Register

AF

0000K

~ e

4000M 8000K C000H

3

Return

7 Address 0000(4 4000(4

If bank 1, page lis flot used for dot 1 Bank 0 1 2 3 4 5 6 7 Address

A = 02H

Address

7

8000H e

2 3

Page

3

L-.

21I—. 3 Bank 0 i

A=O1H

2

__________________ 0000H

tocs

BANKJUMP Entry Address

019CM

Function

Jump te an address (specified by HL’ register-) cf a bank (specif(ed byA’ register).

Parameter

A’ HL’

= =

Bank number Address

Return

Control does net retur-n because this is a jump operation.

Affected Register

AF’, BC’, DE’, HL’

BANKCALL Entry Address

O19FH

Function

CalI an addr-ess (specif(ed by HL’ register) cf e bank (specified by A’ register-).

Parameter

A’ HL’

= =

Bank number Address

Return

none

Affected Register

AF’, BC’, DE’, HL’

BANKCALL2 Entry Address

20H (To call this routine, use the format: RST 20H.)

Function

Same as BANKCALL routine except for the call format

Parameter

Write 3 bytes cf data (bank number and address) immediately after the RST 20H instruction.

Low byte

E7H RST2OH

Banknumber (0—7)

I ‘3A

High byte Ad~ess

3.13 MEMORY MODULE 3.13.1 Location of Memory ModLile A memory module is a ROM or RAM module cf a minimum cf 4 KB and is used by setting it in slot 1 or 2. The following describes the relationship between the memory capacities, the slot numbers, and the memory locations. Bank

0

1

2

3

4

5

6

7

(1) Memory module of 16 KB or less e SIot 1: The memory module (s mapped te location A. e SIot 2: The memery module is mapped ta location C.

(2) Memory module cf 32 KB e Slot 1: The memory module is mapped te locations A and B. e SIot 2: The memory module is mapped te locations C and D.

(3) Memory module cf 48 KB or- more e SIot 1: Cannot be used. e SIot 2: The 32 KB part cf the memor-y module (s màpped ta locations C and D, and the r-est of the memory module can be mapped to locations C and D through the bank switching.

3.13.2 Type of Memory Modu’e The memory modules are classified inte four- types depending on how they are used. (1) Extension module (RAM module only) This madule is used to extend the main memory. (2) Program medule (ROM or RAM module) This module is used te store e program. (3) File module (ROM or RAM module) This module is used te save and load data, like e disk unit. (4) System software module (ROM or RAM module) This module (s used ta store a machine language program that can be automatically runat power-on time. The type cf memary module is identified by the header- data (the f(rst 8 bytes cf the module). If it is e ROM module, (t cannat be used as a d(fferent type cf module (e.g., a ROM progr-am module can be used enly as the progr-am module,) however, e RAM module can be used as a different type of module by spec(fying (t by a BASIC command. For any type cf module, enly one header is placed in location A or- C (see the figure in section 3.13.1).

tocs 3.13.3 Header Structure of Memory Module (1) Header of system software module

+0

55H

+ 1

00K

+ 2

Execution address (Low byte)

+ 3

Execution address (High byte)

+4

00H

+ 5

00H

+6

00H

+7

82K

+ 8

4

Must always be 00K.

~

System software entry address

Unused

System so~arearea

136

CHAPTER 4 BASIC INTERPRETER

137

BASIC INTERPRETER 4.1 FUNCTIONS HANDLING AND INTERNAL EXPRESSION 4.4L1 Intermediate Codes of Functions

The reserved words cf BASIC are developed te 2-byte (ntermediate codes (internaI codes) in memcry. The 2-byte intermediate code cf a BASIC function has a value between 50K te 7FH (n its Iow byte, depending en the kind cf function. The functions are classif(ed as follows: 50H te 51H: Operators 52H ta 5FH: System variables 60H te 7FH: Functions The intermediate cade table cf the functions is given below. High byte: E8H

Low byte

Upper4 bits

0

1

2F3

4

5

6

7

8~9

A

B

C

D

E

F

i~iIi__L .0

w

~ 4

o

5 6 7

DEV$

8

COM$

9

INSTAT

j —I

~

B C D E F

•100

J —

High byte: FOH Upper4 bits

Low byte

0r21314

~

~ ~—~-i-----1

—--H-—

SPACE$t

—~--~-—

F”TE~H~E~Hiiiiii ~ 8

~

~

I

I

A

L_____—-————-—————---———--———

i

-~-

c

F

~

t~t~iiiiiiuiii

~ Kigh byte: F1H

Low byte

tipper 4 bits

0

1

2

3

4

5

w w s

e

7

O

AND ASC ABS

1

OR

2 .0

6 STR$

INT

VAL RIGHT$

3

CHR$

ASN

4 5

LEN ACS DEG ATN

6

DMS

LN

7

STATUS LOG

8

MEM POINT EXP

9

SGN

,

A

LEFT$

B

TIME SQR MlD$

C

INKEY$

D

PI

RND

NOTJ~~

E

XPEEK#

COS

F

XPEEK~TAN

139

8

9

A

B

C

D

E

F

BASIC INTERPRETER High byte: F2H Upper4 bits

Low byte

0

1

2

3

4

5

o

6

7

8

9

A

B

C

D

E

F

MOD

2

w 3 w s o 4 —I

HEX$

.0

AIN

5 6

T 1

8 —

ï

I__



ATIMEsj C

INSTR

D E

ALARM$

F

WAKE$

4.12 Arithmetic Reg~sters When you want te use an IOCS routine ta perfcrm en arithmetic operation, you must prepere in advance necessary arguments cf numer-ic values er strings in the arithmetic registers provided in the BASIC work area. There are seven ar-ithmetic registers: X, Z, Y, U, V, W, and S. Each register uses 8 bytes cf spece in the work area. An argument can be set into an ar(thmetic register (i.e., into the memory location ellocated ta a particular ar(thmetic register) in the format described in section 4.1.3. The following shows the arithmetic registers and their memory locations. Register

Address

X

FAOOH



Z

FAO8H



Y

FA1OH



U

FA18H—FA1FH

V

FA2OH

—‘

FA27H

W

FA28H



FA2FH

S

FA3OH

-—

FA37H

FAO7H

FA17H

(These are the addresses v(ewed from SC-7852 (Z80).)

lAfl

I3ASIG INTERPRETER 4.1.3 InternaI Expression of Numeric Values and Strings (1) Decimal (BCD) expression cf a numeric value A numeric value is expressed in an 8-byte format which ccnsists cf the exponential part, the mantissa sign, and the mantisse part. Th(s expression format can express a value between —9.999999999 X 10~~ and 9.999999999 X ~ Higher address

Loweraddress





Exponential

Mantissa

part

sign

L

Exponential part: Mantissa sign:

00K

Mantissa part

negative value is expressed as a comple-

Expressed in one binary byte. (A

ment.) 00H represents the plus sign. 8OH represents the minus sign. Expressed in BCD. ... ...

Mantissa part:

[Example] e When setting 123 (or- 1.23 x 102) in X register PAOO 02H

e

FAO7 00K

12H

30K

00H

00H

00K

00H

When setting —0.0123 (or —1.23 X 10~)(n Y register I~A10 FEH

FA17 80K

12H

3OH

00H

00H

00H

00H

(2) Biner-y expression cf a numeric value A numeric value is expressed in the follow(ng 8-byte format (altheugh 5 bytes cf (t are net used.) This expression format can express e value between —32768 and 32767. Lower add ress *

Higher address *

*

Don’t care

—, *

Kigher .—.--———-,

B2H

Lower

‘-________

Binary nurr~er

—,

(A negative is expressed as a complement.)

* ‘—.--———-

Don’t care

BASIC INTERPRETER [Example] When setting 123 (or OO7BH) in X register

itt

FAO7H

FAOOH 00H

00(4

00H

00(4

B2H

00(4

78(4

00H

When setting -123 (or FF85H) in Y register FA10H 00(4

FA17H 00H

00H

00(4

82H

FF1-I

85H

00H

(3) InternaI expression of a string A string cf char-acter-s are represented by the string information that specifies the memory locations where the actuel char-acter String data are stored. This string information is expr-essed in the following 8-byte format (although its Iower 4 bytes are net used.)

L

*

*

*

*~

00K

Don~tcare

DOH

AODH

A0DL

String length: OlHto 50H String starting address: 000H to FFFFI-)

LENGTH

Starting address of String Iength (Number of characters) the memory locations where the charecter string dataere stored

)The MSB of ADDH (address high byte) s inverted. it For instance. if the starting address s FB1OH, then 7BH and 10H should be set in AODH and AO0L, respectively.)

[Example]

When the char-acter string “PC-1600” (s (n the string buffer (FB1OH ta FB5FK) and ycu want te set the string information in X reg(ster

L

J

00K

7BH

1OHJ

07H

1

Don~t care

‘J?

FB1OH 50(4

43H

1,19

FB16H 2DH

31H

36(4

30H

30H

bASIC INTERPRETER 4.1.4 Function Operation Subroutines (1) Numericfunctions (al One-variabte functions (in the case et a function which accepts only one numeric value as the argument) 1. Set the argument (in BCD expression) in X register. 2. Set the intermediate cade cf the desired function in DE register. 3. Set “01H” in addr-ess F88CH (the wor-k area that specifies the number of arguments). 4. CalI 0202H (with the CALL instruction cf Z80). When the function subroutine is completed proper-ly, CF is set te “0” and the result is stored (n X register. If the subroutine has r-esulted in an errer, CF is set te “1” and the error code (same as used for BASIC) is stored in A register. Affected registers: ML, DE, BC, AF, AF’ The PC-1600 has the following one-variable functions.

Square root

SQR X LN X

X

—*

X

-~

Logarithm

LOG X—~X Exponent Tr(gonometric functions

EXP X

—~

SIN X

—~

DMS (degree,

X

COS X —t

TAN X Inverse tr(gcnometr(c functions

X

X

-*

ASN X—i.X

I

ACS X -+ X

I

ATNX—+X DEG X X —~

minute, second)

conversion

DMS X

—*

Absolute

ABS X

—*

Sign

SGNX—~.X

lnteger

INTX—i.X

Negate

NOTX—~X

Random number

RND X

Machine language Machine language

Dot pattern

X X

—~

X

XPEEK (n) X

—*

PEEK X

X

—~

STATUS X

POINT X

—+

—~

X

X

X

BASIC tNTERPRETER (b) Two-variable functions 1. Set the arguments (in BCD expression) in X and Y registers. The operand should be set in X register. (For instance, ta compute 10 9, set “10” (n X and “9” (n Y.) 2. Set “02H” in addr-ess F88CH (the work area that specifies the number cf arguments). 3. CaI1 the entry address cf the desir-ed function. -

Funct(on

Entry address

+

O21AH



O21DH 0220K

I

0223H

A

01F3H

AND

01F6H

OR

01F9H

When the function subroutine (s ccmpleted pr-operly, CF is set ta “0” and the result is stored in X register. If the subroutine has resulted in an errer-, CF is set ta “1” and the errer code (same as used for BASIC) is stor-ed in A r-egister. Affected r-egisters: ML, DE, BC, AF, AF’ (C) Relational operations 1. Set the arguments (in BCD expression) in X and Y registers. Theoperand (the value te be compared) should be set in X register. (For- instance, ta compute 10 < 9, set “10” in X and “9” (n Y.) 2. Set “80H” in D register and set the internaI code cf the desired function (relational operator) in E register.

Operator Internai code (te be set in E)

00H




02H

=

04H

=

06H

3. Set “02M” in address F88CH. 4. CaII O1FCH. If the comparisen (s true, “1” (s stored in Xreg(ster. If Affected reg isters: HL, DE, BC, AF, AF’

-4

dIA

it (s

false, “0” (s stored,

bASIC INTERPRETER (2) String functions (al One-variable function (in the case cf a function which accepts only one numeric value as the argument) 1. Set the argument (in either 8GO or binary expression) in X register. 2. Set tlie intermediate code cf the desired function in DE register. 3. Set “01K” in address F88CH and “10H” in address F894H (the string buffer pointer). 4. CaIl 0202K. When the functicn subroutine is compieted properly, CF is set te “0” and the result (the string information expressed in the following internai format) is stored in X register. X registerFAO4

FAOO

J

J

00K

FAOS

J

FAO6

High byte

J

10w byte

FAO7 string len0th]

SterLing address 0f the memory locations in which the resultant character data are stored The MSB 0f the high byte of the starting address s inverted. (Example) If the following resuit is stored in X register: FAO4H = DOH

FAO5H = 7BK )interpreted as FAO6H = 10H FAO7H = 10H this string information indicates a string of 16 the memory locations starting from FB1OH.

1= 10H) characters stored in

The PC-1600 has the only one string function of this kind: STR$. Affected registers: HL, DE, BC, AF, AF’ (b) One-variable functicns (in the case cf a function which accepts only one string data item as the argument and gives a numeric value as the result.) 1. Set the argument (string information) in X register-. The actuel string data must be prepared in the string buffer (the area starting from FB1OH). 2. Set the intermediate code cf the desired function in DE register-. 3. Set “01H” in address F88CH. 4. CaII 0202H (with the CALL instruction of Z80). When the function subroutine is completed properly, CF is set to “0” and the result (expressed in either BCD or binary expression) is stored in X register. If the subro~itinehas resulted in an error, CF is set to “1” and the error code ~sameas used for BASIC) is stored in A register. Affected reg isters: HL, DE, BC, AF, AF’ The PC-1600 has three functions cf th(s kind: VAL, ASC and LEN. (c) Two-variable functions RIGHT$(string, numeric value) and LEFT$(string, numeric value) 1. Check whether there is a free space cf 8 bytes in the BASIC stack area (FA38H to FAFFH). This function subroutine can be executed (f the following relation (s satisfied: (Content cf F890H) < (Content cf F891 H) 8 2. Set the string information (nto addresses from (content of F890H)+4 to (content of F890H)+7: ...



BASIC INTERPRETER

Address

Data

(Content of F890H)+4

DOH

(Content cf F890H+5

Starting address cf the memory locations where the actuai string data are stored (H(gh byte)

(Content cf F89OH+6 (Content cf F890H)+7

Starting address of the memory locations where the actual string data are stored (Low byte) String length

and set the actuel string data in the string buffer (FB1OH to FB5FH). When setting the high byte of the string starting address into address (content cf F890H)+5, invert the MSB cf the high byte. For exemple, when a string cf eight characters are already stored in the string buffer start(ng from its top, set the following string information:

Address

Data

(Content cf F890H)+4

DOH

(Content of F890H)+5

7BH

(Content cf F890H)+6

10H

(Content cf F890H)+7

08H

3. Set “(content cf F89OH)+8” (ntc address F892H (the data pointer). 4. Set the numeric argument (in e(ther BCD or binary expression) in X register. 5. Set the intermediate code cf the des(red function in DE register.

6. CaIl 0202K (with CALL instruction et Z80). When the function subrout(ne (s compieted properly, CF is set ta “0” and the result (the string information expressed in the internai format) is stored in X register. The actuel resultant char-acter data are stored (n the string buffer. If the subroutine has resu lted in an errer, CF is set te “1” end the errer code (s stared in A register.

Affected registers: HL, DE, BC, AF, AF’ (d) Thr-ee-variable functien MID$(string, numer(c1, numeric2) 1. Check whether there isa free space of 16 bytes in the BASIC stack area (FA38H ta FAFFH). This ...

function subroutine can be executed if the following relation is satisfied:

(Content cf F890H)

< (Content cf F891 H)



16

2. Set the string information into addresses from (content cf F890K)+4 te (content cf F890H)+7:

Data

Address (Content of F890H)+4

DOH

(Content cf F890H)+5

Starting address cf the memory locations where the actual string data are stored (H(gh byte)

(Content cf F890H)+6

Start(ng address cf the memory locations where the actuel string data are stored (Low byte)

(Content cf F890H)+7

String Iength

I

bASIC

INIERPHEIEK

and set trie actual string data in the string buffer (FB1OH te FB5FH). When setting the high byte cf the string start(ng address intoaddress (content cf F8SOH)+5, invert the MSB cf the high byte. For example, when a string cf eight cher-acter-s are already stored in the string buffer start(ng from its top, set the following string information:

Address

Data

(Content cf F890H)+4

DOH

(Content cf F890H)+5

7BH

(Content cf F890H)+6

10H

(Content cf F89OH)+7

08H

3. Set the third argument numer(c2 (expressed in either BCD or biner-y expression) inta eddresses tram (content cf F890H)+8 to (content cf F890H)+15. 4. Set “(content cf F890H)+16” into address F892H (the data pointer-). 5. Set the second argument numerici (in either BCD or biner-y expressicn)in X register. 6. Set the intermediate code cf the desired function (i.e., F17BH in the case cf MID$ function) in DE register. 7. CalI 0202K (with CALL instruction cf Z80). When the function subroutine is completed properly, CF (s set te “0” and the resuit (the string information expressed in the internai format) is stored in X register. The actual resultant char-acter data are stored in the string buffer. If the subroutine has resulted (n an error, CF is setto “1” and the errer code is stored in A register. Affected register-s: HL, DE, BC, AF, AF’ (e) Relational operations (str(ngl, operator, string2) 1. Set stringi and str-(ng2 in X and Y register-s, respectively. These string arguments must be expressed as the string information in the internai fer-mat. 2. Set the internai code cf the desired function (relationai aperator-) in DE register. D = 80K

Operator

Value te be set in E

< >

DOH

=

01H 02K 04K

3. Cail O1FFH (with CALL instruction of Z80). if the ccmperiscn is true, “1” (s stored in X register. If (t is false, “0” (s stor-ed. Affected registers: HL, DE, BC, AF, AF’

I A7

BASIC INTERPRETER

4.2 BAS~CPROGRAM TEXT HANDUNG 4.2.1 Subroutines for Numeric Value Handiling This section describes the subroutines ta convert between the internaI decimal (BCD) codes and the internai biner-y codes. In the following explanatians, the content cf X register is an address for Z80, specifying a memory location between FAOOH and FAO7H. For the format of data written in X register, refer- te section 4.1.3 “InternaI Expression cf Numeric Values and Strings”.

BCDBIN Entry Address

0247 H

Function

Convert e numer-ic value (between O and 65535) expressed in an 8-byte BCD code into a 2-byte binary code, with the fractional part rounded off.

Parameter

X = Numeric value expressed in the BCD cade

Return

CF

=

CF

=

Affected Register

0: NormaI terminaticn DE = Conversion result (If the result (s “0”, then ZF is set te “1 “.) 1: An errer- has occurred. (The error code is returned in A register.) A = 13H: The value cf the operand is eut of the range. A = 07H: The value of the oper-and (s not expr-essed in the BCD code.

AF, BC, DE, ML

BCB~NS Entry Address

0241 H

Function

Convert a numeric value (between —32768 and 32767) expressed in an 8-byte BCD code into e 2-byte binary code (w(th a negative value expressed as a complement). The fractional part (s r-ounded off.

Parameter

X

Return

CF

=

CF

=

Affected Register

=

Numeric value expressed in the BCD code 0: Normal termination DE = Conversion resuit (If the result (s “0”, then ZF is set te “1 “.) 1: An error has occurred.

Ail reg isters

bASIC lNftKI~$lIEl1

BI2BCD ~ntry Address

024AH

~unction

Ccnvert e numeric value expressed in a 2-byte binary code into a BCD code.

Parameter

DE

Heturn

X = Conversion result (8GO code)

Affected Reg ister

Alt reg isters

Numeric value expressed in the binary code

=

4.2.2 Subroutines for ASCII Code Conversion HTOA Entry Address

0283H

Function

Convert a nurneric value expressed in e 2-byte binary code into an ASCII string.

Parameter

ML DE

Binary number te be converted (0000H te FFFFH)

=

Starting address cf the memory locations te which the converted ASCIi string is stored

=

Return

DE = Address in which the Iast character (s stored B = Num ber cf characters

Affected Register

i-IL, DE, BC, IX, AF

Remarks

(Example) When HL

=

2374H (or 9076)

0E (when calling) Lower address

J

3:H

J

OE(when retuming) Klgher address

3:H

J

37H

J

J

~4Ar~

B = 04H (4

BASIC INTERPRETER

BCDASC Entry Address

0244H

Ftrnction

Convert e numeric value expressed in a BCD code into an ASCII string. At the end cf the converted ASCII string is aiways added 00H. if the absolute value cf the exponent part is 10 or greater, the converted result (s expressed in the exponentiel notation (like 1.23x’lO’°).If (t (s less than 10, the converted result (s expressed in the fixed decimal notation (like 123). A plus sign, if any, (s converted ta a space char-acter.

Parameter

HL

Starting address cf the memor-y locations in which the operand (a numeric value expressed in a BCD code) is stored DE = Starting address cf the memory locations ta wh(ch the ccnverted ASCII string is stored

Return

The converted string is stored in the memery location specified by DE.

Affected Register

AF, BC, DE, ML, IX, lY, AF’

4.2.3

=

Subroufines for Evaluation of Expres&ons

EXPRESS Entry Address

0274H

Function

Evaluate the expression (in the intermediate code format) stored (n the memory location specif(ed by KL register, and return the result (in the BCD format) into X reg (ster.

Parameter

ML

=

Text read address

Return

CF

=

CF

=

0: NormaI termination X = Resuit 1: An error has accu rred. A = Errer code

Affected Register

AF, BC, DE, KL, IX, IY

bASIC IN I

EXPKEX

I tK

_________________________

EntryAddress

0277K

Function

Same function as EXPRES, except that this routine does net result in an errer even if the expression to be evaluated does net have a left parenthesis which should correspond te the right-most perenthesis.

Parameter

HL

=

Text read address

l~eturn

CF

=

CF

=

0: Normal termination X = Resuit 1: An errer bas occurred. A = Errer- code

Affected Register

AF, BC, DE, HL, IX, IY

SUSÎNG Entry Address

0298K

Function

Interpret the contents cf the memary tocations whose starting address is specified by ML register as the USING format data, and store the format data in the work erea.

Parameter

HL

=

Starting eddress cf the memary locations in wh(ch the USING format data

are stored Return

CF

0: Normal terminatien HL = (Last address cf the memory lecafions where the USING format date are stored) + 1 CF = 1: An errer has occurred. (Exemple) USING “### ##“; A - -

=

-

-

- -

/\

The sterLing address 0f the

IJSING format data which

should be specified by HL register

Affected Register

AF, ML

- -

When returning from the routine, KL register specifies the address of this point. -

BASIC INTERPRETER

USGCNT Entry Address

029EK

Function

Convert the numeric value (in the internai format) in X register into the ASCII string for-matted accor-ding te the USING format data given by SUSING routine, and store the ASCII codes into Y, U, V, W and S register-s (i.e., locations from FA1OH te FA37H). if no USING format data has been given, the numer(c value is converted in the same manner as BCDASC routine (i.e., converted simply te an ASCII string) and the ASCII codes are stored in Y, U, V, W and S register.

Parameter

none

Return

CF

=

CF

=

Affected Register

0: Normal terminat(cn A = Number cf the resuitant ASCII haracters (exciuding the 00H) 1: An errer has occurred.

AF, AF’, BC

4.2.4 Subroutines for BASIC Text Structure cf BASIC progr-am text Each command une cf BASIC program consists cf a une number, une length, and program data. The BASIC reserved words are expressed in intermediate codes and the other program data are expressed in ASCII codes. Fer the inter-mediate codes cf BASIC reserved wards, see section 4.2.5 “Intermediate Code Table”.

I__ Une number

10 PRINT A 20 END

--~.

Line length

_________________________

J

o~ CR

Program data

~ Une number

~ Line length

The program shown right is expanded in the memory asfoliows:

.4 Ifl

BASIC INTERPRETER Address

Data

COC5

00

COC6

OA

COC7

04

COC8

F0

COC9

97

COCA

41

--A

COCB

OD

--CR

COCC

00

COCD

14

COCE

03

COCF

F1

CODO

8E

COOl

OD

-—CR

COD2

FF

——Code indicating the end 0f a BASIC program

}10

— —

Line Iength

} }20

——Line length

END

GETCD1 Entry Address

027DM

Function

Read the attribute (such as une number er r-eserved word) of the content of e memory location (specified by HL register-) within the BASIC prcgr-am text area.

Parameter

ML

Return

B

=

=

Text reed address

e

Attribute The respective bits cf the attribute value in B register have the fellowing meanings (these bits are significant only if they are “1 “.)

LSB

MSB

B: Character expressedin an ASCII code (When this bit je ‘1”,the ASCII code js stored in A register.)

-

BASIC reserved word expressed in an intermediate code (When this bit is ‘1 “, the code is stored in DE

register.)

Line number expressed in a 2-byte binary code lWhen this bit s “1”, the code is stored in DE register.)

The PC-1600 uses twa internai for-mats for line numbers:

I ~‘)

BASIC INTERPRETER No. cf bytes

Exemple: Internai expression cf “GOTO 100”

ASCII format

Variabi e-length

F1 92 31 30 30

Binary format

4 bytes

F1 92 1F 00 64 00 GOTO

In the binary format, “1F” (s the header, the next “0064” is the binary expression cf decimal number “100”, and the test “00” (s a dummy.

In the PC~1600 mode, usually the binary format is used. When returned tram the routine, the content cf HL register specifies the address

cf the bleck next te the currently referenced biock (une number, reserved word, etc.) This address is aise stored in the work area (TEXTRP). (Exemple) •of I-IL when calling the routine 1) Reserved word Content ofHL when returned from the routine (In this case, 6=02)1 and Fi 78H)

2)

of HL when calling the routine Line number expressed in the binary

format the routine )In this case, B=04H and DE=000AH)

CF Affected Register

=

1: The end-of-text code (FFH) was detected.

AF, B, DE, HL

EOSCHK Entry Address

026EH

Fun ction

Check the end-of-statement code (colon or CR code) based on the bit patter-n set

in B register by GETCD1 routine. Parameter

Retum

Affected Register

B

=

Bit pattern set by GETCD1

A

=

ASCII code

ZF

=

ZF

=

1: The end-of-statement code was detected. 0: The end-of-statement code was net detected.

Alt registers

.dr.A

BASIC INTERPRETER DATSKP Entry Address

026-2H

Function

Skip from the specified text read pointer to the next end-of-line code (CR, or “ODH”). The text read pointer te be specified must flot et the 00K code of e binary-expressed une number or in the middle of a une number or- string constant.

Parameter

ML

=

Text read pointer

Return

HL

=

Address of the location where the end-of-line code is.

Aftected Register

AF, HL

LINSRH Entry Address

028CH

Function

Search for the une of the une number specified by DE register.

Parameter

DE

=

Line number-

Return

CF

=

CF

=

0: The Une cf the specified or greater une number has been found. In this case, SRLINE (F8A8M: high byte, F8A9H: iow byte) stores the Une number found. SRADR (F8A6H: high byte with MSB invertede, F8A7H: low byte) stores the starting address of the memory locations where the line is stored. (For example, if the starting address (s 80C5H, then “00M” (s stored in F8A6H and “C5M” (s stored in F8A7H.) SRADRb (F1C3H) stores the Iogical bank number. 1: The Iine cf the specified or greater une number- has net been found~In this case SRLINE, SRADR and SRADRb store the une information cf the gr-eatest among the existing Une numbers.

Affected Register

AF

BASIC INTERPRETER

NXTADR Entry Address

O2EEH

Function

Return the starting address and bank number cf the une next ta the one that specified by HL register.

Parameter

HL = Starting address cf e une A = Logical bank number cf that une (FE2AH, FE2BH) = Address cf the last une in the area ta be sear-ched for- (Specify the address in the or-der cf the Iow byte and the high byte) (FE2CH) = Logical bank number cf the lest une

Return

CF

=

CF

=

Affected Register

0: The next une was found within the specified area. HL = Starting address cf the next une A = Logicai bank number cf the next une 1: The next line was net found within the specified area.

AF, AF’, HL, DE

TADCNV Eritry Address

02D4H

Function

Convert a

Parameter

C

Return

Affected Register

=

log(cal bank number te e physicel benk number.

Logical bank number Address

DE

=

CF

=

CF

=

0: NormaI termination A = Physical bank number DE = Address 1: An errer has occur-red (e.g., e non-existing address was specified.)

AF

LBSCH2 Entry Address

02D1 H

Function

Return the une number cf the l(ne that contains the label specified by KL and BC.

4 t-

BASIC INTERPRETER HL

(~arameter

BC

Return

=

=

CF

=

CF

=

Address cf the first char-acter in the label (Example) “START” ML Number- cf char-acter-s in the label exciuding the double quotes (“) (Example) “START” BC=0005M BC=0000H O: Normai termination STLINE (F8A8M: high byte, F8A9H: iow byte) stores the line number found. SRADR (F8A6H: high byte with MSB inverted, F8A7H: tow byte) stores the starting address cf the line found. (For exemple, if the star-ting address is 80C5H, then “001-1” (s stcred in F8A6H and “C5H” is stored in F8A7H.) SRTOP (F8AAH: high byte, F8ABH: 10w byte) stores the same contents as SRADR. 1: The specified label has net been found. -

-

-

-

-

-

Affected Register

AF, BC, DE, HL, AF’

Remarks

Because this routine uses the bank switching, the calling side mey need te switch

back te the original bank.

4.2.5 Intermediate Code Table IMSIC Reserved Word Intermediate Code Table

Upper 4 bits

1-11gb byte: E3 e -o

o -J

L~ghT 0

T

T ~T T~T

11

1

PAPER

~-

~

~

ii il il iiJi~

f-,

w

o



~L 3

-J

T T T

-d--

÷ ~—

B

-~

~

L

~

-~-_~L__•

~-_—--J E

~

~

ui~iiii~ii:ii~i ~Eï~iI



~

~

i ~t

-

INTERPRETER

BASIC

High byte: E6 Upper 4 bits

T1

u >.

8o

-J

L~

T;— 1 2 —

3

o, w e

7

9~ A

T CSIZE

~

—__

6

TEXT

D

—_— —

F

D

E

F

j

LCURSOR

ROTATE

+L

E

GICURSOR

5



D

—____

SORGN

o

C

GRAPH

4

-J

B



—_~___±____

—_____~____

IiF ii il II 11E 11 11 E ii i1~ ii 11 11 High byte: E7

Upper 4 bits

e >-

o -j

L~h0 O

1

2

3

4

5

6

7

8

9

A~B

2 3

4 5 w G,

-jo

6 7 —~--

—---—------I------------

9

PMT

I

A

~çg

C

BASÎC I NTERPHETEK i-lign byte: 1:13 Upper 4 oits G)

u-

0

.0 o

8

-J

2

1

3

4

5

6

7

8

9

O

OUTSTAT

2

SETCOM

A

B

C

D

E

F

.

~L

-~-

-j6

w G)

8o

—------------t----- ~ ~T







SETDEV

7

DEyS

8

COMS

r

-J

T;_

.

~AT

A

~EY$

I

I

I

B

.

C

I

D E F

High byte: F0

Upper 4 bits

e u.

0

8 -~

1

2

3

4

5

7

8

O 1

SPACES

2

ERN

3

ERL

CURSOR

5

~G

6

9

A

B

UST

LFII.ES

FEED

INPUT

CONSOLE

GCURSOR

CHAIN

J

4 f-,

w

6

J

C

D

E

F

BREAK

~E

PITCH

ZONE

~SOR

~WR 1F

7

~MDTH PRINT

LuNE

8 9

CLS

FILES

LIIST

CLOAD

uNE

LPRINT

A

PRESET

RuNE

B

PSET

TAB

C

-

TEST

÷ F





MERGE —

GPRINT —











BASIC

INTERPRETER

111gb byte: Fi Upper 4 bits o u-

.0 o

8 —j

L~gh2r3I456I78~9ABCDEF

[

AND

ASC

ABS

AREAO

OR

STR$

NT

ARUN

2

VAL

RIGHTS

BEEP

4

IEN

ACS

5

DEG

-.~

1

GOSUB

ATN

1

I

w

8o

GOTO

STATUS

7

10G

XPOKE#

TROFF

XPOKE

TO

PAUSE

—---t~-----1111

.0 G,

I

CLEAR

RUN

ERROR

FOR

LOCK

~CK

F RESTORE

j

-J

9

SGN

A

LEFTS

RETURN XCALL

NEXT

RADIAN

SIN

DATA

OPN

STEP

E

XPEEK~ COS

END

OFF

THEN

F

XPEEK

-j---

-—

—~~~—----------

~Y$~EEON~

-~-_-

PI

D

NOT

TAN

I

TRON

High byte: F2 Upper4 bits G)

-o

8o

-J

L~

~

1

2

4

3

5

o

MOD

1

XOR

6

WAKES

7

9

A

ADIN

RLOAD

PHONE

BSAVE

SNDBRK PCONSOLE

EOF

B

C

2

IOC

C~1C~ESN~TAT1

3

10F

ELSE

COPY

4

DSKF

KBUFF$

INIT

~ .0

6

RXD$

INP

8o

7

DATE$

INSTR

8 9

TIME$

A

AIN

w o

8

KEY

COM

MODE

RCV STAT PZONE

~OR~M

KEYSTAT OPEN KIIL

NAME

AUTO ERASE

-J

r~

PASS

SAVE

DELETE

OUT

J

ÎITLE

~w~j



C

MAX FILESI SET

ALARM$

POKE

AOFF

D

PEEK

RESUME

AS

E

PEEK#

RETI

OUTPUT

-~-——

.1 t’t~



D

j

E

F

BASIC INTERPHE [EH Funct(ons and symbols

Intermediate code

Punctiens and symbois

intermediate code

,

602CH

V

Fi 6BH

AND

7050H

FunCtion name

FX XXH

OR

7051M

(

2028H



8000H

Variable name




8002H

=

8004H

=

8006H

+

812BH



812DH

MOD

82 55M

\

835CH

* I + (sign) —

I



842AH 842FH 85

(sign)

85 2BH

A

865EH

4 f04

40 XXH

——

SA XXH

Functions and symbols

lntermediate code

)

1O29H

End-of-statement (CR, colon, etc.)

00 XXH

CHAF TER

5

OTHER FUNCTIONS AND PRECAUTIONS

OTHER FUNCTIONS AND PRECAUTIONS

5~1AUT0MAT~CLOADNNG AND RUNNING

0F BAS~C

PROGRAM ALE (AUT0RUN~BAS) The PC-1600 can automatically load and r-un e specific BASIC pregram file (named “AUTORUN.BAS”) from the file device (CE-1600F or memory file). When the PC-1600 (s pawered en, (fit (s in the RUN made and the ~ symbol (s net on, the PC1600 searches fer a file named “AUTORUN.BAS” in the CE-1600F, the slot Si memory file and the slot S2 memcry file, in thet order. If the file exists, it is autematically loaded inte the currently selected memor-y module (program module ar extension memory module) and executed.

52 CHANGING DISPLAY CHARACTER FONT In the PC-1600, e display character is composed cf a dot matrix cf 6 columns by 8 lines. The font data of each char-acter is stored in the CG (char-acter generater) table, in which one 8-dot column data cf a character isexpressed in one byte (or 8 bits) and the six one-byte cclumn data for-ming one complete character are stored in sequential memory locations with the date cf the first column cf that char-acter stored first, es shown below.

LSB i

MSB I

Character font data in CG table

3EH

41H 49H 39H 00H

Higher address

The PC-1600 has three CG tables: 1. GG table that stores the font data for the character codes cf fr-om 20H te 7FH This CG table is in the ROM cf the main unit, and the fonts cf these char-acter-s cannot be changed by the user. 2. CG table that stores the font data for- the char-acter codes cf tram 80M ta FFH This CG table is in the ROM cf the main unit, and the fonts cf these char-acters can be changed by the user by prepering a user defined font set in RAM and changing the contents cf UPACGA and UPACGB. 3. CG table that stores the font data for- the char-acter codes cf from 00M te 1 FH This CG table is net in the ROM cf the main unit. if you want te define your own character fonts te these codes of 00H te 1FM, change the contents cf CTRCGA and CTRCGB, prepere e user defined font set in RAM, and set LCDWK (FO5DH) bit 3 te “1”. As descr(bed, the CG tables cf items 2 and 3 above can be replaced with user-defined CG table prepared in memory. In this case, since the char-acter- fonts et ail char-acter cades allocated te that table are ta be changed, you must prepare fontdata for ail these char-acter codes even if you went te change the fonts for only seme cf the char-acter codes.

01HER FUNCTIUNS ANti PRhUAU 1 IONS The tallcwing shows the details et the wcrk area used ter- the CG tables. Name

Address

Bytes

Contents

CTRCGA

F061H (Low byte) F062H

2

Starting address cf the memory locations where the character font data for the character codes cf 00H te 1FH are stored (The starting address must net be iower than 8000H.)

F063H

1

Bank number (0 te 7) cf the memory locations where the character font data for- the character codes of 00H te 1 FH are stered

FO64H (Low byte) F065H

2

Starting address cf the memory locations where the character font data for the character codes of8OH te FFH are stored (The starting address must net be lower than 8000H.)

1

Bank number (O te 7) cf the memory locations where the characterfont data for the character codes cf 8OH te FFH are stored

(H(gh byte)

CTRCGB UPACGA ~ ~ P~

I

(High byte)

UPACGB ~

F066H

5~3 EXTENDED FUNCTION 0F KEYSTAT COMMAND The PC-1600 can accept key input from the serial port insteed of the main unit keyboard.

(1) Setting procedure Execution cf KEYSTAT command with the first parameter set te “2” lets the PC-1600 te accept key input from the seriai port cur-rentiy set by SETDEV command. To do this, set appropnate communication parameters (such as the baud rate) by SETCOM command. The use of the second and the third par-ameters of KEYSTAT command is the same as for the keyboard.

(2) Key codes The key codes te be input from the serial port must be the same as those sent from the keyboard (see section 10.2.) Code 10H has a special meaning: 10H: Indicates that the m. ffl or I OFF) key has been released. Since the key input routine needs to check whether or net the fflt m or 10FF I key hes been currently pressed, a code 10H must be sent each time one of these keys is released. With the keyboard, key codes 11H end 13H are allocated te the functien keys 1 end 3 on the keyboard, respectivety. With the serial port, however-, codes 11H and 13M are usually used as XON and XOFF codes, respectively. Because cf this, usualiy you cannot send the key codes corr-esponding ta the funct(on keys 1 end 3 through the ser(al port. Mowever, execution cf the following POKE statements lets the PC-1600 te inter-pret codes F1H and F3H sent from the serial port as the key codes of the function keys 1 and 3, respectively. POKE POKE POKE POKE POKE

&FF4O,&33,&33,&F5,&79,&FE,&07,&28,&O2 &FF48, &F1 ,&C9,&F1 ,&E3,&CD,&61,&FF,&67,&F5 &FF51 ,&FE,&F1 ,&20,&02,&26,&1 1 ,&FE,&F3 &FF59,&20,&02,&26,&1 3,&F1 ,&7C,&E 1 ,&C9,&E9 &F3C1 ,&C3,&40,&FF

i

OTHER FUNCTIONS AND PRECAUTIONS This example uses codes F1H and F3H for the function keys 1 and 3, however-, you can use different codes instead cf F1H and F3H by changing the contents cf addresses FF52H and FF58H. FF52H: F1H FF58H: F3H

Change te a different value. f— Change te a different value. ~—

(3) Precaut~on Even when “KEYSTAT 2” statement is executed te eccept key input from the serial port, the key input from the keyboard can stili be accepted: the PC-1600 accepts key input from bath keyboard and serial port.

5~4SEGMENT~NGONE RAM MODULE FOR D~FFERENTUSES A RAM module (CE-1600M or CE-161) (s usually used for- anly one cf the following three uses: (1) extension memory (2) program module (3) RAM disk

Howeyer-, e RAM module (if two RAM modules are installed in slots 1 and 2, only one cf them) can aise be used as: (4) program module + extension memory in the fourth case, CE-1600M or CE-161 is segmented into two parts. The first part cf the RAM module is used as e program module and the lest part as the extension memary. Te do th(s, execute the following statement: INIT “Si :(or S2:)”/’P”, where specifios the size cf the area te be used as the program module. The program module ar-ea can have e size cf a multiple et 2 KB, and should be specif(ed by e value cf e multiple cf 2 (n k(lobytes. This module segmentation is possible enly when the following four cenditions are sat(sf(ed: (1) No program exists in the extension memery. (2) No program exists in the program module. (3) No files exist in the RAM disk. (4) The other module, (f there are twa modules in the slots, is net segmented. SlotSl: —~ SIot S2: —?e

banko Ibank 2

bankl bank 3)



*



When a RAM module in e slot is segmented, if there is enother RAM module in the other slot and it (s used as the extension memory, the total size cf the extension memery varies as follows. ~lf20

UI MtM IUNU I IONS ANL)

PIIEUAU FIONS

ares

(Largest bank among those hav(ng size cf iess than 16 KB)

a

(16 KB cf bank 2)

f

(16 KB of bank 3) (16 KB cf bank 0) (16 KB cf bank 1) 16 KB cf PC-1600 standard meme ry

Program

ares

Variables

area

Workarea

(1) First, the extension memory arees are stacked up in the order 0f banks 1, 0, 3 and 2. However, if the extension memory erea et a bank is less than 16 KB, that bank is flot stacked. (2) Atter these banks of 16 KB are stacked, finally thejergest bank among those having a size of Iess than 16 KB, if any, (s stacked. The other banks of less than 16 KB are flot used as extension memory. (If there are two or more banks that have the same size of less than 16 KB, oniy one cf those banks is stacked being selected in the order of banks 1, 0, 3 and 2.)

5.5 ALE F0RMAT The PC-1600 can handle three kinds of files: ~1)ASCII file : Pr-ogram file or data file saved by PRINT #n, SAVE with A option, or SAVE* command 2) Program file : Program file saved by SAVE command (3) Machine language file : Machine language file saved by BSAVE command These files hàve the follôwing fer-mets:

(1) ASCil file • PRINT#n

1AH” i~writtefl when the file la closed.

.Endof4ile code

• SAVE with A option, and SAVE* First program une

Second program me

Lest program line



I ~7

1AH

OTHER FUNCTIONS AND PRECAUTIONS

(2) Progr~mfille +00 +01 +02 +03 +04 ÷05

[Jio

00

00

+0E

21 JL~’M~HJ 00 Program

J

00

00 00

--0F

J J

00 00

00

0F

Data

(program)

size (in the order 0f 0w, middle and high bytes)

(3) Machhie Ilanguage fille +00 +01 +02 ÷03 +04 FF

lin

10

00

00

+0E +0F

10

L

I

M

H

L

~l

Machine language ares aise the order 0f 10w, middle and high bytes)

H

B

L

H

B

00

0F

Data (machine languago data)

I -~

Sta~ingaddress and bank aumber of the machine language area aaved (in the order 0f 10w address, high address and bank number)

Auto-run address alter the machine language program ir loaded -to- (in the order of 10w addresa, high addressand bank number)

Theae three bytes will be “FFH” ifthe program s not to be automatically executed.

5~8 DATA

§NPUT/OUTPUT TO ALE DEVllCE

(1) There are twa commands ta for data input/output to e file device: PRINT #n Write data te a file device. INPUT #n Read data from a file device into a variable. (2) The foliowing outlines the procedure for data input/output te a file device. 1. MAXFILESs=m m is the number effiles that can be opened at the same time. (m is 1 te 15.) Usually this command is placed at the beginning cf a program. 2. OPEN “.” FOR INPUT AS #n OUTPuT APPE ND n must be a unique number among the currently opened files. 3. PRINT #n Write data. or INPUT #n Read data into e variable. 4. CLOSE #n When the file oper-ation is completed, the file must be closed. (3) End effile While you are reading data from a file by INPUT #n command, if aIl data in the file have already

been read and you attempt te read data from the file, this execution cf INPUT #n cammand results in an errer. You can check whether ail data (n the file have been read, by using EOF functian. Thus, when you attempt to sequentially read data from a file that you do net know how many data items exist in

thot file, you should check the end ef the file by EOF function each tirne befere you execute INPUT #n command.

~1

W MER FUNG1IUNS ANti l-~1LUAUI IONS 1.

When wrlting data by

PKiNT #n command

(1) (i)Numeric data (without USING)

Space code

(space

SP code): When tha numeric value je zero or positive — (minus sign code): When the numericvalue is negative

©Numer-ic data (with USING) String expression

(Exemple)

0f

numeric data in IJSING format

PRINT#1, USING

“+####.##“;

—1.234

I ®Str-ing data String data

If e USING format (s given befere the string, the string data are arr-anged according te the USING format. (2) PRINT #n,datal,data2 (when the data delimiter (s a comma) When each data items are separated by a comma, each data item is written in units of 20 bytes. If e data item exceeds 20 bytes, it (s written over ta the subsequent 20 bytes. A numeric date is right-justified in e biock. (Example) SP

.,,,

SP

PRINT#1, 1.23, “ABC —T” 1.23

SP

ABC — T

CR

LF

(3) PRINT #n,datai;data2 (when the data delimiter is a semicclon) When each data items are separated by e semicolon, each data item (s written in the format of (1) above, and the data items are written immediateiy following one another-. (4) PRINT #n,detal When the lest data item (s not foliowed by a comma or semicelon, the data item is written with CR end LF codes added at the end.

169

OTHER FUNCTIONS AND PRECAUTIONS 2. When reading data by DNPUT #n command (1) INPUT #n, This statement read data as e numeric value fr-om e file device and stores (t ta the specified numeric variable. If e data item cannot be read as e numer(c value, “O” is stored te the variable. A space code and e data delimiter- code preceding te each data item are ignored. The end cf each data item is r-ecognized by a comma, space, or CR+LF. (2) INPUT #n, This statement read data as e string from e file dev(ce end stores (t ta the specified string variable. Consecutive space codes or delimiter codes preced(ng te each date item are ignored. The end cf each data item is recognized by a comma or CR+LF. A comma enclased w(th double quotes (s recognized as part cf data (that is, not as a data delimiter).

3.

Examp~esof

PR~NT#n and DNPUT #n commands

Example 1

When you execute PRINT #1,A$,B$ (where A$=”ABC” and B$=”CD”) the data are written in the failowing far-met:

J

sp

ABCSp

J JJ CD

CR

LF

I

Then, when you execute the following statement to read data from the previeus file: INPUT #2,A$(0) (assume DIM A$(0)*80 has been executed) the data are stored ta A$(0) as foliows: A$(0)

=

“ABC sp

sp CD”

2 When you execute the fallawing statement te read the same date as Example 1: Example

INPUT #2,A$,B$ the data are reed inta A$ es follows: A$=”ABCsp

sp”

(16 bytes cf data) then the INPUT statement resuits in an error because there is no data te be read te B$. In this case, the data “ABC sp sp CD” are treated es one data item, and enly the first 16 bytes cf data are stored inte A$, therefore, no data is ieft for- B$.

~1~7l”i

U IHEN FUNCTIONS AND PRECAUTIONS Example 3 Suppose you have executed the following statement: PRINT #1,1.23,456 Now, you read these recorded data by the foliowing statement:

INPUT #2,A,B Then you get the results:

A=1.23 and B=456 This is because, different from exemples 1 and 2, e space code is treated as a date delimiter if the input variable is a numeric variable.

4. PRII\IT #n and INPUT #n commandsto serial port (RS-232C or SliO) (1) The data format is the same as item 1 above.

(2) With PRINT #n command, the data are actueliy cutput te the serial port when one of the following events occurs: • When the amount cf cutput data reaches 256 bytes • When the serial port is clesed (3) With INPUT #n command, the received data are actually stored ta the variable when one cf the following events occurs: o When the amount cf received date reaches 256 bytes • When an EOF code (1AH) is received

5.7 PRECAUTIONS FOR USE 0F SER~ALPORT

--

(RS-232C AND 310) (1)

Transmission speed

For communication at higher- transmission speed, set the size cf the receive buffer- es foliows (by using INIT “COMn:” statement. Transmission speed (bps) 1 4800 te 9600

Receive buffer size (bytes) 80 or more

19200

130 or more

38400

1100 or more

OTHER FUNCTIONS AND PRECAUTIONS (2) XON/XOFF fllow controil When XON/XOFF control is used, execution cf any cf the following commands te a serial port may cause an XON (11H) code te be generated et the beginning cf the command executien.

OPEN “COMn:” LLIST INPUT

SAVE BLOAD

BSAVE LPRINT

LOAD

The foilowing shows an example in wh(ch an XON (11H) code is flot generated when the OPEN “COMn:” statement is executed. SETCOM “COMn:”,1200,8,N,1,N,N OPEN “COMn:” FOR INPUT AS #1 SETCOM “COMn:”,1200,8,N,1,X,N

(3)

...

(XON/XOFF (s disabled)

...

(XON/XOFF (s enabled)

Data format

XON~ 1

J

O

J J J F

O

R

M JAJ

î

Js~aceJs~aceJ J b

y Js~aceJ p

c

J

1

6

0

0

CR

LF

2

J J o

When the XON/XOFF control is enabled, opening a serial port or executing a SAVE, BSAVE, LLIST or LPRINT command may cause an XON code ta be generated. When the XON/XOFF contrai is disabled, an XON code (s flot generated. With a file, the end-of-line code (CR or CR+LF) is always ccnverted te CR+LF. However, for data transmission with LPRINT, LLIST or INPUT command, the end-of-line code can be specified to CR or- CR+LF by PCONSOLE command.

(4) Serllall port (a) To select the RS-232C port, execute SETDEV “COMi:” or OPEN “COMl:” The default port at power-up (s the SIO port (COM2:). (b) To select the Sl0 port, execute SETDEV “COM2:” or OPEN “COM2:”

OTHER FUNCTIONS AND PRECAUTIONS tc) RS-232C control signaIs 11~ The load cf the outgcing central signal RST or DTR should be 3 te 7 kilo-ohms. Thus, do flot connect the RST signal, for instance, te twc signal Unes en the remcte system.

2~ Control cf RTS signal The RTS signai is usually held at Iow, but can be set te high by OUTSTAT “COMi :“ stetement. ~ OUTSTAT “COM1:” While an RS-232C input/eutput command (SAVE, BSAVE, LOAD, BLOAD, LLIST, or LPRINT) (s being executed or while the RS-232C port is open as e file, the RTS signal is held et high. it goes low when the command executian is terminated or when the RS-232C port is closed. The RTS signai aise works as the busy signal for data reception. The RTS signal goes low when the r-eceive buffer is getting full and the free space in the buffer becomes 8 bytes, and it goes high when the received data in the buffer are read into the system and the number cf r-emaining data in the buffer becomes 8 bytes. Control of CTS, CD, and DSR inceming signais • RCVSTAT “COM 1: “, This statement specifies which incoming signais (CTS, CD and/or DSR) are used te cantrol data receptien. Bits 2 te 4 of correspond te STC, CD and DSR. -



=

* * * b b b * * 4 3 2 ________________________________________

(Bit pattern in binary notation)

~CTS is used for data reception control. ~ CD s used for data raception control.

~ DSR la used for data

Bit =

reception control.

O : This signal is used for- the data reception contrai. (When this signal is high, the data r-ecepticn (s enabled. When this signal (s iow, the data receptien is disabled.) 1 : This signal is not used for the data reception contrai. (The data reception (s enabled regardless cf this signal.)

• SNDSTAT “COMl:”, This statement specif(es which incaming signais (CTS, CD and/or DSR) are used te contrai data transmission. Bits 2 te 4 cf correspond te STC, CD and DSR. )Bit pattern in binary notation) is used for data transmission control.

is used for data transmission control. DSR s used for data transmission control.

Bit

O : 1 :

This signal (s used for the data transmission control. (When this signal is high, the data transmission is enabled. When (t (s low, the date transmission is suspended.) This signal is not used for the data transmission contrai. (The data transmission is enabled regar-dless cf this signal.)

OTHER FUNCTIONS AND PRECAUTIONS e OUTSTAT “COMl:”, This statement sets the RTS signal te high or Iow according to the value cf . (For the relationship between the value cf and the state of RTS signal, see the table in item 3) below. 3) ContraI cf DTR signal The DTR signal (s usually held at low, but it can be set te high by OUTSTAT “COM1 :“ statement. o OUTSTAT “COMl:” Wh(le an RS-232C input/output command (s being executed or while the RS-232C port is open as a file, the DTR signal is held et high. e OUTSTAT “COM 1: “, This statement sets the DTR signal te high or low accord(ng te the value of .

RTS

O

H(gh

1

High

Low

2

Low

High

3

Low

Low

4)

I

High

CTS signal (incoming signal)

The CTS signai can be used for- the data reception control and the data transmission control cf the RS-232C port. 5) DSR signal (incoming signal)

The DSR signal can be used forthe data reception control and the data transmission control cf the RS-232C port. 6) CD signai (incoming signal) The CD signal can be used for the data reception contre! and the data transmission control cf the RS-232C port. 7) Cl signal (incoming signal) The CI signal (s used as a calling indicator from the modem. For exemple, you can use the Cl signal te power en the PC-1600 and execute a specified program, or te interrupt the current program execution and maye the contre! te a modem hand!ing program, e

WAKE$(1)=””

When this statement has been executed, if the Cl signa! goes high, the PC-1600 is turned.on and the spec(fied command string is executed. e ON PHONE GOSUB PHONE ON/OFF/STOP When these statement have been executed, if the Cl signa! goes high, contre! is moved te the spec(fied subrout(ne. Note: Te let the PC-1600 to be powered on by the Cl signa!, the Cl signal must be held at high far more than one second. 8) INSTAT “COMl:” This statement reads the states cf the RS-232C control signaIs: the inceming signaIs (CTS, DSR, CD and Cl) and the outgcing signaIs (RTS and DTR). With this statement, you can know the state cf the remote machine. The following shows the meaning cf a value te be returned by th(s statement.

OTHER FUNCTIONS AND PRECAUTIONS

{

b~

O

b6

0

b3

State cf Cl ( “0” means “high”; “1” means “low”)

b4

State cf DSR ( “0” means “high”; “1” means “lcw”)

b3

State cf CD ( “O” means “h(gh”; “1” means “lcw”)

b2

State cf CTS ( “0” means “high”; “1” means “low”)

b1

State cf RTS ( “0” means “high”; “1” means “icw”)

bo

State cf DTR ( “O” means “h(gh”; “1” means “Iow”)

9) T(meout value for data receptien and transmission • RCVSTAT “COMn:”,, The cf this statement specifies the timecut value for data reception. O : If no data has been received (n the receive buffer,~e command to input data from the serial port wa(ts until data cernes in. = 1 ta 255 : If no data has been-r-eceived in the receive buffer, e ccmmand to input data from the serial port waits for e maximum cf /2 seconds. If no data cornes in with(n that period, the cornmand execution resuits (n e timeout errer. • SN DSTAT “COMn: “,, The cf this statement specifies the timeout value for data transmission. = 0: if the date transmission te the serial port (s disabled when a command ta eutput data ta the seriai per-t is executed, the cemmand waits until the data transmission is enabled. = 1 ta 255 : If the data transmission te the serial port is d(sabled when e command to output data te the ser-(aI port is executed, the command weits for a maximum cf /2 seconds. if the data transmission is not enabled within that per-(cd, the command execution resuits in e tirneaut errer. A timecut er-ror occurs (n e(ther cf the following cases: (1) When the XON/XOFF central is used, (f the PC-1600 does net receive an XON code (11H) within the specified period of time s(nce (t has received an XOFFcode (13H). (2) For data transmission ta the RS-232C part (i.e., COM1 :), if the incem(ng contrai signal that has been spec(fied for the data transmission contrai does net gc~high within the specified period cf time. • RXD$

Even when the PC-1600 has received 11H code or 13H code, an RXD$ command may not return these codes. • SETCOM “COM2:” For data transm(ssian/reception te the SiO port (i.e., COM2:), specify the same XON/XOFF control setting te bath COM1: and COM2:. • RCVSTAT and SNDSTAT Do net omit the when ycu use these commanda.

4

OTHER FUNCT~ONSAND PRECAUTIONS 5~8 TRANSFERRllNG

A BASllC PROGRAM BETWEEN PC~16OO AND OTHER MACHllNE

The data format for transmission/reception cf a BASIC program through RS-232C (s different between the PC-1600 and ather per-sana! camputers. Therefore, ycu cannct transfer a BASIC pregram through RS-232C simply by using load .and save eperetions. This section describes a method te transfer e BASIC program between the PC-1600 and a different personal computer (PC-7000 or PC-5000), in which the PC-1600 uses the LOAD or SAVE command and the other personal computer uses a special file transfer BASIC pragram (described later).

(1) Connectllng the computers The method described here uses cnly three signal unes cf RS-232C (transmit data line, receive data line and ground une). Connect the PC-1600 and the other personal computer through their RS-232C connectors with the apprepriate RS-232C cable. (CE-1 603L cable) PC-1600 ~

~

PC-5000

(CE-1604L cable) PC-1600 ~

~ PC-7000

(2) Settllng up the PC~-16OO Te transfer e BASIC pregram, the PC-1600 uses the LOAD or SAVE command. Before starting the program trensfer-, you must initialize the PC-1600’s RS-232C port as described in item (4) “Communication procedures” below. You can use env baud rate, however, you must use the same baud rate between the twa camputers. If ycu use a baud rate cf 4800 bps cr higher, set the PC-1 600’s receive buffer size te the following value (by using IN1T command): Baud rate

Receive buffer size ~minimum value)

4800, 9600

80

19200

i30

(3) Setthig up the remote computer The remete computer uses e special BASIC program ta transfer a BASIC program file. The following lists the file transfer programs and the setting conditions for d(fferent computer-s. Persena) computer PC-7000

PC-5000

Transfer direction —~

—~

File transfer

program

Setting conditions

PC-1600

List 1

GW BASIC

PC-1600

List 2

GW BASIC

L(st 3

GW BASIC

L(st

GW BASIC

PC-1600 ~

~—

PC-1600

4

OTHER FUNCTIONS AND PRECAUTIONS ~ote; Some persanal computers dc net suspend the data transmission even when the PC-1600 sends

an XOFF code. For data transmission from such a computer te the PC-1600, take the fallowing measur-es: PC-1600 side: Set the receive buffer size ta 600 bytes or more. Remote side: Let the computer te wait fer about 0.1 ta 1 second each t(me the computer has sent one une cf data, se that the PC-1600 does net have ta send an XOFF cade ta the remcte computer.

I;..

L:.:

~..O INPUT VFILE NANE (PC—1600 ta PC—7000)”;LECCEE$ 20 OPEN LECCEE$ FOR OUTPUT AS *2 OPEN “coml:l200anaa,lslf” AS *1

L

-~

~0 PRINT “READY! !“:BEEP IF LOF(1)0 THEN 50 60 FEINT #1,CHR$(&H11); 70 X2$=INPUT$(1~*1) ~0 1F X2~=CHR$(&H11) THEN 70 g~ IF X2$=CHR$(&HA) THEN 70 100 IF X2$=CHR$(&H1A) THEN 160 110 LINE INPUT *1,X1$:X1$=X2$÷X1~ ~20 PEINT 4*1,CHR$(&H13); 130 PEINT X1$ 1~0 PEINT *2~X1$ 50

~.

50 GOTO 60

160 CLOSE:END

Ust 2 20 TNPUT “FTLE NMIE (PC—7000 te ~C-l500)”~LECCEE$ OPEN LECCEE$ FOR INPUT AS *1 50 OPEN “CO~I1:1200,N,8,1,1f” FO~ 70 IF EOF(1) THEN 120 UNE INPUT *1,X1S 30 PEINT Xis PEINT *2 X1$ 110 GOTO 70 9 50

~0 100 ~

120

AS #2

:END

Ust3

-~

~

FRINT *2,CHR$(&H1A);:CLOSE

OUTPUT

10 INPUT “FILE- NAflE (PC—1600 ta F’C—~0ØØ)”;LECCEE$ 20 OPEN LECCEE$ FOR OtJTPUT AS #2

30 OPEN “comltl200,n,8,1,LF,CS0” AS *1 PEINT “EEADYiI”:BEEP 50 X2$INPUT$(1,*1) 70 IF X2$=CHRS(&H11) THEN 60 60 IF X2$=CHR$(&HA) THEN 60 IF X2$=CHRS(&HÎA) THEN 160 --s100 LINE INPUT #l,X1$:X1$=X2$~1.Xj$ :10 PRINT *1~CHE$(~H13; ~20 PEINT XiS 130 PRINT *2,X1$ :40 FEINT *15CHR$(&H11); 1-’ 50 GOTO 60 .~E0 CLOSE:END •-~0

SO

~.

:0 • • ~ 60

- -

INPUT “FILE NAZIE (PC—5000 te ~-‘C-l600”;LECCE~s ~0 OPEN LECCEE$ FOR INPUT AS ~i 2~ BEEP~PRINT “READY!P’ 30 OPEN “CONi~120Ø~N~8,1~LF” FOR OUTPUT AS *2 ~0 LIME INPUT #1~X1$ 50 PEINT XiS FRUIT *2~XiS 70 IF EOF(1)=0 THEN 40 &0 ?RINT *2~CHR$ (&HiA)~ 20 CLOSE ~00 END

OTHER FUNCTIONS AND PRECAUTIONS (4) Comrnun~cat~on procedures (a) Precedure te transfer a BASIC program fram PC-1600 te the remete computer Operatiens on PC-1 600 1

(Create a BASIC program.)

2

(Save the BASIC program.) Example: SAVE “X:TEST”

3

Set up the communication protecel. 1) OUTSTAT “COM1:”,Q 2) RCVSTAT “COM1:”, 63 3) SNDSTAT “COMi :“, 59 4) II’ll1~“COl\41 :

4

Load a BASIC program you want to transfer. Example: LOAD “X:TEST”

r

Operations on remote computer

~

Execute the appropriate data reception BASIC program. (Load(ng program from RS232C)

6

Enter a f(Ie name to save the received program data into e file with that name.

7

Start sending the program by executing the

following statement. SAVE “COMl:”,A

Note: Te send another program after you have sent one, repeat the above steps 4 ta 7.

(b) Procedure ta transfer e BASIC pregram from the remote computer to PC-1600 Operations on PC-1600 1

ODerations or remote computer

Set up the communication protocol. 1) OUTSTAT 2) RCVSTAT “COM1:”,63 3) SNDSTAT “COM1:”,59 4) INIT “COIVIl : 600,” “r” r, “,

2

3

Execute tre ano’oDr~atedata pro gram (Sav~ncoro7ram ~o RS232C)

Execute LOAD “COMi:”

4

~

transmiss(cn BASIC

Enter e

name o~the file you want te transfer.

loaded into memory,

Note: Ta send another program after you have sent ene, repeat the above steps 2 ta 5.

OTHER FUNCTIONS AND PRECAUTIONS 5,9 MERG~NGPROGRAM ALES The merge operat(an described in this section basical!y has the same function as MERGE cemmand of

BASIC, therefore, the foilowing rules apply ta the merge aperatien. • The merge operat(cn loads a program (specified in LOAD command) inte memory without deleting the programs previously existing (n memory. That (s, different pr-egrams may coexist in memory. These coexisting programs may have the same une numbers. Each Ioeded program must be labeied (i.e., defined ta a key on the keyboard (such as “A” or “S”). For details of the labeling, see OPERATION MANUAL, sectian IV 8 “Program Labels and the DEF Key”. u u

u

If an unlabeled program (s lcaded, label it immediately. The programs must be iabeled ta differ-ent keys. When yeu Ioad a program by th(s merge operation, that program w(II be the abject cf editing. Te edit the ether pr-cgrams, specify a program expiicitly by LIST “label” cemmand. This merge operation will resuit in an errer if a password (s set ta the PC-1600 main unit. If READ end DATA stetements are used in e program and the DATA items are ta be re-read by a RESTORE command, label the fir-st une cf the DATA biock and specify that label when you re-read the DATA black by e RESTORE command. If DATA statements are used in more than one program, unexpected data items may be read depending on the program executian state. After the merge cperation (s performed, the f(xed numeric variable Z contains the value “0” (because (t is used for- the merge oper-ation.)

File merge operatien procedure

1. Execute the machine lenguage program I (by CALL command of BASIC). 2. Execute LOAD “” (where (s the drive and the file names of the file you want ta merge.) 3. Execute the machine language program li (by CALL command cf BASIC.) Note: Perform steps 1, 2 and 3 in that order and do net perform any other operations between them. Even if the LOAD eperation cf step 2 has resu Ited in an errer, be sure ta per-for-m step 3.

:~1achineIanguage program I .::z’0:3A D5 Fi FE 01 30 28 JA 28 F0 32 CA F9 2A 65 :~i0:22 C8 F9 ED 5E 67 F8 B7 ED 52 2A 2C F0 20 03 L-....20~2804 14 20 01 iC ED 53 65 F8 7D 32 2B F0 C9 F0 28 03 21 23 F0 ES il Ce F9 01 03 00 ED 2~—0:EBEl 06 03 lA BE 77 28 01 OC 13 23 10 F6 79



F8 BD

21 B0 B7

:~E~’C85E 23 56 13 22 2B 28 72 2E 73 C9 ~ie ~C~3A •

language program li D5 Fi FE 01 30 22 3A 2B F0 32 C4 Fi 3A CA F9

:~C~32 28 F0 2A 65 F8 22 69 F8 2A C8 F9 22 55 F8 7D

:~7C:6C F5 80 67 22 C8 F9 18 20 21 lB F0 28 03 :;cC:F0 7E 32 C4 Fi 25 7E ES 7F 5F 28 56 ED 53 ~C:EB 21 C6 F9 01 03 00 ED B0 il 3C FE 21 Ce ~:Ø3 00 ED B0 21 C8 F9 AF 06 08 77 23 10 FC ::~F8

22 9E F8 3A C4 F1 32 Cl Fi CS

21 25 69 F8 F9 01

2A 69

OTHER FUNCTIONS AND PRECAUTIONS Note: The starting addresses cf the programs I and K are “DOOOH” and “DO5CH”, respectively. Hawever, they can be placed in any other lccatians because they are relccatable. it would be useful if you save the pregrams in files by BSAVE command after load(ng them by POKE command.

5~1OSAV1NG AND LOADING THE RESERVE AREA You can save and load the contents of the RESERVE area te and from a file by using BSAVE and BLOAD commands.

(1) Saving the RESERVE area from the extension memory Extension memory

module in siot Si

Extension memory

None

Nane

None ar CE-1600M or

CE-1600M

CE-161

Saving procedure

module in slot S2

BSAVE “”,~»0,&C008,&C0C4

ar CE-161

OSAVE “”,#2,&8008,&80C4

None or CE-1600M or

CE-159 or CE-155

CE-161

CE-151

None

BSAVE “’,=0,&B008,&BOC4

CE-1600M or CE-161

None

BSAVE “’,=0,&8008,&80C4

I

BSAVE “”,#0,~0O8,&A0C4

(2) Saving the RESERVE area from the program modifie

J L

RESERVE area in the program module in slot Si

BSAVE “”~~0&8008~&B0Cjj

RESERVE area in the pragram module in slot S2

BSAVE ~

(3) Loading a ifie data into the RESERVE area (a) BLOAD “” This statement loads the data from the specified device and file into the same RESERVE area as saved in items (1) or (2) above. (b) BLOAD “”,,, This statement loads the data from the specified device and file into the specifieci memory

locations. The locations cf the RESERVE area are the same as described in items (1) and (2) above.

OTHER FUNCTIONS AND PRECAUTIONS

5.11 DISABLING THE KEY INTERRUPT DUE TO ON KEY STATEMENT If a function key is pressed for an INPUT command, the key operation is memorized as e key interrupt even if the key (s pressed after a KEY(n) STOP statement has been executed, and the key interrupt becomes effective when e KEY(n) ON statement is executed leter. Te avo(d e function key cperatian for an INPUT command from being accepted as an interrupt (that is, to disable e function key oper-atien for an INPUT command), execute the following unes: KEY(n) STOP

IN PUT command POKE &F1D4,PEEK(&F1D4) AND &C0 KEY(n) ON

.4 fl.4

OTHER FUNCTIONS AND PRECAUTIONS

5.12 CE-153 CONTROL UTILITY (FOR PC-1600) (1) Basic specifications The CE-153 control utility progr-am aliows the CE-153 (which is e peripheral device for PC-1500) te be used with the PC-1600. 1. The basic specificetions cf the utility program are the same as those of the utiiity program written for- PC-1 500 which cernes with CE-153, except for the foliowing points. Thus, if you went ta use a CE-153 application program written for PC-1500 for the PC-1600, you may need te change part cf the program according ta the foilcwing changes.

.

Differences

For PC-1500

For- PC-1600

When operating the keys on the CE-153, letters and numbers entered from the PC-1500 are stored into the variable Z$(0). This variable can centain up te 80 characters.

When eperating the keys on the CE-153, letters and numbers entered from the PC-1600 are stored intc the variable Y$. This variable can contain up to 16 characters.

2. As shown in the fcllowing memory maps, in the PC-1500, the CE-153 contraI utility program (written for PC-1500) (s loaded frorn the top of the RAM aree (i.e., in the m~chinelanguage area before the BASIC area). In the PC-1600, however, the utility program (written for PC-1600) (s Ioaded in .the middIe of the RAM erea (before the system work area and after the BASIC variables area).

PC-i 500

PC-1600

Address LOW

Address LOW

CE-153 control utility program

Bank O

Text BASIC area Variables

Text BASIC area

î

Variables

CE-153 control utility

t

prograrn

System work area

System work ares

rnuti

(2) Entering and saving the CE-153 control utHity program List A shows the dump Iist cf the CE-153 control utility prcgram. This util(ty pregram is written in the LH-5803 machine codes (n the relocatabie addressing structure. Enter and save the utiIity program (n the failowing procedure: 1. Execute: MODE OIENTER! 2. Reser-ve 1.2 KB of machine Ianguage area. Example: When no memcry module (s installed NEW “S0:”,1392IENTERI This statement reserves the machine language area cf 1200 (= 1392—192) bytes starting from COC6H.

-I O’~)

OTHER FUNCTIONS AND PRECAUTIONS 3. Enter the codes cf list A by using POKE cornrnand. The following BASIC pregrem would be helpful te enter these cades. 10: A=&COC6 20: CURSOR 0,0: PRINT HEX$(A);: INPUT X 30: POKE A,X: A=A+1 40: GOTO2O (Te terminate the pregram, press the IBREAK Ikey.) 4. When the cades have been entered cornpletely, save the progr-am inta a cassette or disk. Example 1: Saving te e disk BSAVE “X:filename”, #0,&COC6,&C54F Exemple 2: Saving ta e cassette (through CE-1 600P) CSAVE M “fi ienarne”; #0,&COC6,&C54F Exemple 3: Saving ta e cassette (threugh CE-150 in MODE 1) MODE 1 CSAVEM “filename”; &40C6,&454F List A Memory address

0006—00

data

4A

00

000E—05 0006—C’D CODE—ES r0E6—ED COEE—F5 COF6—FD COFE—05 CI 06—00 010E—15 0116—ID ‘~11E—25 0126—20 012E—35 0134—3D

8E CA SA DC ED 48 GA 98 00 SA AE 03 89 0E

35 8E AS CC 78 01 FF F0 F0 08 77 88 15 40

0146—40’ 014E—55 01.54—50 015E—65

Fi i39

0A 21

013E—45

0164—60 016E—75

0176—70 ‘:17E—$5

09

52

05 8E A8

58 OA 20 0A ?A 03 F9 0$ 05

83 F0

83 .5’) 13E 7A 4:3 F0 48 4A F5

8E 134

85 6A 8E 68 4A CD A$ lE F0 F0 02

F0 05 22

SA 4’)

15

1,3 AS 05

07

SA 00 SA 00 21 :3.9 00 .56’ OA 9A 00 08

0106—DO

09

09

00

C I DE—E5 C1E6—ED CIEE—F5 11F6—FD

06

07

E6 09

E?

08 E’: E8 F0

C206—0D

0216—10 021E—25

I.~226—2D

09 06 09 16 09

022E—35

26

27

0236—30 023E—45

09

36

09

37

,::24E—55 0256—50

46 09 56

47 09

0186—80 018E—95

0196—90 Cl ‘9E—AS C1AG—AD

C1AE—65 0166—80

018E—OS 0106—00 010E—05

C1FE—05 C20E-1S

,::246—40 025E—63

0266—60

026E—75 0276--70 027E—$5 0286—80

78 Al 06

09 F6

09

:3E 0E

‘39 ,::D 4?

83

F0 F9

08 38 09

09

F? 09

07 1)~ 17 09

‘39

57

64 40 85 A6 85

F8 00 08 10

06

4A 78

01 SA

8E FC’

lI

F0 F5

CA

58

AE 06 ~4 01

48 A6

58 65 lE DA F0 ED 91

SA

F0 89 6E 88 80 00 F0

94 ED 80 1:3

0F

01

8F 10

80

89

8F

99 7E: 04 22 6E F0 8E 58 03 ED F9 F0 8E Cl 64

06 0F Fi F0 00 0$ DC’ 7? 59 78 83 2û

Dl

02

AC El 90 Fi

CC

85 98 76

C2 89

03

04

A?

E2

9E F2

82 02

:34 E3 91 F3

AA 03

21

95

85

60

38 4i3 48 50 58 8E :39 80 89 FF

96

:34 42 87’ 52 8F

6E 43 8F 53 A8 78 E:~) 00 E4 8’)

31

41 97 51 90 74 05 AE.

59 F0

14

F8 FD AE 08 2F F1 2F SA 00 SA 57 F0 8E 03 Al

28

3’)

F0 F0 8’) lE 0E 03 lE

23

15

A9 12 A8 22

18 20

9A

..9

F0

01 92 11 131

03 F0 GA 6F

9E

0F 8F

AD

.98 CA OA E6 04 85 52 AE F0 8’) 0F F0

32

48

85 7E: 8E AE

S’A 13 99

23 33

89

613 89 40 FI)

F0 01 F0 lA Al 04 A4 9A

E4

81 F4

80 04 89 14

9F 24

85

34

8E 44 A? 54 98

ED

AE 68 18 08

1:12 58 7B 8E .5E 08 ~A F0 SA lE 0F

6A FF 89 4E 04 02 40 4’) FF F0 02 0F 5ç~~ 0F 48 5A SA 88 CA AE

8E 05 A2

05

94 ES 90 F5

E:A 05 82 1-5

83 25 135 ~

AE

45

6? 55 98

78 78 F8

:39

FI)

OTHER FUNCTIONS NID PRECAUTIONS

uunœyau

C28E—95 C296—9D C29E—A5

S. *E 0D 88

--

80 FD 02

0F E9 FD

C2AS—AD C2AE—85 C296—BD C2BE—C5 C2C6—CD C2CE—D5 C2D6—DD C2DE—E5 C2E6—ED C2EE—F5 C2FS—FD C2FE—05 C306—0D C30E—15 C316—1D C3IE—25 C326-2D

06 2F 0E 04 2F BE *6 8E ED 81 TC 81 CC 81 2* 81 E9

FD 8E 01 AE 80 E4 88 FC 72 04 01 1? 7E 03 25 9E 72

*5 72 89 72 82 2C 04 ED 0E E9 88 EB EF *5 57 *3 0E

C346-4D C34E—55 C356—SD

82

2*

4E

C3?E—85

78

C32E—35 C336—3D C33E—45 C3SE—65 C366—6D C36E—?5 C3?6—?D C386—8D C38E—95 C396—9D C39E—A5

C3A6—AD C3AE—85 C386—BD

C3BE—C5 C3C6—CD C3CE—D5 C3D6—DD C3DE—ES C3E6—ED C3EE—F5 C3F6—FD CSFE—0S C406—CD C40E—I5 C416—ID C4IE—25 C426—2D C42E—35 C436—3D C43E—45 C446—4D C44E—55

ED 72 05 *5 6*

2E 9E 92 BD

08

0E 25 89 7F 8? 89 75 D9 *8 78 FD 85 4F 76 0F 88 60 78 *8 5* 74 *8 78 80 50

78 0F DD 72 4E

80 *8 74 0F *8 .83 9E 72 40 78 1D 78 78 78 FD 85 9F

E3 FE 8E 80

66 85 72 89

40 19 91 0* 83 23 2? 9E *8 FD

89

CD BD 08 9E 2F 89 EB CB 78 8* FD CC FD 80 6* 68 F8 92 ES 80 E9 89 78 CD lE 78

*5 04 89 3C 8E 23 78 09 75 *E C8 84 CA 83 19 06 8E 0* 78 8E 78 35 E9 8? lE 74

*8 25 BD 73 9E 68 ID FD *E FD 75 88 88 6C 00 DF 05 24 7? 78 20 01 38 00 81 ED

0E 99 0E 0F 4E

25 eo ED

9E

1C

FC oc 80

0E 83 ES 2F 8E 00 2? 0E 89 0E EF CD ?C ?D CE 80 68

FD oo 0F

88 2C 72 40 80 SA 85 01 35 FE 72 80 80 CD FD AE F8

AE 6* 03

33 ED 0E 89 8E 50 0E 82 FD ED OD FD25 8* 81 72 9E

80 03 89

6* 72 01 AC DD CD 9* 0E 60 78 01 *8 7F F0 F0 09 3*

92 48 2C 9E 82 88 CD AE 85 2E

0* 72 25 8* 4E 19 82 72 OD 6*

04 44 F2 68 4E 48 03 0F .9* 18

A? 09 0E 76 20 FE 9* 6* 25 8E

78 89 72 25 8? W 74 F9 6* 78 9E FD F0 DS AS F8 88 F9 8* DC 80 6* 78 20 SE 01

3D 7?

D9 9E

89 IC

01 *3 EF 75 12 88 SA 0* 78 *0 *2 BD 10 34 00 ES 00 81 FF 89

*5 78 2E 9* CC F0 CE E9 75 81 89 FF 85 58 ED 8E CD 2C 83 09

78

FD

ED

9E BD *5 71

F0

23 02 E0 BC

0F

25 29 02 40 75 72 *5 83 58 58 78 68 05 01 AE 40 78 78 78 ES 5E 14 ED

OTHER FUNCTIONS AND PRECAUTIONS

Memory address

data

02 SA E

89 02 C~-i

07 SA ~E

24

0E)

ES

76

88 8E:

RO 75

0E) lA

18

F5

8E: 99 65

4E F8 FF

B? B? E? 8? 15 1 0

05 47 2R

E:? 53 65

14 38

BD 03 15

C456—SD

7E:

SA

C45E—65 ~t~—bD

EE: ~

78 6E

C4SE—75

59

C476—7D C4TE—85

0E 18 OC

C4:3E—95

C496—90 849E—AS

5

E

-~

C4AE—85 C4BE—C5

C$C8—CD C4CE—D5

8E

C4D6—DD 840E—ES C4E6—ED C4EE—F5

18 85

C4FE—05 C506—0D 850E—15 8516—iD

81) 08 CD

C4FG—FD

851 E—25 C526—2D CS2E-35 8536—3D 853E—45 8545—4E) 854E—4F

OC 6E 02

Dli

UA

AS F6 FD FD EO

74

5H

50 :3:3 27 8E FF

81 04 lE

87

0E)

lE) 8? 81 F~ 02 F6 8E

13

54

EB

5E DO 98

61 34 CF

81 SA 9E

08 B~3 Al

‘34

83

4F

4A

0:3

25

ES

78

05

.34 1R ?B SA lA lA 00

8?

SA 84 0F 68 FD FE)

2A 0E)

OC’

!8 bD 63 07 2R lA

EE 8E E 6F 86 71

71 78 £ 67 B? 5E

8E: 0E) 18 F: 85 FD 37

35 8E FD l~ 0E) OR :3E

87 24 A$ 48E FD 78

u

FD 44 1E :38 78

65

6E

6E 1 8 3R 0E 88 86

28

6E ~ 40 8E FD ES

98 3E

E?

FE) 01

18 F5

3? !1E

5E 4’)

FE 8E

56 EE) 4’.3 03 60 8A 76 ;A OR 02 lA 72

9E 78 76 40 CD EF AS ~ 48 68 FE) 8A

0E) SA 4A 91 24 8E FD

FD

IR

SE

00 20 ‘lA EF

(3) Loading the CE-153 controt utility program ‘1. 2. 3. 4.

Turn off the power of the PC-1600 main unit, then remove alt memory modules. Connect CE-150 to the PC-1600 main unit. Turn on the power ofthe PC-1600 main unit. Set the PC-1600 in the RUN mode, and execute the following commands: MODE1 A=1200 CALL &2DD,A

(These commands reserve a memory area in which the utility program is loaded.) 5. Connect the cassette tape recorder to the PC-1600, set the cassette tape containing the utility program., and execute the following statement. CLOADM XPEEK&7035*256+XPEEK&7034—32768 Now the utility program has been loaded in memory. The loaded program witi be destroyed if you do ALL RESET. Now, turn off the power of the PC-1600 and install the necessary memory modules.

(4) Executing the CE-153 contro~utilîty program 1. Execute the following statement: XCALL (XPEEK&7035*256+XPEEK&7034—32768)

This statement is equivalent to the statement CALL &40C6 of the CE-153 control utiRt~/~r~~ram written for PC-1500.

OTHER FUNCTIONS AND PRECAUTIONS 2. Special usage 1 of software keybaard (See CE-153 INSTRUCTION MANUAL.) XCALL (XPEEK&7035*256+XPEEK&7034—32768)+4

3. Special usage 2 of software keybaard (See CE-153 INSTRUCTION MANUAL.) XCALL (XPEEK&7035 * 256+XPEEK&7034—32768) +8 Nates 1: Yau must specify e character display pasition by CURSOR command befare you run the utility pragram. Exemple: 100: CURSOR 0,0: XCALL &6B50 2: Characters entered fram the software keyboard are always displayed an the third line (battom une) of the screen. Therefore, CURSOR command is effective only ta the X coordinate value. 3: When the software keyboard is in use, the cursar display is always an andthe cursor type is the twa-character composite cursor (an underline and a space).

5.13 RST COMMANDS 0F SC-7852 (Z-80) Some of the RST commands af Z-80 are open to the user. These commands are used ta jump to a system work area. (When the system is in the reset stete, RET cammand is written in the system work areas.) A system wark area of 3 bytes is prepared far each user RST command. By writing e JP instruction into these three bytes, the user cen maye cantrol ta an arbitrary routine.

RST command

Description

RST 00K RST 08H

System reset c..

~

Reserved by SHARP

RST 10H

Reserved by SHARP

RST 18H

Reserved by SHARP

RST 20H

IOCS for inter-bank call

RST 28H

Reserved by SHARP

RST 30H

JP FOD4H

Open ta user

RST 38H

JP FOD7H

Open to user

OTHER FUNCTIONS AND PRECAUTIONS

5.14 SC-7852 (Z-80) AND LH-5803 MICROPROCESSORS (1) Switch~ngthe rn~croprocessors The PC-1600 has twa main CPUs: SC-7852 and LH-5803. The system uses ane of the twa CPUs at a time: when one is in the operation state, the other is in the non-operation state. Usually the system uses SC-7852 (Z-80) as the main CPU. Far contrai of a peripheral device far PC-1500 or for executian of a pragram written in the LH-5803 machine language, the CPU is switched ta LH-5803.

(2) How to cail an LH~58O3machine ~anguage program subrouthie from SC-7852 To cali an LH-5803 machine language program from SC-7852, use the foliowing IOCS routine.

CALLH Entry Address

01C6H

Function

Move controt from SC-7852 to an LH-5803 machine Ianguage program subroutine. When the pragram execution is comp~éted,control returns to SC-7852.

Parameter

Set the parameters in the appropriete eddresses as described in the foUowing table.

Name

Address*1

CMDZ

FOO2H (7002H)

Operation mode*2

PARA

FOO5H (7005H)

Value to be passed to A register of LH-5803

PARXL

FOO6H (7006K)

Value to be passed to XL register of LH-5803

~

FOO7H (7007H)

Value to be pessed to XH register of LH-5803 ~

~

FOO8H (7008H)

Value to be passed ta YL register af LH-5803

FOO9H (7009H)

Value ta be passed ta YH register of LH-5803

~

FOOAH (700AH)

Value ta be passed ta UL register of LH-5803

FOOBH

Value ta be passed ta UH register of LH-5803

~

(700BH)

I

~

FOOCH (700CH)

Entry address af a called subrautine (low byte)*3

~

FOODH (700DH)

Entry address of a called subroutine (high byte)*3

FOOEH (700EH)

Bank of a called subrautine*4

PARXH PARYL PARYH PARUL PARUH

PARPCL PARPCH PARBAN

Contents

OTHER FUNCTIONS AND PRECAUTIONS *1: The eddresses are thase viewed fram SC-7852. Those enclased in brackets are the addresses viewed from LH-5803. *2: CMDZ (operatian made) must be either 20H or 30H. CMDZ=20H: When contraI is maved ta LH-5803, na parameters are passed ta the registers of LH-5803. =30H: When contraI is moved to LH-5803, the values set in PARA to PARUH (i.e., FOO5H ta FOOBH) are passed ta the registers of LH-5803. *3: The entry address must be an address viewed from LH-5803. *4: PARBAN=OOH: ~V =O1H: PV Return

When the LH-5803 machine language subroutine is campleted and contraI returns ta SC-7852, the contents of the LH-5803’s registers are stored in memary. When the operation mode is CMDZ~20H

Contents

Address FOO5H

Content af A register of LH-5803

FOO4H

Content af STATUS(T) register of LH-5803

When the aperation made is CMDZ=30H Address FOO5H FOO4H

Affected Register

5.15

Contents Content of A register af LH-5803

1 Content of STATUS(T) register of LH-5803

FOO6H

Content of XL reg ister of LH-5803

FOO7H

Content of XH register of LH-5803

FOO8H

Content of YL register of LH-5803

FOO9H

Content of YH register of LH-5803

FOOAH

Content of UL register of LH-5803

FOOBH

Content af UH register of LH-5803

Alt registers

COMPATIBILITY WITH PC-1500

The BASIC interpreter of PC-1600 is basically compatible with pragrams writteri for PC-1 500/PC-1 500A and compatible with peripherat devices far PC-1 500/PC-1 500A, although there are same restrictions.

OTHER FUNCT~ONSAND PRECAUTIONS

(1) Restrieflons [n running a BAS~C program wrïtten for PC-1500!

PC-1500A To run a BASIC pragram written for PC-1 500/PC-1500A in the same conditions (such as the single flne display) as when run an PC-1500/PC-1500A, set the PC-1600 in MODE 1 before executing the ::‘~gram. use the PC-1600 in MODE 1, the foliowing conditions must be satisfied: RAM module af more than 16 KB must not be installed in stot 1 and any RAM module must flot be instalted in slat 2. Hawever, if a RAM module is used as a RAM disk, CE-1600M can be ~nstatledin siot 1 and CE-1600M or CE-161 can be instaiied in siot 2. In this case, the formatting of e RAM disk (INIT ‘~Sn:”,”F”)must be dane in MODE 0. Some BASIC cammand names are different between PC-1600 and PC-1 500/PC-1 500A.

PC-1 500/PC-1500A command names

PC-1600 command names

LCURSOR

TAB

Li N E

LU NE

CALL

XCALL

POKE

XPOKE

PEEK

XPEEK

POKE#

XPOKE#

PEEK#

XPEEK#

~ When you enter a BASIC program text written for PC-1500/PC-1500A fram the keyboard, change zne command names as described abave.



i

When you Iaad a BASIC pragram written for PC-1 500/PC-1500A fram a cassette tape recarder, PC-1500/PC-1500A command names are automaticaliy rewritten ta the corresponding ~C-i600 command names, except for LCURSOR. In this case, after loading the program, rewrite ..CURSOR” ta “TAB”. -.~inga BASIC program written far PC-1 500/PC-1 500A from a cassette tape recorder .~henthe CE-150 or CE-162E cassette interface is used, you can load a program. .~nenthe CE-1600P cassette interface is used, you can iaad a program in the MODE 1 but you cennot load data. • ‘E command e PC-1500/PC-1500A BASIC, yau can speci~TIME=0. In the PC-1600 BASIC, hawever, TIME=0 -esult in an errar. e e-et new reserved wards (NAME, AS, XOR, etc.) have been added ta the PC-1600 BASIC. If ~vordsare used as a variable name in a PC-1500/PC-1500A BASIC pragram, change thom ta e- non-reserved words. ~se of the work areas far the BASIC interpreter is different between the PC-1500/PC-1500A 2 :nd the PC-1600 BASIC. Because of this, a PC-1500/PC-1500A BASIC program including a :C language program may not run properly on the PC-1600. e PC-1 500A memory area from 7CO1H to 7FFFH is used as the system work area in the PC-1600. e PC-1 500A BASIC program using any memory locations between 7CO1H and 7FFFH cannot ~hePC-1600. ~-ayvariable cannat be used for the assignment variable of an INPUT statement which is ta be -~‘-edta CE-158. -~









-.

-~

--

OTHER FUNCTIONS AND PRECAUTIONS

(2) Restrictions in using a peripheral device for PC-1500/PC-1500A 1. RAM module The fallawing RAM modules can only be installed in the memory slots. Memory slot 1: CE-1600M, CE-161, CE-159, CE-155, CE-151 Memory slot 2: CE-1600M, CE-161 2. CE-150, CE-158, CE-162E • Use in MODE O a) LLIST, CSAVE, CLOAD, CSAVEM and CLOADM cannat be executed ta these peripherel devices. b) If a command with a variable other than a fixed variable specified in the operand is executed ta these peripheral devices, the cammand will result in enerror. Far instance, LPRINT Al this cammand wilI result in an error. Change thi~ta the fallawing: A=A1 LPRINT A c) TERMINAL and DTE cammands cannat be used ta CE-158. • Use in MODE 1 Execution of e cammend ta CE-150, CE-158, or CE-162E is effective anly in the scope supported • in the PC-1500/PC-1500A BASIC. For instance, LPRINT TIME$ this command wilI result in an error since TIME$ is flot supported in the PC-1500/PC-1500A BASIC. 3. CE-153 For the use of CE-153, see section 5.12 “CE-153 CONTROL UTILITY”. The utility program which cornes with CE-153 cannot be used on the PC-1600. 4. Differences between CE-150 and CE-1600P • Since the printable area is different between these printers, the format of the printaut may differ. (Yau can change the printirig area by PCONSOLE “LPTl :“ cammand and PAPER command.) • CE-150 has two remote contraI terminaIs, while CE-1600P has only one.

OTHER FUNCTIONS AND PREÇ~AUTIONS

5~16PRECAUT~ONSFOR APPL!CAT~ONPROGRAM DEVELOPMENT The IOCS routines covered in this manual will flot be changed even when the system software is revised in the future. Therefore, when you develap e machine language program far the PC-1600, it is recommended ta write it using the fOCS calis. There are e couple af versions of PC-1600 BASIC interpreters and they are different in the minor specifications. When yau develop a program using the BASIC, keep the following rules so that the program yau meke can be compatible with aIl these versions. (1)

US~NGformat

Ta print a numeric value in the exponent format using a USING specification, the number of characters specifying the exponent part must be 2. Example: USING “##.####A”

(2) ~NPUT“”; statement Avoid the end of the message being displayed at the right mast column on the~screen.

(3) ~NPUTstatement Ta specify an input position far an INPUT statement by CURSOR statement, execute a CURSOR staternent before each INPUT statement. Exemple: 100: CURSOR 10,1 110: INPUT “A=”;A 120: CURSOR 10,1 130: INPUT “B=”;B

If an arrey variable or @ is used for the assignment variable of INPUT statement, the subscript must not be specified by an expression that includes a string.

(4) Addition of string data When adding string items, each item must not consist of a function that cantains a string constant. For instance, B$=”ABC”+STR$ LEN”XYZ” should be written in the follawing two fines: A$=STR$ LEN”XYZ” B$= “ABC”+A$

(5)

UNE

statement

When a LINE statement is given with the dot taggle parameter af X and the option B, the corners of e box may flot be displayed on or off properly.

I ni

OTHER FUNCTIONS AND PRECAUTIONS

(6) WAKE$(O) statement To disable the wakeup function by using an WAKE$(0)=” Example: 100: A=LEN ALARM$ 110: WAKE$(0)=” 120: IF A=0 LET A=A: ALARM$=”



statement, do as fallows:

In this exemple, the program checks whether the alarm functian is on before executing WAKE$(0)= After execution of WAKE$(0)=” the pragram resets the alarm function. “.

“,

(7) CALL When a CALL statement is executed with a string variable, if the machine Iangu~geprogram is ta pass a nuIl string back ta the string variable when returning ta the calling BASIC program, the nuIl string must be expressed as a 00H code of length 1.

(8) XCALL statement If you want to give a parameter of XCALL statement by e variable, use a fixedor a simple variable only.

(9) DIM statement When declaring e two-dimensional array variable, the subscript must flot exceed 254.

(10) LUNE/RUNE statement (to CE-1600P) When executing a LLINE or RUNE statement, be sure ta specify a line type.

(11) CSIZE statement (to CE-1600P) If you change the cheracter size ta e larger one by CSIZE statement when the printer is in the text mode and the pen is at a position other than the left end, ensure the correct pen position by executing the appropriete LCURSOR statement.

(12) PZONE “LPTl :“ statement (to CE-1600P) In the text mode, when you specify a print zone Iength by e PZONE “LPTl:” statement, the zone Iength (characters per zone) must be given such e value that an integer multiple of the zone Iength equals the current Iine length (characters per line).

(13) PCONSOLE “LPTI :“ statement (to CE-1600P) When a left margin has been set by a PCONSOLE “LPTl :“ statement, if the number af characters ta be printed on a fine is less than or equel ta the value shown in the table below, you must append ta the characters as many spaces as the total number of characters includiig these spaces becomes that value plus 1 before performing CR+LF operation.

Character size

Na. of characters

CSIZE 1

3

CSIZE2ta5

1

i

n’~

OTHER FUNCTIONS AND PRECAUTIONS

(14) LET statement Do not use a LET statement ta assign a value ta e system variable (TIME, TIME$, DATE$, ALARM$, WAKE$). Exemple: LET TIME=102513.45 (Not atlowed)

.4 nr~

3.

CHAPTER 6 WORK AREA USED FOR BASIC I~..

t,

s~’.

I 1û~

WORK AREA USED FOR BASIC

6.1 OVERVIEW 0F WORK AREA The PC-1600 uses a wark area af 4 KB, from F000H ta FFFFH of bank O viewed from SC-7852 (or fram 7000H to 7FFFH viewed from LH-5803). The work aree cansists mainly of five blacks from black A ta black E as shown in the table belaw. Block Address (viewed name from SC-7852) F000H

Contents (Z-80 address)

Address (viewed. from LH-5803) 7000H

FO5CH F1B2H F21DH A

F31DH F3C7H

IOCS work lnterpreter work I .

Edit buffer (256 bytes) Interpreter work II Default FCB (313 bytes)

F500H F5FFH

75FFH

F600H

7600H ~

Z-80 stack area (256 bytes) Same usage as for PC-l 500/PC-1500A display area I PC-1500/PC-1500A F650H Fixed variables area (E$ to 0$) F700H

D

C

D E

F7FFH

77FFH

F800H

7800H

FBFFH

7BFFH

FCOOH

7COOH

F750H

7FFFH

Fixed variables area (P$ ta Z$)

Same wark area and usage as for PC-15001 PC-1500A FCBOH

FF2OH FF21 H FFFFH

PC-1 500/PC-1 500A display area II

RAM file wark lnterpreter work ffi

Reserved by system

Blocks A ta E are used for the fallowing purposes. Block A: This black is used far the fOCS, interpreter, defauft FCB, and Z-80 stack. (Extended for PC-1600) Block B: This black is used in the same way as for PC-1500/PC-1500A, and consists of twa parts: • PC-1500/PC-1500A display memary space area • Fixed variables (E$ ta Z$) erea Biock C: This black is used in the same way es for PC-1 500/PC-1 500A, and consists of five parts: • LH-5803 stack area F800H ta F84FH • Fixed variables area: A ta Z F900H to F9CFH A$toD$ F8COHtoF8FFH • Arithmetic operation work FAOOH to FA37H • Buffers: String buffer FB1OH ta FB5FH Output buffer FB6OH ta FBAFH Input buffer FBBOH ta FBFFH • lnterpreterwork Block D: This black is used for the RAM file work, etc. (Extended far PC-1600) Block E: PC-1600 system reserved area, which will be used by CE-1FO1A (barcode pen reader software) I

WORK AREA USED FOR BASIC Note: Since the black C is used in the same way as for PC-1500/PC-1500A, bear the fallawing points in mmd. • A 2-byte data is written in the order of the high byte and the low byte. • The addressing uses an address viewed from LH-5803 (the MSB of almost aIl LH-5803 addresses is “0”.) Thus, when viewed fram SC-7852, the MSB of each address is inverted.

6~2EXPANSION 0F WORK AREA AND BUFFER The standard work area af PC-1600 is from F000H ta FFFFH, however, it can be expanded ta the lower

eddress direction (down ta C000H) in the fallawing cases: • When a peripheral device is connected • When a buffer is explicitly expended by the appropriate cammand 1)

Connection of a peripheral device

ren e peripheral device is connected ta the PC-1600, the pragram (ROM) ta control the device is ~oped as shown in figure (a) and is laeded into the expanded work area as shown in figure (b). Fig. (a) Bank 0

1

2

3

4

EXDEV1

EXROM2

EXROM3 (CE-1FO1A)

(CE-1 600P)

EXDEV8

EXROM9

EXROMA

EXROM4

EXROME (CE-1 600P)

30H

--

~~1

(Bank

and address v~ewedfrom SC-7852)

1 Q7

5

6

7

EXROM5

EXROM6

EXROM7

EXROMD

EXROME

(CE-l 600F)

EXROMC

(CE-1600P)

WORK AREA USED FOR BASIC 1)

Fig.(b)

C000H

Variables

‘t

XXOOH PTRGt> File buffer PTRF t>

Communication buffer

PTRE>

•......A buffer whose size je determined by the number of files (n) specified by MAXFILES stotement (313 X n bytes) is reserved here. When the buffer size is specified by INIT ‘COMn:” statement, the buffer is

reserved here. Work area for EXROME

PTRD t> Work area for EXROMD PTRC t~ Work area for EXROMC PTRBt>

Work ares for EXROMB PTRA t> Work area for EXROMA PTR9 t> Work ares for EXROM9 P1118 t> Work area for EXROM8 PTR7>

Work areas for 14 ROM areas shown in figure la)

Work area for EXRaM7

PTR6> Work area for EXROM6 Work area for CE-1600F (1,065

P1115 I>

Work area for EXROM5

.

PTR4 t>

bytes)

Work area for EXROM4

PTR3 t> Work area for EXROM3

.

Work ares for CE-1FO1A

PTR2 t> Work area for EXROM2 PTR1 t> Work area for EXROM1 F000H Standard work area

FFFFH

As shown in figure (a), there ~re 14 memory blacks for the peripheral devices (8 KB per black). The following five blacks among these 14 blacks are used for particuler peripheral devices: EXROM3: Used for CE-1 FO1A EXROM5: Used for CE-1600F EXROM4: Used far CE-1600P (The wark area is flot expanded even when CE-1600P is EXROMB: connected. It uses the standard work aree.) EXROMC: The other nine memory blacks are reserved far future peripheral devices.

(2) Reserving and releasing the work areas and buffers 1. Work When the PC-1600 is ail-reset or reset or powered on, if there is e peripherel device cannected, the relevant work area is reserved. The reserved work area is released when you pawer off the PC-1600 and remove the peripheral device and power on again. Hawever, the work arees for EXROM3 and EXROMA are released when the PC-1600 is ail-reset or when the wark areas are released expiicitly by using the appropriate commands.

.4 f,

n

WORK AREA USED FOR BASIC 2. Buffer Expanding command

Releasing command ALLRESETj

Communication buffer INIT “COMn:”, m (m80) File buffer

MAXFILES=m (m1)

~

Po~~~oN

INIT “COMn:”, O

Released

Released

Released

MAXFILESO

Released

j Maintained

Maintained

(3) Pointers to point the work areas and buffers (PTR1 to PTRG in figure (b) above) Each pointer points ta the starting address of the relevant work area, which is stored in the standard work area. The following table shows the pointers and the standard wark area locations where the

ontents of each pointer are stored (the address data are stared in the order af the low address byte ~nd the high address byte.) Pointer name

Locations

Pointer name

Locations

Pointer name

Locations

PTR7

FO3C, 3DH

PTRE

FO4A, 4BH

FO3E 3FH

PTRF

FO4C 4DH

F040, 41H

PTRG

FO4E, 4FH

PTR1

F030 31H

PTR8

PTR2

F032, 33H

PTR9

F034, 35H

PTRA

F042, 43H

PT~4

F036, 37H

PTRB

F044, 45H

r~TR5

F038, 39H

PTRC

F046, 47H

PTR6

FO3A, 3BH

PTRD

F048, 49H

PTR3





can check whether or nat the work erea for a particular peripheral device or e buffer is reserved in ~e~oHowingmethod: First, read the content of the pointer for the wark area or buffer cancerned, and ~cthe content of the pointer far the work area or buffer which is reserved (at the higher adjacent ~r~ess) next ta the former work area or buffer (if you want ta check EXDEV1, use F000H.) Then, are the contents af these twa pointers. if they are different, the wark area or buffer concerned is ar~ed.if they are the same, it is nat reserved.

~Work area for EXROM3 work area is used far CE-1 FO1A (the barcode pen reader software). If CE-1 FO1A is flot cannected, ~art use this memary area as a machine language pragram area.

raserve

Set A=(size ta be reserved), then execute: CALL &O2DD,A

-eease

Set A=0 then execute: CALL &O2DD,A

ariables area ~es area is reserved in the memary locations lower than xxOOH, next ta the file buffer. The ocatians from xxOOH ta the beginning of the file buffer is flot used. ~e variables area is reserved in units af 256 bytes, reservation or expansion af work areas and ~•cesflot cause the user area (program and variables areas) ta be reduced simply by that

WORK AREA USED FOR BASIC

6.3 WORK AREA MAP The following shows the work area map used far the BASIC. Name

Address

Contents

FO2D

FBNO

MAXALES value

FO4C F04D

FBBP FBBP

Communication buffer start address (L) Communication buffer start address (H)

FO4E FO4F

FCBPTR FCBPTR

FCB buffer start address (L) FCB buffer start address (H)

FO5C

DSPLPTR

LCD display start fine

FO5D

LCDWK1

LCD work area 1 Bit 0: LCD made (fixed ta “0”) Bit 2: Character generator mode (“0” PC-1600, “1 “=PC-l 500) Bit 3: ContraI characters (“O”=Nat displayed, “1 “=Displayed) Bit 4: Cursor blinking speed (“O”=slow, ‘1 “=fast)

FO5E

LCDWK2

LCD work area 2 Bit 0: Cursor blinking work area Bit 1: Interrupt request mask far LCD

FO5F

CRSRY

Cursor X coordinate

F060

CRSRX

Cursor Y coordinate

F061 F062

CTRCGA CTRCGA

Start address (L) of CG table far contrai characters Start address (H) of CG table for contrai characters

F063

CRTCGB

Bank number of CG table for control characters

F064 F065

UPACGA UPACGA

Start address (L) of CG table far character cades fram 80H ta FFH Start address (H) of CG table far character codes from 80H ta FFH

F066

UPACGB

Bank number of CG table far character does from 80H ta FFH

F067

CRSRST

Cursor type “00H” =Cursor display off “O1H”=Underline cursar “02H”=Square cursor “03H” =Space cursor

F068

CBLCTR

Cursor blinking counter

F079

KEYWK1

Key work area 1 Bit 1: Clicking sound (“O”=OFF, “l”=ON) Bit 2: Repeat (“O”=OFF, “l”=ON) Bit 3: Repeated key (“O”=Other than special keys, “l”=Ail keys) Bit 4: Repeat delay time (“O”=’l sec., “1”=0.8 sec.) Bit 5: Bit6: Bit 7: Key code conversion (“O”=ON, “l”=OFF)

FO7A

KEYWK2

Key work area 2

FO7B

KEYWK3

Key wark area 3

F182H

PITCHX

Character pitch value af PITCH command

F183H

PITCHY

Line spacing value of PITCH command

1

WORK AREA USED FOR BASIC Address

[

Name

Contents

F184H

COLORP

Bits O ta 3: Pen color of plotterfprinter Bits 4 ta 7: Must not be changed

F185H

WIDTH

Characters per une

F187H

FLAGA

Bit 0: Fixed ta 1 Bits 1 to 4: Must not be changed Bits 5 and 6: Line-feed code specification bit6 = “1” and bitS = “1”: LF bit6 = “1” and bit5 = “0”: CR+LF bit 6 = “0” and bit 5 = “1”: CR

F188H F189H

CUSZL CUSZH

Scissoring counter (L) Scissoring caunter (H)

F18FH F19OH

SZXRL SZXRH

X direction right end scissoring area (L) X direction right end scissoring area (H)

F191H F192H

SZXL SZXH

X direction left end scissaring area (L) X direction left end scissoring area (H)

F194H

INZONE

Pen position (Number of characters counted from the left end)

F88FH

OUTPUT BUFFER POINTER

Pointer for the autput buffer

F890H

FOR POINTER

Stack pointer for FOR...NEXT

FB91H

GOSUB POINTER

Pointer far GOSUB

F894H

STRING BUFFER POINTER

Pointer for the string buffer

F895H

US1NG F/F

USING format (contrai of decimal point and comma)

F896H

USING M

Integer part af USING

F897H F898H

USING & USING m

F899H

VARIABLE POINTER H

F89AH

VARIABLE POINTER L

F89BH

ERL

F89CH

CURRENT LINE H

F89DH

CURRENT LINE L

F89EH

CURRENTTOPH

F89FH

CURRENTTOPL

F8A6H

SEARCH ADDRESS H

F8A7H

SEARCH ADDRESS L

F8A8H

SEARCH LINE H

F8A9H

SEARCH LINE L

F8AAH

SEARCHTOPH

F8ABH

SEARCHTOPL

USING for string Decimal point of USING Pointer far variables Error number of the error occurred Current program line number

Start address of the pragram af the current fine

Address af the fine faund in the search operatian

Line number 0f the fine found after the search operation L________________________________________________

~Start address of the program black searched

o-

o o ‘s Q,

o

WORK AREA USED FOR BASIC Name

Address

Contents

F8ACH

BREAK ADDRESS H

F8ADH

BREAK ADDRESS L

F8AEH

BREAK LINEH

F8AFH

BREAK LINEL

F8BOH

BREAK TOP H

F8B1H

BREAKTOPL

F8B2H

ERROR ADDRESS H

F8B3H

ERROR ADDRESS L

F8B4H

ERROR LINE H

F8B5H

ERROR LINE L

F8B6H

ERROR TOP H

F8B7H

ERRORTOPL

F8B9H F8BAH

r J.

Address where the break accurred

Line number where the break occurred

Start address of the program black where the break accurred

Address where the error accu rred .

Line number where the error occurred 2

Start address of the program black where the error accurred .

ON ERROR ADDRESS H

F8B8H

L

Address ta which control jumps when an errar accurs

ON ERROR ADDRESS L ONERRORLINEH

Line number to which contraI jumps when an error occurs

F8BBH

ON ERROR LINE L

F8BCH

ON ERROR TOP H

F8BDH

ON ERROR TOP L

F8CO-F8CF

ADOLAR

F8DO-F8DF

BDOLAR

F8EO-F8EF

CDOLAR

Content of variable B$ Content of variable C$

F8FO-F8FF

DDOLAR

Content af variable D$

F900-F907

AVAR

Content of variable A

F908-F9OF

BVAR

Content of variable B

F910-F917

CVAR

Content of variable C

F918-F91 F

DVAR

Content of variable D

F920-F927

EVAR

Content af variable E

F928-F92F

FVAR

Content of variable F

F930-F937

GVAR

Content af variable G

F938-F93F

HVAR

Content af variable H

F940-F947

IVAR

Content of variable f

F948-F94F

JVAR

Content of variable J

F950-F957

KVAR

Content of variable K



Start address of the program black where the error occurred L______________________________________________

Content of variable A$

WORK AREA USED FOR BASIC Address

Name

Contents

F958-F95F

LVAR

F960-F967

MVAR

Content of variable M

F968-F96F

NVAR

Content ai variable N

F970-F977

OVAR

Content of variable O

F978-F97F

PVAR

Content ai variable P

F980-F987

QVAR

Content af variable Q

F988-F98F

RVAR

Content ai variable R

F990-F997

SVAR

Content ai variable S

F998-F99F

TVAR

Content of variable T

F9AO-F9A7

UVAR

Content ai variable U

F9A8-F9AF

VVAR

Content ai variable V

F9BO-F9B7

WVAR

Content ai variabfe W

F9B8-F9BF

XVAR

Content of variable X

F9CO-F9C7

YVAR

Content of variable Y

F9C8-F9ÇF

ZVAR

Content of variable Z

F9D1H

OPN DV

Specificatian ai peripheral device

F9EOH



USER COUNTER XH .~.

F9E1H

j_USER COUNTER XL

F9E2H

USER COUNTER YH

F9E3H

USER COUNTER YL

F9E4H

SCISSORING COU NTER YH

F9E5H

SCISSORING COU NTER YL

F9E6H

ABSOLUTE POSSITION X

F9E7H

SCISSORING COUTNER XL

Content of variable L

Counter ta specify the pen position X coardinate

Counter to speciiy the pen position Y coordinate

Scissoring counter for Y direction

X direction absolute position counter

Scissoring counter far X direction

F9E8H

SCISSORING COUTNER XH

F9EAH

UNE TYPE

Line type

F9EBH

DOT LINE COUNTER

Datted-line counter

F9ECH

UP/DOWN

Pen up/down state

F9EDH

X MOTOR HOLD COUNTER

X mator hold counter

F9EEH

PORT C

Current motor phase

o ‘n

o o s, ‘s

o

WORK AREA USED FOR BASIC Address

Contents

Name

F9EFH

Y MOTOR HOUD COUNTER

Y mator hald counter

F9FOH

GRAPH/TEXT

Printer mode specification (“255”=Graphics mode, “0” =Text mode)

F9F2H

ROTATE

Printing direction specification

F9F3H

COUOR

Color specification

F9F4H

CSIZE

Print character size specification

F9EOH F9E1H

ABSXU ABSXH

Pen physical position in X direction (U) Pen physical position in X direction (H)

F9E2H F9E3H

OVRXL OVRXH

X direction scissoring caunter (U) X direction scissoring counter (H)

F9E4H F9E5H

OVRYL OVRYH

Y direction scissoring counter (U) Y direction scissaring counter (H)

F9E6H F9E7H

SZMYL SZMYH

—Y direction scissoring area (L) —Y direction scissoring area (H)

F9E8H F9E9H

SZPYU SZPYH

+Y direction scissoring area (U) +Y direction scissaring area (H)

F9EAH

SRXL

F9EBH

SRXH

Pen position X coordinate in graphics mode wherethe coordinate origin is speciiied by SORGN (Range: —4069 ta +4069. A negative value is expressed as a complement ai 2.) (U) Pen position X coardinate in graphics mode where the coordinate origin is speciiied by SORGN (Range: —4069 to +4069. A negative value is expressed as e complement of 2.) (H)

F9ECH F9EDH

SRYU SRYH

Same as SRXU except this is for Y coordinate Same as SRXH except this is for Y coordinate

F9EFH

MODE

Plotter/printer made Bit 0: “O”=Text mode, “l”=Graphics made Bit 1: “O”=Cur sheet, “1 “=RoII paper Bits 2 ta 4: Must flot be changed Bit 5: “0”=Printer ready, “1 “=Printer not ready Bit 6: “O”=Pen flot in exchange state “l”=Pen in exchange state Bit 7: “O”=The printer hardware is flot initialized. “1 “=The printer hardware is initialized.

F9F4H

CHR

oo o ‘o

Value set by ROTATE statement Bits4to7: ROTATEOta3 Bits O ta 3: DIRECTION (pen movement) O ta 3

L) o

o

F9F5H

CSIZEP

Value set by CSIZE statement BitsOta3: CSIZE1to9 Bits 4 and 5: Must flot be changed Bit 6: Fixed ta “0” Bit 7: Fixed ta “0”

F9F6H

UINE

Une type Bitsoto3: Uinetypeoto9 Bits 4 ta 7: Must flot be changed

F9F7H

ZONE

Value set by PZONE statement

‘s Q, ‘s

WORK AREA USED FOR BASIC Name

Address PWORK

F9F8H

Contents Special work area Bit 0: “1 “=For LLIST, the Iist is printed in characters of the special size. “0”=Normal mode

pen is flot Iifted up after an LLINE or RLINE statement is executed. (This state is given when Une type “20” is specified in an LUNE or RLINE statement.) “0” =Norma) mode Fixed to “0” Must not be changed “1”=The pen is flot moved when paper is fed by the L key. “0”=Normal mode “1”=The scissoring in the -v direction is not performed when the printer is in the graphics mode and roli paper is used. “O”=Normal mode Fixed to “0”

Bit 1: “1”=The

Bit 2: Bit 4: Bit 5: Bit 6:

Bit 7:

t

F9FFH

LOCK

FBOOH

RNDNUMBER

FBO1H

RNDNUMBER

FBO2H

RND NUMBER

FBO3H

RNDNUMBER

FBO4H

RNDNUMBER

FBO5H

RNDNUMBER

FBO6H

RND NUMBER

FBO7H

[

LOCKItJNLOCK specification

For generation of a random number

RND NUMBER

E. II. I *1

r~nr

CHAPTER 7 PC~1600 HARDWARE j:. $~1.

~

~ ‘)n7

PC-1600 HARDWARE The PC-1600 has three CPUs and a large memory, hawever, it has been made very compact with use af a gate array and e ane-chip CPU. The fallawing black diagram shows the PC-1600 hardware architecture. This chapter describes the details ai each hardware camponent of the PC-1600. PC-1600 Wock diagram

s Y s T E

M B

u s

s L

o

T

1

s L

o T

2

o R 2 3

2 c

7.1 CPU The PC-1600 has three CPUs: twa main CPUs and one sub-CPU. The two main CPUs are SC-7852 (equivalent to Z-80A: 3.58 MHz dock) and LH-5803 (equivalent ta LH-5801: 1.3 MHz dock). The sub-CPU is LU-57813P, which is a 4-bit CMOS pracessar af 307.2 KHz dock.

7.1.1 Specifications of SC-7852 SC-7852 has been deveIaped speciafly far PC-1600 and contains a Z-80A equivalent circuitry and interfaces. (1) InternaI block diagram SC-7852 is e one-chip CPU cansisting af a Z-80A equivalent circuitry and interfaces.

r5r~c)

v

PC-1600 HARDWARE

k. SC-7852 Internai Biock Diagram

MAIN CPU 2

Z-80 BUS

LH-5803

I I Keyboard Buzzer Cassette

Ii:. I,

t. I J

t -t».

Timer RS232d System bus

Main unit RAM SLOT1 SLOT2 Main unit ROM

UART etc.

As shawn in the black diagram, this chip contains Z-SOA, dock generator, memary select circuit, interrupt contrai circuit, i/O port, and interface circuit far LH-5803. (2) TerminaI signaIs SC-7852 is a 100-pin LSI, having several terminais far those signais that Z-80A daes flot have. The table below describes the terminal signaIs ai SC-7852.

PC-1600 HARDWARE SC-7852 Terminai Signais 5ymbol

No.

95—

In/Out

T~—’RTFff

In

Active level Low

1 00—2

Function (1) (2) (3)

3

LHWAIT

Out

High

.

4

4’OS

In

J~fJ—

Internally putled up to VCC by the resistor (200K T input = Low (normal mode) keyboard input, A key in the low input une is pressed. T input = High (emulation mode). Used for connection of the Z-80 ICE.

-~

5aaoK).

Wait output to the LH-5803. The signal goes high in one of the following: (1) When the WAtT input is at s high level. (2) When the LH-5803 accesses ~0H or 8000H FFF FH of the ME1 space, it goes high for one cycle time to insert one wait. (3) When the Z-80 is running with the LH-5803 at hait. LH-5803 basic dock (1.3MHz).

This dock is used for the sync signal

of the internat LH-5810 corresponding port and

generation of the LCD cLOCK (217KHz). 5

PT

Out

Memory bsnk signal.

6

PU

Out

Memory bank signal.

7

PVOUT

Out

Memory bank signal.

8

PVIN

A Jn

LH-5803’s PV signal input. As ~vla kept in the floating state when the Z-80 is operating, it is internally pulied down by the resistor.

9

W~’

ln/Out

Low

(1) (2)

When the Z-80 is in operation, the Z-80’sW~isa direct output on this une. When the LH-5803 je in operation. it becomes an input to enable R/W for LH-5803.

10—25

A15—A0

26—33

DB7”~DB0

34

IORQ

35

MREQ

36

RD

A ln/Out

(1) (2)

ln/Out

A

When the Z-80 is in operation, the Z-80 sddress bus is an output on this une. When the LH-5803 isin operation, the LH-5803 address bus isan input on this une.

Data bus.

ln/Out

(1) (2)

ln/Out

(1)

When the Z-80 is in operation, the Z-80 ~ is an output on this line. When the LH-5803 is in operation, the LH-5803 ME1 is an input on this line.

When the Z-80 la in operation, the Z-80 i~fii~ is an output on this une. (2) When the LH-5803 is in operation, the LH-5803 MEO is an input on this une.

ln/Out

(1)

When the Z-80 is in operation, the Z-80 ‘~

is an output on this une.

(2) When the LH-5803 is in operation, the LH-5803 OD is an input on this une. 37

WAtT

£ In

38

LHA9O

Out

High

WAtT input to the Z-80 and LH-5803. Pulled down internally by a resistor. Among the RAMs (the bank of the spaces C000H’ FFFFH) connected to the RAM3, it is an input to the address AS of the RAM of E000H—FFFFH (the aide A13A is input to ~1). (1) When the Z-80 is in operation, “LHA9O A9” s established. (2) Except that “LHA9O = high” la established when the LH-5803 accesses 7400H— 744FH and 7500H-754FH. In other words, when the LH-5803 tries to access 7400H”-744FH and 7500H— 754FH, it actuauly accesses 7600H-’764F11 and 7700H—774FH.

‘t

2’

‘2.

t”

t

PC-1600 HARDWARE

L’

~in

39

Symbol

Active

ln/Out

Out

T~i

Function

Low

(1) When the Z-80 is in operation, the Z-80i~1is an output on this Iin~. (2) When the LH-5803 is in operation, the signal created from the OPF signal

of the

LH-5803 is sent on this une.

40

~~iT

Out

Low

Refresh signal. (1) The Z-80 ~~Fi signal is on this une. (2) When the LH-5803 is in operation, the signal crested

.

ski.

from

the OPF signal 0f the

L H-5803 is sent on this line.

I’.

41

VDD

42

tO~

VCC Ouf

High

This signal is issued when the LI-l-5803 tries to access ~00H—~0FH and 8000H”O FFFI-t of the ME1 space, When this signal is sent out, one wait la sant to the LH-5803. In terms of timing, the signal s sent with s half dock delay on the ME1.

4OS~

J

I

J

b.~L

ME1] t t

LHWAIT ~

I~.

iOE~

43

Out

Low

Z-80 control ROM select signal. 0000H—7FFFH rnernory space (bank 0).

44

7 Out

Low

(1) (2)

45

Low

Ouf ~

46 47 48

~

ti~i~5 LHS2 EFï~Î

Out

Low

~‘Out

Low Low

7 Out

Z-80 control ROM select signal. 8000H—BFFFH memory space lbank 6). LH-5803 control ROM select signal. C000H—FFFFH memory spsce.

Z-80 control ROM select signal. 4000H 7FFFH memory space (bank 3). Memory select signal. Depending on the stase of bit “6” of

110 3cH, the

memory spaco seledted

differs.



b6=0 ~

.

~

b6=1

A800H—AFFFH

(bank 0)

B000H—B7FFH

(bank 0)

B000H—B7FFH

(bank 0)

A800H-’FAFFH

(bank 0)

B800H-BFFFH

(bank 0)

A000H—A7FFH

(bank 0)

tÏi~Tand Ei~i~ are pulled up internally. LHS3 needs to be pulled up externally. (pulled up externally.)

49

RAM3

50

W~M~

Out

High

Memory select signal (internaI 16KB RAM). C000H—FFFFH (bank 0).

Out

Low

Memory select signal (Si :1.

~

p

~

8000H’BFFFH (bank 0, bank 1). S000H—BFFFH (bank 2, bank 3).

~ I::

51

‘~‘~iT

Out

~

~ 52

ph:.

~i.

Low

SLCT

In

High

Memory select signal (S2:). 8000H—’BFFFH (bank 2, bank 3). When this signal is at low, output of the memory and I/O select signal is disabled. Disabled signaIs are: CSOO1, cSi23, CS24. RAM3, RAM2, RAMi, 10E, IOSU. KA2, KA1, KAO, C/D, and IORP. This input is an output to the subcontroller and is at s high level when the system la on.

PC-1600 HARDWARE Symbol

~‘°

ln/Out

Actve

Function Cassette reproducing signal. PC6’: Beep disable signal. PC7’: Cassette recording signal (PC-1600). SDO’: Cassette recording signa) (PC-1500). P82:

76

SDO

Out

Cassette recording signal output.

::

~

SDO

SDO’ is the cassette recording output by the CE-150. PCT is the cassette recording output by the CE-1600P.

77

?iJï

78

A 10w stase of this signal indicates that the LH-5803 la in operation. (2) A high state 0f this signal indicates that the Z-80 is in operation.

Out

(1)

PCSTB

In/Out

(1)

79

RSTIN

in

80

IRQ

81

1NTO

82

INT1

83

INT4

84

INTS

À

85

PCTRL

Goes into the input mode when reset. This current stste,is Iatched in the PB3 flip-flop. In PC-1600, this termina) s puHed up through an externsl resistor. (2) Goes to the output une in the normal mode. The signal goes high when the Z-80 writes 18H or l/()’or the LH-5803 is FOO8H 0f the ME1. This signal is not used in the output mode with the PC-1600.

Low

A reset input to the SC7852. This signal is forced lowfor30 millisecondsby the sub CPU when ACL or RESET le issued or at power-on.

High

An interrupt to the CPU (Z-80. LH-5803). This line is input as an interrupt request from the PC-1500 peripheral.

High

An interrupt to the CPU. This line is input as an interrupt request from the T8576F.

Low

An interrupt to the CPU. This une is input as an interrupt request from the PC-1600 peripheral. Pu lIed up internally.

TI~

An interrupt to the CPU. An interrupt is sent to the CPU et s high to 10w transition. This une is input at s 1/64 second pulse from the sub CPU. ut is externatty shorted with P85. But, the sub CPU output. which s a P-oh open drain, is pulled down by the externat resistor to assure s 10w output.

In

High

An interrupt to the CPU. This une inputs the output from the sub CPU.

Out

Low

At the time the power-off command is sent to the sub CPU, the sub CPU turns the power off (active low). This signal goes low after the Z-80 cornpletes the following: (t) 11H written to i/O 37H (II) OUT (38H). A (lii) HALT

A

In

In

V

In

In

.

86

CLK

Out

87

T

A

In

Z-80 dock output. 3.58MHz for the PC-1600. (1) (2)

88 89

XOUT XtN

90

VDD

Out In

It is in the normal mode when s 10w signal is received and the Z-80 is operating r,ormally. PuIled down internally. It is in the simulation mode when s high signai is received. The Z-80 bus is in the floating state, and the Z-80 (or Z-80 ICE) can be connected externalty.

The 3.58MHz Z-80 dock is supplied when the oscillator is attached across these lines.

Power input to the high aide (4’-~5.5V).

(5-f’)

PC-1600 HARDWARE (3) VO map Similar ta Z-80A, SC-7852 has a 256-byte I/O space fram 00H ta FFH. The table below shows the I/O map ai SC-7852. i/O Map of SC-7852 00H 0FH

Use prohibited.

10H 1 FH

Port corresponding to LH-5810 (LH-581 1) contained

20H 27H

TC8576F UART setaction

281-4

52 (slot 2)

in the SC7852 (not synchronized with ~‘O5}.

2FH 30H 3FH

SC7852 internat LSI controt register port

4OH

System reset-ve

4FH 50H 5811

HD61102 (1C2), )IC3)

5BH

HD61102

HD61102 (1C3)

System reserve 60H 6FH

S2 (slot 2)

78H 7FH

CE-1600F

80H 83H

CE-1600P

84H

Reserved

Z-80 I/O address

LH-5803

3011 31 H 32H 33H 34H 35H 36H 37H

#AO3OH #A031 H #A032H #A033H #A034H #AO3SH #A036H #A037H

3811 39H 3AH 3BH 3CH 3DH 3EH 3FH

#A038H #A039H #AO3AH #AO3BH #AO3CH #AO3DH #AO3EH #AO3FH

R ead

address

IORMOD IOR MAP IOR INT IOR P ... IOR LHMSK IORZMSK IORAORS lOR KB

W rite IOWMOD 10W 10W

10W 10W LHMSK IOWZMSK IOWCL1 10W CGC register write 10W STP 10W 10W KA Not 10W KS Not used 10W SLT 10W

Note: When writing 10 an I/O space between 30H snd 3DH, if the setting is incorrect, the PC-1600 does not operste properiy.

for future extension

NOTES:

# (Rreg):

tndicates the contents of the memory (MEt accessed) which

BFH

______

at present.

Note: In the machine cycle, 1 wait is automatically inserted.

(5.4

are imptied by

the

LH-5803

CPU internai register (R register). Vacanoy in the Z-80 I/O map which is flot used

PC-1600 HARDWARE

7,1,2 Spec~flcat~ons of LH~=58O3 L H-5803 is an 8-bit C-MOS CPU, which is an upper versiofi of LH-5801. Thereiore, LH—5803 supports ~most ail LH-5801 machine language instructions, except that the SDP, RDP and OFF instructions of L H-5801 aperate as a NOP instruction in LH-5803. The table below describes the terminai signais of LH-5803. Main CPU 1 (LH5803) pin description Symbol I

tn/Out

‘t

4

Function CPU reset input. A high on this unecauses the reset. The contents of the address FFFEH are transferred to the PH register and the contents of FFFFH to the PL register. When the reset input changes from high to Iow, the progrsm starts to execute from the address set in the program counter.

RESET

In

(Nc)



3RQ

In

Bus request. Connected to

SF1

In

8F flip-flop output (BFO) and input (SF1). The BF flip-flop is reset by the OFF command of the CPU. R can be reset when the 8FI isset high. The BFO is at s 10w level when the BF flip-flop la active and st s high levai when not active. The contents of the BF flip-flop are protected as long as VGG is in supply. Because VGG la VCC in the PC-1600, this function is not used and VCC la used for an input.

~ ~

[2

P~ctive

~ ‘

‘t

~

~: ~, ~

itfl~0f

the SC7852 output.

5

VGG

Powersupply (system’sVCC input).

6

8F0

Out

See Pin No.4.

7

OPF

Out

Op code fetch signal which sppears when the CPU fetches the OP code. OPF la the signal that is issued only when the operation code is fetched and is not therefore issued in fetching the address data, immediate data, and the second byte of a 2-step commsnd. 4OS

~

ADO -‘ADlS

I

MEO OPF~_~ Write ‘“cycle 8

BAK

Out

Bus acknowledge signal.

Op fetchcode________

response to

When BRO is set et o high levai, the CPU issues s high BAK state in it. When BAK is et e high levai, the CPU sets the address bus (ADO AOl 5), data bus (DO’-D7), MEO, ME1, R/W, and OD in high impedsnce. 9

VCC

Power supply (systems VCC

PC-1600 HARDWARE

Symbol

ln/Out

Function

10

VGG

Power supply (system’s VCC input).

11

VM

In

LCD backplate power suppiy input.

12

VOis

In

LCD backplate power supply input.

13

VA

In

LCD backplate power supply input.

14

VS

In

LCD backplate power supply input.

15

NMI

In

Non-rnaskabte interrupt input. A high input state causes an interrupt to the CPU. The CPU unconditionslly accepta the request snd starts to execute the interrupt routine from the oddress whose high order address la represented by the contents 0f the address FFFCH and the low order address by the contents of FFFDH.

16

MI

In

Maskable interrupt input. When the lE flag (lnterrupt Enable) is set on, an interrupt request is cauaed by s high Ml input state, and the CPU staris to execute the interrupt routine from the oddress whose high order address is’rèpresented by the contents 0f the address FFF8H ond the 10w order eddress by the contents of FFF9H.

17

I-lIN

In

Input to the counter by wtiich tise LCD and backplate signaIs, HO—t-17, are generated. Normally connected te tise lIA pin of the CPU. With the PC-1600, this function la not

18

HA

Out

CPU internai divider output through which la deuivered tise basic dock for the LCD driver and connected to i~ïi’?~iand the segment signal generator LSt.

19

DISP

Out

LCD disptay on/off control signal output. Can be set and reset by means of a command. With tise PC-1600, this function is not used.

117—HO

Out

Not used by the PC-1600.

J

used.

20—27

LCD backplate signal output.

When tise LCD is driven by tise backplate signal and the segment signal, the backptate signal is issued by the CPU. 28

00

Dut

Outpui disable signai. When OD la st a high level, the CPU disables the data output onto the data bus for the externai device. This signal is issued when writing data in the memory.

f,OS

)ci

~ix~ ~ R/W 0O~ DO—Dl

Memory read cycle

Memory write signal

29

MEO

Out

Memory enable signal. This signal is enabled to directly accesa the 128KB memory area;

30

ME1

Out

MEO sccesses o 64KB srea and ME1 accesses a 64KB ares. The memory area accessible by the program counter P snd stack pointer S la 64KB, for MEO is used by the fetch and stack commands. For sdcessing data, both ME0 and MEt memory areas con be accessed by the CPU command.

In/Out

Bidirectional data bus which is used te write dsta in the external memory or to read data from the externsl memory.

31—38

DO—07

39-’4& -‘A0--’A7

Out

Address bus which may be in three states. Goes to high impedsnce with the BRO (bus request) signal, ut is possible w occase the merrtory ares 0f 64KB. it is also possible to acceas the memory of 128KB using tise MEO ci- MEI aigr~a~.

~~1

PC-1600 HARDWARE

t~.

I

47

GND

48

AS

T

Out

VGG

50—56

I’,.

Power supply.

A9—A1 5

Address bus (see Pin No.39). Power

Out

57

(NC)



58

RIW

Out

Address bus (see Pin No.39).

Memory write signal. With s 10w R/W state, tise data in the CPU are sent on the data

bus. 59

P~’

Out

External latch dock. With a high state of tisis dock, tise contents 0f the accumulator are transferred onto the data bus. Use 0f the tatch IC permits its use as tise output port (see tise ATP command).

60

PV

Dut

61

PU

Out

These are tise CPU internai flip-flop output pins (PU, PV). Tisera are commanda to set and reset PU and PV.

62

~0S

Out

r The dock, in tise sema phase as tise CPU internai basic dock, 15 on tisis une to supply dock pulse to the external system. Wisen a 2.6MHz crystal la connected XLO and XL1, a 1.3MHz dock is supplied.

across

63

XLO

In

64

XL1

Out

Crystat connection pins. XLO la an input and XL1 is an output. Inside tise CPU, tise dock is divided in half. Wisen a 2.6MHz crystal la connected, tise

machine cycle within tise CPU la at 1 3MHz, 65

WAIT

In

CPU wait signal. Wisen tisis input la higis, tise CPU’s internaI operation dock “qt” stops and tise CPU tiserefore stops executing a command. When it resumes s 10w state, the CPU starts to execute s command.

Internai basic dock CPU operating cIOCk/—\f_---__\

WAIT input fl~fIopWA

NOTE: WA la the CPU internaI flip-flop for WAtT. At a isigis to low transition 0f tise dock ~‘OS,input of WAIT s accepted. Tise CPU operating dock ~ stops when WA la at isigis; tise CPU isalts s command execution temporarily as a result. 66—73

1N7—INO

in

as an 8-bit data. t has an internaI puul-up resistor. When not connected, tise CPU assumes tise une to be in isigh impedance.

~ 74—76

(NC)



NOTE: NC: No Connedtion

Ii

Input port. Tise CPU can send tise signal input on tise INO—1N7 to the CPU accumulator

PC-1600 HARDWARE

7.1~3Spec~fîcatîonsof LU57813P LU57813P is a 4-bit CMOS CPU. This section first describes the functions ai LU57813P, then shows the table oi LU57813P terminal signaIs. (1) PC-1600 main power ON/OFF contrai LU57813P turns off the power of the PC-1600 by receiving a cammand from the main CPU, and turfis off the power when the ~J key is pressed. (2) Timer management LU57813P supports one wakeup timer and two alarm timers (counted up every 0.5 second) and manages the caiendar dock. (3) Battery voltage monitoring LU57813P has an A/D converter, with which LU57813P monitors the supply voltages ai the PC-1600 main unit and the peripherai devices. LU57813P turns an the ~ symbol on the LCD when the suppiy voltage gaes beiow a certain level. (4) Anaiog input LU57813P canverts an analag voltage input at the analag port af the PC-1600 into a digital value and passes the value ta the main CPU. (5) Key click sound generation If the key ciicking is enabled, when a key input occurs, the main CPU sends a command ta make LU57813P generate a click sound. (6) Reset signai handling LU57813P manages a reset signal from twa reset switches (ane an the rear side of PC-1600 and the other on the rear side ai CE-1600P). Receiving a reset signai from one of the reset switches, LU57813P sends a reset signal far 30 ms ta the system. (7) Receiving a Cl signai from RS-232C, LU57813P turns on the system. (8) Timer (1/64 second) signal output

PC-1600 HARDWARE ~t.

Sub CPU (LU57813P) pin description

t

Symbol 1

00

In/Out In

~j~7aL Low

In

Function When tise

system-off command

is received from tise Z-80, the system is

turned off sfter this signal goes low. It has PCTRL output from tise SC7852 as its input. ,~t.

2

VDD

3

ACL

4 5

CL1 CL2

6

High side VGG la supplied. In

The pulse widtis of ACL must be greater than 1 microsecond in duration to be recognized by the hardware, It takes about 80 microseconds before tise LSI starts to operate after input of ACL. Tisis pin is used as reset input from tise ALL RESET switcis of tise PC-1600.

High

~.t.

In Out

Tise system dock generating ceramic oacillator is attacised across tisese two unes. With the PC-1600, s 1.229MHz oscitlator is used for tise basic dock of tise RS-232C baud rate.

FOUT

Dut

System dock output. Not used.

7

P0

Out

Low

In

Reset input to tise SC7852. Tisis une is maintained 10w for 30 milliseconds during system-on and reset

8

P1

Out

Low

In

In alow state when tise main CPU is permitted to access the memory and I/O.

9

P2

Out

High

In

In an opposite level of Pi - Input to SLCT of tise SC7852.

10

P3

Out

Low

In

-

In s 10w state during system-on.

Used to turn on tise system. L 11

KH

In

Higis

Tisis signal goes isigis with an input 0f tise ON key. When tise system is off, tisis LSI is in tise stsndby mode, and it tums on the system with o isigh KH state.

12

KI

In

High

A commsnd request from tise main CPU. Interrupt is caused by s isigh Ki

13

T

In

14

OSCOUT

15

OSCIN

In

16

KL

In

state.

Test pin wisich la NC. Tise 32.768 KHz timer crystal osciltator is attached across tisese Iines.

Out

Higis

Reset input from tise peripiserat unit. As monitored by the software, if this

~

input is isigis for more than tise given.time, tise reset is executed. 17

Z15

Out

Higis

In

Z15 and KL are sisorted outside and externally pulled down by the resistor. Z15 is turned isigh for 1 mitlisecond in tise reset routine to be converted into the R5TE signal, and sent to peripiserals as tise reset signal via tise system bus. 50, botis Z15 and KL can be isandled as an input/output line, wisidh may be used to apply reset to tise peripiseral or to receive reset from tisa peripheral. Tisis signal is used as the reset input of tise cE-1600P.

18

Z14

Out

Higis

In

Tise sub CPU monitors tise state 0f tise BREAK/ON key via tise KH input une and its state is sent tisrough Z14 and supplied to PB7 0f tise 5C7852. Therefore, key chattering and bouncing 0f tise BREAK/ON key are dompietety controlied tise sub CPU.

19

Z1 3

Out

Low

In

Tise sub CPU goes into tise power-down mode except wisen one of tise

t-.tttt..

.

I

p

~-

~ ~

conditions mentioned beIow isolds true. (1) Wisen a command is received from tise main CPU. (2) When a timer interrupt la received,

~ ~ ~

(3) If tise BREAK/ON key sensing KH input is at a higis level. To prevent tisese conditions from occurring, Z13 is set 10w et every time interrupt (1/128 second). If KH is et e higis levai, depression of tise 8REAK/ON key is sensed.

PC-1600 HARDWARE Symbol

In/Out

Active

at~~L

Function

vcc

Z13

z13

KH

1J

U

U

BREAK ~

(t~LET 16:~s(0~=”:t0:GOfO

*1(*

3~:~ErC1iii

S0:EF

0