Input\Output Port Specification3.1 Device Connection Because of the 'soft' nature of the Sirius (that is, the configuration of the I/O ports is loaded from disc at boot time) you must always check that the operating system loaded is appropriate for the printer connected. If this is not the case then you may have to reconfigure the operating system permanently (using the System Configuration package) or temporarily using PORTSET and/or SETIO with MS-DOS or PORTCONF and/or STAT with CP/M-86. (See Section 3.6 for more details). There are 5 ports (3 external, 2 internal) available on the Sirius 1 - they are as follows: 2 x Serial (RS232C) - Ports A and B The ports are located on the rear of the Sirius 1 as shown in the following diagram: _____________________________________________________
/ \
/ \
/ ____ \
/ on/off switch | | \
/ |____| \
/ \
| Keyboard |
| socket LPT TTY UL1 |
| ___ ___ _______ ___ ______ ______ |
| |___| |___| |_______| |___| |______| |______| |
| Reset Video |
\ button /
\_____________________________________________________________/
Figure 1
Sirius 1 Parallel and Serial Ports (as viewed from the rear of the CPU) 3.2 Parallel Port Signals Parallel printer interfacing is done on the parallel port. Parallel port interfacing is accessed through the 36 pin centronics compatible parallel port. Most parallel printer cable interfaces are simply 36-way flat ribbon cables with 36 pin male ribbon connectors at each end. The signals are directly routed from the Sirius 1 to the printer. In parallel data transmission all data bits are transmitted asynchronously in an 8 bit parallel form.In parallel there is no parity checking or baud speeds.
Pin Number Signal
1 ----------------------------- Data Strobe
2 ----------------------------- Data 1
3 ----------------------------- Data 2
4 ----------------------------- Data 3
5 ----------------------------- Data 4
6 ----------------------------- Data 5
7 ----------------------------- Data 6
8 ----------------------------- Data 7
9 ----------------------------- Data 8
.___.
10 ----------------------------- ACK
11 ----------------------------- Busy
17 ----------------------------- Pshield
12,18,30,31 --------------- Not connected
Remaining ----------------- GND
NOTE: For Epson printers pin 14 must not be connected (to eliminate double linefeeds.) 3.3 Parallel Printer Connection To connect a parallel printer to the Sirius 1, a suitable cable is required then it will be a matter of plugging the cable into both machines; cables should be attached as follows:
3.3.1 Parallel Cable Requirements If a suitable parallel cable is not available, you will need to make one - use the guidelines that follow to create your own cable: You will need a male centronics-compatible Amphenol 57-30360 type connector for the Sirius 1 end of the cable; use the type of connector suggested by the printer manufacturer for the printer end, in general, another male centronics - compatible Amphenol 57-30360 type connector will be required. You will also require a length of 12-core cable (3m maximum length). Refer to the port layout in your printer handbook - compare this with the Sirius 1 parallel port layout (see Section 3.2). If the pin numbers and signal requirements are the same, then construct the cable as follows:
1 ----------------------------- 1
2 ----------------------------- 2
3 ----------------------------- 3
4 ----------------------------- 4
5 ----------------------------- 5
6 ----------------------------- 6
7 ----------------------------- 7
8 ----------------------------- 8
9 ----------------------------- 9
10 ----------------------------- 10
11 ----------------------------- 11
16 ----------------------------- 16
It does not matter which end of the cable is connected to the printer or the computer. If your printer has the same signals as the Sirius 1, but on differing pins, then use the following guidelines:
The printer cable is now complete - it must always be attached to the devices as marked on the connectors - if it is not, then the printer will not work. 3.4 Serial Port Signals The two serial ports may be used to connect serial printers to the Sirius 1. In serial transmission data bits are transmitted over a data line one bit at a time. The industry standard for serial peripheral communication is the RS-232C serial binary data interchange. The RS-232C standard is usable for data interchange rates up to 20,000 bits per second.
The RS-232C maximum recommended cable length is approximately 15metres. On the Sirius 1, serial printers may be hooked up to the following serial port pins.
There are basically two classifications of data transceiving equipment, 1. Data Terminal Equipment (DTE) and 2. Data Communications Equipment (DCE). Most printers are set up as DTE's. The interface requirements for the two classifications are very different, so the classification of printer and computer must be determined before a cable interface can be designed. The Sirius 1 is configured as a (DTE).
* Note: Typical Sirius 1 computer to printer interface.
In serial printers the data is transmitted as single bits. The number of bits per second (for this application) is the baud rate. The computer and printer baud rates MUST match in order to maintain proper operation. NOTE: Mismatched baud rates between printer and computer will cause the printer to print improper characters (garbage). The data bitstream can be checked for accuracy by the use of parity bits. The parity bit is added to the transmitted data frame and decoded when received. The computer and printer baud rate must be equal for correct system operation. The printer serial port may not conform to RS-232C pin configurations, thus the pinouts for the PRINTER serial port must be obtained before a serial interface can be developed. 3.5 Serial Printer ConnectionTo connect a serial printer to the Sirius 1, a suitable cable is required - cables should be attached as follows:
You may set the baud rate at a rate different from that mentioned in (2) - but you will then be required to set the baud rate using the baud rate selection utility, PORTSET or PORTCONF (see 3.6), or alternatively you will need to build a new operating system. (See Programmer's Toolkit). Make certain that the operating system is configured for printing to the serial port by using SETIO (MS-DOS) or STAT (CP/M-86) as described in Section 3.6. 3.5.1 Serial Cable Requirements If a suitable serial cable is not available, you will need to make one - use the guidelines that follow to create your own cable: You will require 1 x D25 male, 1 x D25 female connectors, and a length of 6-12 core cable, with a maximum length of about 15m. Refer to the port layout in your printer manual, if pin 3 is received data (labelled RXD or RD), and pin 20 is data terminal ready (labelled DTR), then construct your cable as follows:
Computer Printer
1 ---------------------------- 1
2 ---------------------------- 3
3 -----------------------------2
7 -----------------------------7
5 -----------------------------20
This cable, often called a Modem Eliminator Cable, must be attached as shown - mark the Computer/Printer connectors as a reference.
20 ----------------------------- 5
This allows the cable to be used with either end connected to the computer. If pin 3 is receive data (RXD or RD) and pin 20 is not data terminal ready (DTR) then construct your cable as follows:
Computer Printer
1 --------------------------- 1
3 --------------------------- 2
2 --------------------------- 3
7 --------------------------- 7
5 --------------------------- x
where x is the pin number of the BUSY signal (possibly pin 11 or 19). If this method is used, make sure that the polarity of the BUSY signal is correct; this is usually switch selectable (it should be LOW when printer is BUSY). This cable must be attached as shown - mark the Computer/Printer connectors as a reference. If the printer requires pins 6 and 8 to be held high then add the following connection:
20 ---------------------------- 6
|---------- 8
See Section 3.4 for details of Sirius serial port pinouts and Appendix C for further sample cables. 3.6 Operating System Port Utilities The operating system was supplied with programs under both CP/M-86 and MS-DOS to allow the temporary selection of both baud rate and list device port.If you attach a printer to your system you may be required to perform some of the following steps in order to use the printer. Before you use any of the utilities discussed you need to be aware of the port the printer is attached to; Port A, B or Parallel. You will also need to know, except in the case of a parallel printer, what baud rate, stop-bits and parity your printer is set up at. Note that many printers will start to lose data at baud rates above 4800, you must, therefore, select a baud rate that your printer can handle. Ideally your operating system should be configured permanently using the system generation packages. You must tell the operating system which port you intend using and what baud rate the printer requires (if using a serial port). The CP/M-86 System Configuration package was available separately and the MS-DOS System Generation package is found in the Programmer's Toolkit. If you wish to temporarily change printer port you can use STAT (CP/M-86) or SETIO (MS-DOS) and the baud rate can be changed using PORTSET, PORTCONF or simple Basic programs. 3.6.1 SETIO - MS-DOS List Device Selection Utility SETIO is a utility program to display or change the I/O byte. The I/O byte associates a logical device with a physical device.SETIO has three modes. If invoked without parameters, the assignment table is displayed. If invoked with an invalid device assignment, the command format is displayed with the assignment table. If invoked with a valid device assignment, an updated table is displayed with the new assignment. To select the correct port for the list device you have attached, the SETIO program has been provided. This program is used as follows:
It is recommended that your printer be attached to either port B or the parallel port. Once SETIO has executed, it displays a map of the ports, with the ones you selected highlighted on the screen - if this is not correct, repeat the process. Examples:(highlighted fields are enclosed in square brackets [ ] ). A>setio
A>setio ?<cr> (note: ? is an invalid parameter)
A>setio lst = tty<cr> (valid parameters)
In this last example, we have set the printer port to port A (which usually comes set at 1200 baud). Logical and Physical Devices: Device
Examples:
3.6.2 STAT - CP/M-86 List Device Selection Utility To select the correct port for the list device you have attached, the STAT program has been provided. This program is used as follows: STAT LST:=TTY: - printer is attached to port A SIRIUS 1 Device Name Assignment for CP/M-86 CP/M Physical Device Name
CP/M Logical Device Name
Logical Device Characters
CONSOLE field (bits 0,1) (CON:)
READER field (bits 2,3) (RDR:)
PUNCH field (bits 4,5) (PUN:)
LIST field (bits 6,7) (LST:)
3.6.3 PORTSET - MS-DOS Baud Rate Selection Utility To select the correct baud rate for ports A or B (but this is not applicable to the parallel port), the PORTSET program is provided. This program is menu driven, and is used as follows: To the prompt type PORTSET, the screen will display a choice of three ports:
Type either 1,2 or 3. If you type 1 or 3, the next menu screen is displayed - this screen has baud-rate choices labelled A through N - select one of the baud-rates. 3.6.4 PORTCONF - CP/M-86 Baud Rate Selection UtilityThis program is used in exactly the same manner as PORTSET (see 3.6.3) 3.7 Serial Input/Ouput Port AddressesThe two serial input/output ports are memory mapped ports located in the memory segment E000hex; and they are mapped as follows:
The following information is available in each port's control register:
See Section 3.4 for information on each port's pinouts. Note that writing a 10hex to the relevant control register allows the resensing of the modem leads (i.e. DCD and CTS) with their current values being updated in the port's control register. Since the Sirius 1 configures the NEC 7201 chip to operate in auto-enable mode, DCD (pin 8 on the port connector) must be ON, and CTS (pin 5 on the port connector) must be ON to enable the 7201's receiver and transmitter respectively. RTS and DTR are always ON as a convenient source for an RS-232C control ON (+12 volts). 3.8 Baud Rate and Data Input/Output - Sample ProgramsThe means of establishing the baud rates, receiving and transmitting data are discussed in the following programs. The serial port's control register are discussed in 3.7 - the means of accessing them is better described with the programming examples that follow. The following programs provide information on how to set up the baud rates on the serial ports (A and B) - they also demonstrate how to send and receive data from these ports. 3.8.1 Microsoft MS-BASIC -- Baud Rate and Data Input/OutputThe following program may be used in place of PORTSET or PORTCONF if you omit the lines 500 through 740 inclusive. 10 DIM RATE(14) 20 REM Select the data port 30 PRINT CHR$(27)+"E"; : REM Clear the screen 40 PRINT : PRINT : PRINT : PRINT 50 PRINT "The serial ports are:" : PRINT 60 PRINT ," A - Serial Port TTY - left hand on back"> 70 PRINT ," B - Serial Port UL1 - right hand on back" 80 PRINT : PRINT 90 PRINT ,"Select the port you want to use, A or B "; 100 PORT$ = INPUT$(1) 110 PRINT PORT$ 120 IF PORT$ = "a" THEN STATIO=2 : DATIO=0 : GOTO 210 130 IF PORT$ = "A" THEN STATIO=2 : DATIO=0 : GOTO 210 140 IF PORT$ = "b" THEN STATIO=3 : DATIO=1 : GOTO 210 150 IF PORT$ = "B" THEN STATIO=3 : DATIO=1 : GOTO 210 160 GOTO 30 200 REM Set the baud rate 210 PRINT CHR$(27)+"E"; : REM Clear the screen 220 PRINT : PRINT : PRINT : PRINT 230 PRINT "The available baud rates are as follows:" : PRINT 240 PRINT ," 1 = 300 baud" 250 PRINT ," 2 = 600 baud" 260 PRINT ," 3 = 1200 baud" 270 PRINT ," 4 = 2400 baud" 280 PRINT ," 5 = 4800 baud" 290 PRINT ," 6 = 9600 baud" 300 PRINT ," 7 = 19200 baud" 310 PRINT : PRINT : PRINT 320 PRINT "Select one of the above baud rates: "; 330 RATE$ = INPUT$(1) 340 IF RATE$ > "7" THEN 210 350 IF RATE$ < "1" THEN 210 360 PRINT RATE$ 400 REM Now set the baud rate in the port selected 410 DEF SEG = &HE002 420 IF DATIO = 0 THEN POKE 3,54 : IF DATIO = 1 THEN POKE 3,118 430 FOR I = 1 TO 14 440 READ RATE(I) : REM Set the baud rate matrix 450 NEXT I 460 NODE = (VAL(RATE$)-1)*2+1 470 POKE DATIO,RATE(NODE) 480 POKE DATIO,RATE(NODE+1) 500 REM Now data may be entered and sent down line 510 PRINT CHR$(27)+"E"; : REM Clear the screen 520 PRINT : PRINT ,"Baud rate established" 530 PRINT : PRINT : PRINT 540 DEF SEG = &HE004 550 PRINT ,"Enter data to be sent down line with return to end" 560 PRINT ,"or just press return to receive data -" 570 PRINT 580 TEXT$=INKEY$ 590 IF TEXT$="" THEN 630 600 IF TEXT$=CHR$(13) THEN PRINT TEXT$ :TEXT$=CHR$(126) :GOTO 620 610 PRINT TEXT$; 620 GOSUB 650 630 GOSUB 690 640 GOTO 580 650 STATUS=PEEK (STATIO) : STATUS=STATUS AND 4 660 IF STATUS = 0 THEN 650 :REM Waiting to send char 670 POKE DATIO, ASC(TEXT$) 680 RETURN 690 STATUS = PEEK(STATIO) :STATUS = STATUS AND 1 700 IF STATUS = 0 THEN RETURN : REM No char available 710 DATUM = PEEK (DATIO) : DATUM = DATUM AND 127 720 IF DATUM = 126 THEN PRINT CHR$(13) : RETURN 730 PRINT CHR$(DATUM); :REM Show char from line 740 RETURN 1000 DATA 04,1,&H82,0,&H41,0,&H20,0,&H10,0,8,0,4,0 The above program may be used to send characters between two Sirius'. Use the following cable connection.
CABLE SIRIUS TO SIRIUS
1 -------------------- 1
2 -------------------- 3
3 -------------------- 2
7 -------------------- 7
5 ----- | |----- 5
8 ----- | |----- 8
20 ----- | |----- 20
3.8.2 MACRO-86 Assembler -- Baud Rate and Data Input/Output
The following assembler modules may be included in a program and called with the stated parameters. The character input and output modules will need re-coding if your program requires status return rather than looping for good status.
rates db 04h,1h,82h,0h ;baud rate conversion table
db 41h,0h,20h,0h
db 10h,0h,8h,0h
db 4h,0h
;**********************************************************
;
; Routine: BAUD_SET
;
; Function: To set Port A or B baud rate
;
; Entries: AL = 0=PortA, 1=PortB
; DX = 0=300 baud, 1=600 baud, 2=1200 baud
; 3=2400 baud, 4=4800 baud, 5=9600 baud
; 6=19200 baud
;
; Returns: None
;
; Corruptions: ES, AX, BX, CX, DX
;
;**********************************************************
baud_set:
mov cx,0e002h ;get the segment
mov ES,cx ;init the segment register
mov bx,3 ;point to counter control
or al,al ;see if Port A or B to be set
jnz set_B ;AL > 0, so set Port B counter
;
mov byte ptr ES:[bx],36h ;set it for port A
jmp short set_rate ; and input the Baud rate
;
set_B:
mov byte ptr ES:[bx],76h ;set port B counter
;
set_rate:
mov bx,offset rates ;get the baud rate table
shl dx,1 ;DX = DX * 2 for words
add bx,dx ;point to baud rate entry
mov dx,[bx] ;get the baud rate
xor bh,bh ;BH=0
mov bl,al ;get the required port
mov byte ptr ES:[bx],dl ;send first byte
mov byte ptr ES:[bx],dh ; and last byte of rate
ret ;baud rate established
;**********************************************************
;
; Routine: SEND_CHAR
;
; Function: To output a character to a serial port
;
; Entries: AL = 0=PortA, 1=PortB
; AH = Character to send
;
; Returns: None
;
; Corruptions: ES, AX, BX
;
;**********************************************************
send_char:
mov bx,0e004h ;get the port segment
mov ES,bx ;set the segment
xor bh,bh ;BH=0
mov bl,al ;get the required port
add bl,2 ;required port status
;
in_status_loop:
mov al,ES:[bx] ;get the status
and al,4h ;mask for TX empty
jz in_status_loop ;not ready - loop
;
sub bl,2 ;point to data
mov ES:[bx],ah ;character gone
ret
;**********************************************************
;
; Routine: GET_CHAR
;
; Function: To input a character from a serial port
;
; Entries: AL = 0=PortA, 1=PortB
;
; Returns: AL = character
;
; Corruptions: ES, AX, BX
;
;**********************************************************
get_char:
mov bx,0e004h ;get the port segment
mov ES,bx ;set the segment
xor bh,bh ;BH=0
mov bl,al ;get the required port
add bl,2 ;required port status
;
out_status_loop:
mov al,ES:[bx] ;get the status
and al,1h ;mask for RX character avail
jz out_status_loop ;not ready - loop
;
sub bl,2 ;point to data
mov al,ES:[bx] ;character received
ret
3.9 Transferring Files to and from another computer
ASCII files may be transferred to and from another computer using the serial communications port (DB25 connector nearest the video connector). Using the CP/M or MS-DOS system generation package, configure a system with the serial ports set to the required baud rates, stop and parity bits. (Avoid baud rates above 2400). Make up a cable to connect the serial port to the other computer. Consult the specifications of the other computer carefully. The connection diagram for the MT-180 printer cable has been used successfully to communicate with other computers. Also strapping pins 4, 5 and 8 has been used with success. Using PIP treat the communications port as the logical paper tape reader (RDR:) and punch (PUN:). (to run PIP under MS-DOS, use the CP/M-86 emulator). To transfer a file into Sirius start with the following command to see if Sirius is receiving: PIP CON:=RDR:If not receiving, check your connection cable, try swapping connections to pins 2 and 3. Make sure all signals going to the Sirius are correct. If the above command produces weird characters (when transmitting ASCII) then it is possible that the top bit is set on some bytes (WordStar files do this, Sirius displays a 256 character set), try the following command which zeros the top bit: PIP CON:=RDR:[Z]Otherwise, if you get normal characters bearing little relationship to the original file, check the baud rates. When communication is established, transfer data to a named file: PIP FILENAME=RDR: Remember to send an EOF (^Z) from the other computer so that PIP knows it has finished. Limit the size of the files transferred to under 32K (the size of PIP's buffer) otherwise characters will be lost. If you wish to transfer binary files you will have to encode the binary data into ASCII. The problem with binary is that ^Z may be valid data. Certainly the [O] option can be used for transferring binary files internally but externally there is no way for PIP to know that the transfer is complete. An alternative method of transferring files is to use the VT52 emulation package and use the Sirius as a terminal onto another computer. This package allows the transfer of files to and from the host. 3.10 Sirius 1 IEEE-488 PortThe Sirius 1 IEEE-488 cable attaches to the parallel port - the pin number refers to the actual computer port connector; the IEEE-488 pin number refers to the standard IEEE-488 pin-out as they must attach to the parallel port. The IEEE pin numbers referred to with the (**z) are wires that are to be bound together as twisted pairs. An IEEE 488 operating system must first be created using the IEEE 488 Toolkit and the Programmer's Toolkit. The necessary IEEE 488 system files are copied to the system generation disc found in the Programmer's Toolkit and used to generate the operating system.
Sirius Pin Number IEEE Signal IEEE Pin Number
1 ----------- DAV ------------- 6 (**a)
19 ----------- GND ------------- 18 (**a)
2 ----------- DIO1 ------------- 1
3 ----------- DIO2 ------------- 2
4 ----------- DIO3 ------------- 3
5 ----------- DIO4 ------------- 4
6 ----------- DIO5 ------------- 13
7 ----------- DIO6 ------------- 14
8 ----------- DIO7 ------------- 15
9 ----------- DIO8 ------------- 16
10 ----------- NRFD ------------- 7 (**b)
28 ----------- GND ------------- 19 (**b)
11 ----------- SRQ ------------- 10 (**c)
29 ----------- GND ------------- 22 (**c)
13 ----------- NDAC ------------- 8 (**d)
33 ----------- GND ------------- 20 (**d)
15 ----------- EOI ------------- 5
17 ----------- shield ----------- 12
34 ----------- REN ------------- 17
35 ----------- ATN ------------- 11 (**e)
16 ----------- GND ------------- 23 (**e)
36 ----------- IFC ------------- 9 (**f)
27 ----------- GND ------------- 21 (**f)
20 ----------- GND ------------- 24
3.11 Sirius 1 Control Port (internal port)
Pin Number Signal
1 --------------- -12V
2 --------------- -12V
3 --------------- Not connected
4 --------------- Not connected
5 --------------- +12V
6 --------------- +12V
7 --------------- +5V
8 --------------- +5V
9 --------------- Not connected
10 --------------- Light Pen
11 --------------- GND
12 --------------- CA1
13 --------------- GND
14 --------------- CA2
15 --------------- GND
16 --------------- PA0
17 --------------- GND
18 --------------- PA1
19 --------------- GND
20 --------------- PA2
21 --------------- GND
22 --------------- PA3
23 --------------- GND
24 --------------- PA4
25 --------------- GND
26 --------------- PA5
27 --------------- GND
28 --------------- PA6
29 --------------- GND
30 --------------- PA7
31 --------------- GND
32 --------------- PB0
33 --------------- GND
34 --------------- PB1
35 --------------- GND
36 --------------- PB2
37 --------------- GND
38 --------------- PB3
39 --------------- GND
40 --------------- PB4
41 --------------- GND
42 --------------- PB5
43 --------------- GND
44 --------------- PB6
45 --------------- GND
46 --------------- PB7 / CODEC Clock Output
47 --------------- GND
48 --------------- CB1
49 --------------- GND
50 --------------- CB2
3.12 MS-DOS Logical Devices
As explained in the MS-DOS operating system manual, certain 3 - letter file names are reserved for I/O devices:
Examples of use:
COPY FILENAME AUX This command will transmit the file 'FILENAME' to the device connected to port A (the TTY device). COPY CON LST This command will cause any keyboard input to be sent to the printer rather than the screen. 10 OPEN "O",#1,"AUX" 20 PRINT #1,"XYZ" 30 CLOSE #1 This program will cause the string 'XYZ' to be sent to the device connected to serial port A. Note that the string is only sent after the file is closed or the internal buffer is full. Using this technique, it is possible to toggle output between the printer (LST) and a device, such as another printer or a plotter, connected to port A (AUX). 10 INPUT "Do you have a printer attached (Y/N)",A$ 20 IF A$="Y" OR A$="y" THEN F$="LST" ELSE F$="CON" 30 OPEN "O",#1,F$ 40 PRINT #1,....... This example demonstates the ability to send output to the screen if no printer is present. Useful for debugging. An MS-BASIC demonstration program (only to be run under MS-DOS V1.25 BIOS 2.5 or later) allows the operator to choose the destiny of the output. The output can be to a file, or to a logical device. The logical devices are "CON" (=console), "LST" (=primary list device), or "AUX" (=auxiliary port). In this example the "AUX" logical device is being used as a secondary printer. 10 PRINT CHR$(27)+"E"20 PRINT CHR$(27)+"Y"+CHR$(41)+CHR$(35); 30 PRINT"WHERE IS THE DESTINATION OF THE LISTING TO BE?" 40 PRINT CHR$(27)+"Y"+CHR$(44)+CHR$(45); 50 PRINT"CONSOLE, PRIMARY LIST DEVICE, AUXILIARY PORT" 60 PRINT CHR$(27)+"Y"+CHR$(46)+CHR$(35); 70 PRINT"PLEASE TYPE IN F,C,P,or A" 80 PRINT CHR$(27)+"Y"+CHR$(52)+CHR$(60); 90 INPUT A$ 100 IF A$<>"F" THEN IF A$<>"C" THEN IF A$<>"P" THEN IF A$<>"A" THEN 80 110 IF A$="C" THEN A$="CON" 120 IF A$="P" THEN A$="LST" 130 IF A$="A" THEN A$="AUX" 140 IF A$="F" THEN INPUT "FILE SPECIFIER";A$ 150 CLOSE 160 PRINT CHR$(27)+"E" 170 OPEN "O",#1,A$ 'OPEN A SEQUENTIAL FILE 180 FOR I=1 TO 20 'CREATE TEST DATA 190 B$="TEST DATA 1234567890 abcdefghijklmnopqrstuvwxyz" 200 PRINT #1,B$ 210 NEXT I 220 CLOSE 230 SYSTEM ; ; PROGRAM NAME -- INIT ; ; Program to print a string to the printer. You will need the ; Programmers Toolkit and a suitable editor to proceed. Use the ; editor to generate or alter this program and store it in the ; file INIT.ASM. ; ; Change the string 'AAAAAA' at 'BUFFER' to the string you want. ; (This string can be any length you want) ; ; Use MACRO86 to assemble the program then use LINK to link it ; as follows: ; ; MACRO86 INIT; ; LINK INIT; ; ; LINK will produce an error 'Warning: No STACK segment', ignore it. ; The file INIT.EXE produced by LINK will not run. You must use ; DEBUG to generate INIT.COM as follows: ; ; DEBUG INIT.EXE ; N INIT.COM ; W ; Q ; ; The resulting program INIT.COM will run ; code segment assume cs:code, ds:code boot equ 0 listout equ 5 ; list output function bdos equ 21h ; DOS function call ; cr equ 0dh ; carriage return lf equ 0ah ; line feed ; org 100h start: mov bx,offset buffer ; point to output string again: mov ah,listout ; set parameters for list output mov dl,[bx] ; get next character cmp dl,0 ; test for end jz cont push bx int bdos ; print it pop bx inc bx ; next jmp again cont: mov ah,boot ; reboot int bdos ; buffer db 'AAAAAA' ; place initialisation string here db cr,lf db 0 ; end of print string code ends end Last update: 02/03/2007 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||