💾 Archived View for spam.works › mirrors › textfiles › programming › peekpoke.txt captured on 2023-07-22 at 20:45:24.

View Raw

More Information

⬅️ Previous capture (2023-06-16)

-=-=-=-=-=-=-

NOTE: DEF SEG = 0 LOW MEMORY PORT ADDRESSES
===============================================================================
PORT # | FUNCTION, DESCRIPTION OR COMMENTS FOR USE
=======|=======================================================================
     66| SETS TIMER CHIP TO PRODUCE A FREQUENCY 20 TO 20,000 HZ:
       | "A=INT(1193182/F):H=INT(A/256):L=A-H*256:OUT 66,L:OUT 66,H.
     67| "OUT 67,182" PREPARES TIMER CHIP TO RECEIVE A VALUE.
     97| "OUT 97,INP(97) OR 3" TO TURN THE SPEAKER ON.
       | "OUT 97,INP(97) OR 8" TO TURN THE CASSETTE MOTOR OFF.
       | "OUT 97,INP(97) AND 247" TO TURN THE CASSETTE MOTOR ON.
       | "OUT 97,INP(97) AND 252" TO TURN THE SPEAKER OFF.
       | "POKE (97),PEEK(97) OR 128" DISABLES PC/XT KEYBOARDS.
       | "POKE (97),PEEK(97) AND 127" ENABLES PC/XT KEYBOARDS.
     98| "PEEK (98)" PROVIDES CURRENT PRINTER WIDTH.
       | "POKE 98,w" SETS CURRENT PRINTER WIDTH TO w.
108-111| "POKE 108,83:POKE 109,255:POKE 110,0:POKE 111,240"DISABLE CTRL-BRK.
       | "POKE 108,240:POKE 109,32:POKE 110,3:POKE 111,12" ENABLES CTRL-BRK.
116-117| VIDEO PARAMETER TABLE.
       | BE CAREFUL - CHANGES HERE COULD PHYSICALLY DAMAGE A MONITOR.
120-123| CONTAINS DISK PARAMETER TABLE. (NOTE: Times are in milli-seconds)
       | MUST USE DEF SEG=PEEK(122) + 256 * PEEK (123)
       |          LET D = PEEK (120) + 256 * PEEK (121)
       | "(PEEK (D) AND 240)\8" TRACK TO TRACK MOVE TIME.
       | "(PEEK (D) AND 15) * 32" HEAD UNLOAD TIME AFTER READ/WRITE OCCURRED.
       | "(PEEK (D+1) AND 240)\4" HEAD LOAD TIME.
       | "PEEK (D+1) AND 15" D.M.A. OPERATING MODE.
       | "PEEK (D+2)" WAIT TIME TO TURN OFF MOTOR.
       | "PEEK (D+3)" NUMBER OF BYTES PER SECTOR.
       | "PEEK (D+4)" NUMBER OF SECTORS PER TRACK.
       | "PEEK (D+5)" GAP LENGTH IN BYTES BETWEEN SECTORS.
       | "PEEK (D+6)" DATA LENGTH READ/WRITE WHEN SECTOR LENGTH NOT SPECIFIED.
       | "PEEK (D+7)" GAP LENGTH USED WHEN FORMATTING.
       | "PEEK (D+8)" VALUE FORMAT USES TO INITIALIZE SECTORS. USUALLY 256.
       | "PEEK (D+9)" HEAD STABILIZATION TIME.
       | "PEEK (D+10)" 8ths OF A SECOND ALLOWED FOR HEAD TO STABILIZE.
126-248| CONTAINS EXTENDED CHARACTER SET 128 THRU 254 IN GRAPHICS MODE.
       | "n = PEEK (124)+256*PEEK (125)" WILL BE CHR$(128).
       | "n = PEEK (126)+256*PEEK (127)" WILL BE CHR$(129).
    503| RELATED TO KEYBOARD INPUT.
    985| "POKE (985),x" CHANGES GRAPHICS COLOR WHERE x IS COLOR.
   1010| "OUT 1010,12" WILL TURN OFF ALL DRIVES.
   1022| PROVIDES INFORMATION RELATED TO RS232 COMMUNICATIONS PORTS:
       | "PEEK(1022 + 2 * n) + 256 * PEEK(1023 + 2 * n)" WHERE COMn:
       | n = 0 IF COMn: IS NOT AVAILABLE.
   1040| "(PEEK (1040) AND 1)*(1+PEEK (1040)\64) PROVIDES NUMBER OF DRIVES.
       | "PEEK (1040) AND 48"
       |                 0 = NO MONITOR INSTALLED.
       |                16 = 40 x 25 GRAPHICS.
       |                32 = 80 x 25 GRAPHICS.
       |                48 = MONOCHROME.
       | "POKE (1040), PEEK(1040) OR 48" SELECTS MONOCHROME DISPLAY.
       | "POKE (1040), (PEEK(1040) AND 207) OR 32" SELECTS 80 x 25 GRAPHICS.
NOTE:  | SCREEN 0,0,0:WIDTH 80 SHOULD BE USED BEFORE CALLING MONOCHROME.
NOTE:  | SCREEN 1,0,0,0:WIDTH 80 SHOULD BE USED BEFORE CALLING 80 x 25 GRAPHICS
NOTE:  | SAVE VALUES IN PORTS 1097 THRU 1126 IN AN ARRAY FOR RESTORING IN THE
       | EVENT THAT YOU WANT TO CHANGE BACK TO ORIGINAL DISPLAY WITH CONFIDENCE
   1041| "(PEEK (1041) AND 14)/2" WILL PROVIDE NUMBER OF RS232 PORTS INSTALLED.
       | "(PEEK (1041) AND 16)/16" WILL PROVIDE NUMBER OF GAME PORTS INSTALLED.
       | "(PEEK (1041) AND 192)/64" WILL PROVIDE NUMBER OF PRINTERS INSTALLED.
1043-44| "PEEK (1043)+256*PEEK(1044)" PROVIDES RAM INSTALLED IN KILOBYTES.
   1047| "PEEK (1047) AND 4" WILL =  4 IF CTRL KEY HAS BEEN PRESSED.
       | "PEEK (1047) AND 8" WILL =  8 IF ALT KEY HAS BEEN PRESSED.
       | "PEEK (1047) AND 16" WILL = 16 IF SCROLL LOCK IS ON / 0 IF OFF.
       | "PEEK (1047) AND 32" WILL = 32 IF NUMBER PAD IS ON / 0 IF OFF.
       | "PEEK (1047) AND 64" WILL = 64 IF CAPS LOCK IS ON / 0 IF OFF.
       | "PEEK (1047) AND 128" WILL = 128 IF INSERT MODE IS ON / 0 IF OFF.
       | "POKE (1047),PEEK (1047) OR 16" ENABLES SCROLL LOCK.
       | "POKE (1047),PEEK (1047) OR 32" ENABLES NUMBER LOCK.
       | "POKE (1047),PEEK (1047) OR 64" ENABLES CAPS LOCK.
       | "POKE (1047),PEEK (1047) OR 128" ENABLES INSERT MODE.
       | "POKE (1047),PEEK (1047) AND 239" TURNS OFF SCROLL LOCK.
       | "POKE (1047),PEEK (1047) AND 223" TURNS OFF NUMBER LOCK.
       | "POKE (1047),PEEK (1047) AND 191" TURNS OFF CAPS LOCK.
       | "POKE (1047),PEEK (1047) AND 127" TURNS OFF INSERT MODE.
       | "POKE (1047),PEEK (1047) XOR 16" CHANGES SCROLL LOCK MODE.
       | "POKE (1047),PEEK (1047) XOR 32" CHANGES NUMBER LOCK MODE.
       | "POKE (1047),PEEK (1047) XOR 64" CHANGES CAPS LOCK MODE.
       | "POKE (1047),PEEK (1047) XOR 128" CHANGES INSERT MODE.
   1050| KEYBOARD INPUT BUFFER STORED AT "PEEK(1050)+1024" TO "PEEK(1052)+1053"
       | EACH CHARACTER HAS 2 BYTES RESERVED TO COVER EXTENDED CHARACTERS.
   1087| "PEEK (1087) AND 15" WILL = 0 WHEN NO DRIVE MOTORS ARE RUNNING.
       | "PEEK (1087) AND 128" WILL = 128 WHEN DRIVE WRITE IN PROGRESS.
       | "PEEK (1087) AND 2 ^ (ASC("a")" WILL = 1 IF DRIVE A IS RUNNING.
   1088| USED TO ACTIVATE A DRIVE FOR UP TO 14 SECONDS.
       | "POKE 1088, 18.2 * b : OUT 1010 , 2 ^ (ASC("a") - 61) + ASC("a") - 53
       | WHERE a=NUMBER OF SECONDS <15  AND b= DRIVE LETTER IN UPPERCASE.
   1093| "PEEK (1093)" WILL DETERMINE LAST DISK TRACK ACCESSED.
   1094| "PEEK (1094)" WILL DETERMINE LAST DISK HEAD ACCESSED.
   1095| "PEEK (1095)" WILL DETERMINE LAST DISK SECTOR ACCESSED.
   1096| "128 * 2 ^ PEEK (1096)" WILL DETERMINE NUMBER OF BYTES PER SECTOR.
   1097| "PEEK (1097)" WILL PROVIDE DISPLAY MODE INFORMATION:
       |                 0 = TEXT MODE, WIDTH 40, NO COLOR.
       |                 1 = TEXT MODE, WIDTH 40, COLOR.
       |                 2 = TEXT MODE, WIDTH 80, NO COLOR.
       |                 3 = TEXT MODE, WIDTH 80, COLOR.
       |                 4 = MEDIUM GRAPHICS MODE, COLOR.
       |                 5 = MEDIUM GRAPHICS MODE, NO COLOR.
       |                 6 = HIGH RESOLUTION GRAPHICS.
       |                 7 = TEXT MODE, WIDTH 80, MONOCHROME.
1097-98| "POKE (1097),4:POKE (1098),40" PROVIDES SCREEN 2 WITH WIDTH 40.
       | "POKE (1097),6:POKE (1098),80" PROVIDES SCREEN 2 WITH WIDTH 80.
1100-03| CONTAINS CONTENTS OF GRAPHICS MEMORY RESIDING ON THE DISPLAY CARD.
       | "SIZE=PEEK(1100)+256*PEEK(1101)"  "LOCATION=PEEK(1102)+256*PEEK(1103)"
1104-05| CONTAINS CURSON LOCATIONS FOR VARIOUS GRAPHICS MEMORY PAGES.
       | "COL=PEEK(1104+2*n)" OR "ROW=PEEK(1105+2*n)" WHERE n IS THE PAGE.
   1120| "J=PEEK (1120) AND 31" REFLECTS VALUE OF LOCATE ,,,I,J.
   1121| "I=PEEK (1121) AND 31" REFLECTS VALUE OF LOCATE ,,,I,J.
       | "PEEK (1121) AND 32" = 32 IF CURSOR ON / 0 IF OFF.
       | "POKE (1121),PEEK (1121) OR 32 TURNS OFF CURSOR.
   1122| "PEEK (1122) OBTAINS NUMBER OF ACTIVE SCREEN PAGES.
   1125| "PEEK (1125) AND 1" WILL = 1 IF ACTIVE CRT IS TEXT MODE WIDTH 80.
       | "PEEK (1125) AND 2" WILL = 2 IF ACTIVE CRT IS IN GRAPHICS MODE.
       | "PEEK (1125) AND 4" WILL = 4 IF ACTIVE CRT HAS COLOR DISABLED.
       | "PEEK (1125) AND 8" WILL = 8 IF ACTIVE CRT HAS NOT BEEN BLANKED.
       | "PEEK (1125) AND 16" WILL = 16 IF ACTIVE CRT IS IN HIGH RES. GRAPHICS.
       | "PEEK (1125) AND 32" WILL = 32 IF ACTIVE CRT BLINKING IS ENABLED.
   1126| CONTAINS THE BACKGROUND COLOR AND PALETTE VALUES WHEN DISPLAY IS IN
       | IN MEDIUM RESOLUTION.
       | WHERE COLOR b,p:
       | "b = PEEK (1126) AND 15"    AND     "p = (PEEK(1126) AND 32)/32"
       | WHILE IN TEXT MODE, IT CONTAINS THE FOREGROUND AND BACKGROUND.
       | WHERE COLOR f,b:
       | "f = PEEK (1126) AND 16"    AND     "b = PEEK(1126) MOD 16"
1132-34| "PEEK (1132) + 256 * PEEK (1133) + 65536 + PEEK (1134)" WILL PROVIDE
       | THE NUMBER OF CLOCK TICKS SINCE MIDNIGHT 1 TO 1,533,039 (18.2 PER SEC)
   1136| DETERMINES THE DATE n DAYS FROM NOW. IF LESS THAN 255 "POKE 1136,n"
       | IF n GREATER THAN 255 THEN:
       | "A$=DATE$"
       | "FOR I=1 TO n:POKE 1136,1:NEXT I:PRINT DATE$"
       | "DATE$=A$"                                     WILL DO THE JOB.
   1141| "PEEK (1141)" PROVIDES THE NUMBER OF HARD DISKS INSTALLED.
   1284| "CHR$(65 + PEEK(1284)) REFLECTS WHICH DRIVE A/B IS ACTIVE ON A SINGLE
       | DISK DRIVE SYSTEM.
   1295| "POKE 1295,2:SYSTEM" WILL LEAVE THE BASIC(A) FLAG SET TO INDICATE A
       | SHELL TO DOS HAS OCCURRED AND PREVENT ACCESS TO BASIC(A) AGAIN.
===============================================================================
DEF SEG=0                  KEYBOARD INFORMATION

CapsLock Key: "PEEK (1047) AND 64"=0 if in lowercase mode,64 if in uppercase.
To specify lowercase:  POKE 1047, PEEK(1047) AND 191.
To specify uppercase:  POKE 1047, PEEK(1047) OR 64.
To toggle between upper and lowercase:  POKE 1074, PEEK(1047) XOR 64.
"PEEK(1048) AND 64" has a value of 64 if the key is pressed, 0 otherwise.

NumLock Key: "PEEK(1047) AND 32"=0 in cursor-control mode,32 in numeric-keypad.
To specify the cursor-control state:  POKE 1047,PEEK(1047) AND 223.
To specify the numeric-keypad state:  POKE 1047,PEEK(1047) OR 32.
To toggle between states:  POKE 1047,PEEK(1047) XOR 32.
"PEEK(1048) AND 32" has a value of 32 if the key is pressed, 0 otherwise.

Ins Key: "PEEK(1047) AND 128"=128 in the insert state, 0 otherwise.
To specify the insert mode: POKE 1047,PEEK(1047) OR 128.
To specify noninsert mode:  POKE 1047, PEEK(1047) AND 127.
To toggle the state:  POKE 1047,PEEK(1047) XOR 128.
"PEEK(1048) AND 128" has a value of 128 if the key is pressed, 0 otherwise.

ScrollLock Key: "PEEK(1047) AND 16"=16 when ScrollLock is on,0 when off.
To specify the ScrollLock state:  POKE 1047,PEEK(1047) OR 16.
To specify the alternate state:  POKE 1047,PEEK(1047) AND 239.
To toggle states: POKE 1047,PEEK(1047) XOR 16.
The statement "PEEK(1048) AND 16" =16 if key pressed, 0 otherwise.

 "PEEK(1047) AND 8" = 8 if ALT key pressed.
 "PEEK(1047) AND 4" = 4 if CTRL key pressed.
 "PEEK(1047) AND 1" = 1 if right SHIFT key pressed.
 "PEEK(1047) AND 3" = 0 if no shift key pressed.
 "PEEK(1048) AND 4" = 4 if Sys Req key is pressed, 0 othewrwise (PC AT only).

 "PEEK(1049)" has a value of an ALT=ASCII KEY pressed until ALT is released.
 Keyboard buffer begins at PEEK(1050)+1024 and ends at PEEK(1052)+1023.
 Ordinary characters use every other location.  Extended characters use two locations, the first location containing the null character (CHR$(0)).
"POKE 1050, PEEK(1052)" clears the keyboard buffer.
Buffer contents can be read by PEEK without being removed from the buffer.
To disable Ctrl-Break, enter:  FOR I=0 TO 3:POKE(108+I), PEEK(112+I):NEXT I.  Before disabling Ctrl-Break,use PEEK to record the bytes in locations 108-111.
"PEEK(1137) AND 128" = 128 if Ctrl-Break used since start of a program.
To disable the keyboard (PC & XT only), send "OUT 97, INP(97) OR 128".
To enable the keyboard (PC & XT only), send "OUT 97, INP(97) AND 127".
To disable all keyboard interrupts:  OUT 33,130.
To enable keyboard interrupts:  OUT 33,128.

For the PC AT only, the green lights that indicate CapsLock, NumLock and the
ScrollLock status can be turned on and off without altering any of the states.
The statement:  OUT 96,237:OUT 96,n produces the following results:
n = 7   all indicators on
n = 6   ScrollLock indicator off, others on
n = 5   NumLock indicator off, others on
n = 4   CapsLock indicator on, others off
n = 3   CapsLock indicator off, others on
n = 2   NumLock indicator on, others off
n = 1   ScrollLock indicator on, others off
n = 0   all indicators off
------------------------------------------------------------------------------
DEF SEG  0                  MONITOR INFORMATION

To check the type of display:
PEEK(1040) AND 48 = 0 is no monitors
PEEK(1040) AND 48 = 16 is a 40 x 25 graphics monitor
PEEK(1040) AND 48 = 32 is a 80 x 25 graphics monitor
PEEK(1040) AND 48 = 48 is a monochrome display

To select a display:
Monochrome   POKE 1040,PEEK(1040) OR 48
             SCREEN 0:WIDTH 80:LOCATE ,,1,0,0
Graphics     POKE 1040,(PEEK(1040) AND 207) OR 16
             SCREEN 1,0,0,0:WIDTH 80:LOCATE ,,1,0,0.

To check screen mode:
PEEK(1097) = 0 text mode, WIDTH 40, color disabled
PEEK(1097) = 1 text mode, WIDTH 40, color enabled
PEEK(1097) = 2 text mode, WIDTH 80, color disabled
PEEK(1097) = 3 text mode, WIDTH 80, color enabled
PEEK(1097) = 4 medium resolution graphics, color enabled
PEEK(1097) = 5 medium resolution graphics, color disabled
PEEK(1097) = 6 high-resolution graphics
PEEK(1097) = 7 monochrome display
PEEK(1098)+256*PEEK(1099) gives the width in columns.

Graphics screen contents stored in a buffer at  PEEK(1102)+256*PEEK(1103).
memory that physically resides on a graphics board.
Buffer size given by PEEK(1100)+256*PEEK(1101).

 The cursor locations for the various pages are given as follows:
 Let CR(n) and CC(n) be the Cursor Row and Cursor Column for page n.
 PEEK(1105)+2*n)  has a value of CR(n)-1,
 PEEK(1104+2*n)  has a value of CC(n)-1.

 The shape of the cursor can be set as follows:  LOCATE ,,,I,J.
 "PEEK(1121) AND 31" has value I
 "PEEK(1120) AND 31" has value J.
 "PEEK(1121) AND 32" = 32 then cursor is not displayed.
 "PEEK(1122)" will equal the active visual page.

  To determine the active 6845 index register:
  "PEEK(1123)+256*PEEK(1124)" = 948 if monochrome display board in use.
                              = 980 for the color/graphics adapter.
 To check the 6845 mode settings:
PEEK(1125) AND 1    has value 1 if in text mode, width 80
PEEK(1125) AND 2    has value 2 if in graphics mode
PEEK(1125) AND 4    has value 4 if color is disabled.
PEEK(1125) AND 8    has value 8 if video is enabled.
PEEK(1125) AND 16   has value 16 if in high-resolution graphics mode
PEEK(1125) AND 32   has value 32 if blinking is enabled

 Background color and palette selected by COLOR b,p.:
"PEEK(1126) AND 15"= b
"(PEEK(1126) AND 32)/32" = p.
"PEEK(1126) MOD 16" = border color.
------------------------------------------------------------------------------
                                  PRINTER

"(PEEK (1041) AND 192)/64" = the number of printer adaptors installed.
"PEEK(1030 +2*n)+256*PEEK(1031+2*n)" = the 1st port for LPTn
To swap two printers, interchange their initial port numbers.
Denote the first port associated with LPTn by Pn.  The value
of P1 will by 956 if LPT1 is attached to the IBM monochrome display
and parallel printer adapter.
------------------------------------------------------------------------------
                               DISK DRIVES

"(PEEK(1040) AND 1)*(1+PEEK(1040)\64) = number of disk drives installed.
The number of hard disks on a PC-XT can be found with: PEEK(1141).

In determining the status of a drive motor:
"PEEK(1087) AND 128" = 128 when a drive is being written to.
"PEEK(1087) AND 15" = 0 when no drive being written to.
If drive L is running, then "PEEK(1087) AND 2 ^ (ASC ("L")-65)" will be 1.
Drive L here is A, B, C or D, and the letter must be typed in uppercase.
These value are not affected if an OUT was used to turn on the motor.
To turn on drive L for n seconds, where n is at most 14:
POKE 1088,18.2*n:OUT 1010,2^(ASC("L")-61)+ASC("L")-53.
Location 1088 holds the countdown, in clock ticks, until the motor is shut off.
To turn off all drives, send:  OUT 1010,12
To determine the diskette track that was last accessed, use PEEK(1093).
To determine which diskette head (0 or 1) was last accessed, use PEEK(1094).
To determine which diskette sector was last accessed, use PEEK(1095).
The number of bytes per sector on a diskette is given by 128*2^PEEK(1096).

The diskette parameter table consists of 11 bytes.  To explore this:
 LET D = PEEK(120)+256*PEEK(121).
 Then, after executing: DEF SEG = PEEK(122)+256*PEEK(123)
 you can derive the following table:
(PEEK(D) AND 240)\8     is the time (in milliseconds) required for the
                          diskette drive to move from track to track
(PEEK(D) AND 15)*32     is the head unload time (in milliseconds) after
                          a read or write operation has occurred
(PEEK(D+1) AND 240)\4   is the head load time (in milliseconds)
PEEK(D+1) AND 15        is the Direct Memory Access mode
PEEK(D+2)               is the wait time until turning the motor off
PEEK(D+3)               is the number of bytes per sector on the disk;
                          a value of v specifies 128*2^v bytes per
                          sector, for v=0 to 3
PEEK(D+4)               is the number of sectors per track, usually
                          8 or 9
PEEK(D+5)               is the gap length (in bytes) between sectors
PEEK(D+6)               is the data length that you read out or write
                          into a sector when the sector length is not
                          specified
PEEK(D+7)               is the gap length used when formatting
PEEK(D+8)               is the value the format operation uses to
                          initialize diskette sectors, usually 256
PEEK(D+9)               is the number of milliseconds allowed for the
                          heads to stabilize
PEEK(D+10)              is the number of eighths of a second to allow
                          for motor startup

Changing the values of PEEK(D+3) and PEEK(D+4) can modify the way that
diskettes are read and might require you to format your diskettes
manually.

If a single diskette drive is used for both drives A: and B:, its current roles
is:  CHR$(65 + PEEK(1284))
------------------------------------------------------------------------------
                        RS-232 INTERFACE

The number of RS-232 cards attached can be found with: (PEEK(1041) AND 14)/2
To determine the first of the seven ports associated with COMn:
PEEK(1022+2*n)+256*PEEK(1023+2*n).
If this number is 0, then COMn is not available.
To swap two RS-232 interfaces, interchange their initial port numbers.
Denote the initial port associated with COMn by Pn.
Normally, the value of P1 is 1016 and the value of P2 is 760.

Interrupt enabling:
OUT Pn+1,1   enables an interrupt when a character has been received
OUT Pn+1,2   enables an interrupt when a character has been transmitted
OUT Pn+1,4   enables an interrupt when an error has occurred
OUT Pn+1,8   enables an interrupt when the modem status has changed

To enable several of the above interrupts at the same time, OUT the
sum of the associated numbers to port Pn+1.

To identify interrupts, use the port number determined above (Pn) and:
  LET X = INP(Pn+2).  "X AND 1" has a value of 1 as long as no
interrupts have been issued because of communications port activity.
Similarly, "X AND 6" is used to identify the highest priority interrupt
pending, as indicated in the table "Interrupt Control Functions" in the
IBM Technical Reference manual.

To establish the number of data bits (d), the number of stop bits (s),
and the parity (p=0 for no parity, p=1 for odd parity, p=3 for even parity),
send:  OUT Pn+3, d-5 + 4*(s-1) + 8 * p.

To establish the baud rate:  H=INP(Pn+3):OUT Pn+3,H OR 128:
 OUT Pn,DL:OUT Pn+1,DH:OUT Pn+3,H.  Use values DL=128 and DH=1 for 300
baud, and DL=96 and DH=0 for baud rate 1200.  Otherwise, DL=d MOD 256
and DH=d\256, where d is the divisor number given by the IBM Technical
Reference manual in the table "Baud Rate at 1.853 MHz."

 To produce a break signal:
X=INP(Pn+3):OUT Pn+3,X OR 64:PLAY "MF":SOUND 32767,6:SOUND 32767,1:OUT Pn+3,X.
The PLAY and SOUND statements produce a delay of 1/3 second.

 To control the modem, use:
OUT Pn+4,1     to assert that the data terminal is ready (DTR)
OUT Pn+4,2     to raise a request to send (RTS)
OUT Pn+4,16    to perform loopback testing

To accomplish several of the above tasks simultaneously, OUT the sum of the
associated numbers to port Pn+4.

To determine the status of data transfer, begin with:
LET X = INP(Pn+5).  Now:

X AND 64    has a value of 64 if the transmitter shift register is idle
X AND 32    is 32 if the transmitter holding register is ready to
              accept a character for transmission
X AND 16    has the value 16 if the received data input is held in the
              spacing state too long (that is, if a break was received)
X AND 8     has the value 8 if the received character did not have a
              valid stop bit; that is, if a framing error occurred
X AND 4     has the value 4 if the received character does not have
              the correct parity
X AND 2     is 2 if the received data destroyed the previous character
              (an overrun error)
X AND 1     has value 1 if a character is ready to be read from the
              received buffer register

 INP(Pn) will read the ASCII value of a character from the serial port,
provided:  (INP(Pn+5) AND 1) = 1

 You can use OUT Pn,m to write the character with ASCII value m to the serial
port, provided that:  (INP(Pn+5) AND 32) = 32

 To determine the status of the modem, use:  X = INP(Pn+6). Then:
X AND 128    has the value 128 if a Carrier signal has been detected
X AND 64     is 64 if the modem is ringing
X AND 32     has a value of 32 if the modem has asserted Data Set Ready
X AND 16     is 16 if the modem has asserted Clear to Send
X AND 8      is 8 if the Carrier Detect has changed state
X AND 4      has the value 4 if the Ring Indicator input has changed
               from On to Off
X AND 2      is 2 if the Data Set Ready input has changed state since
               the last time it was read
X AND 1      has a value of 1 if the Clear to Send input has changed
               state since it was last read
------------------------------------------------------------------------------
                             SPEAKER
     To turn the speaker on, use:  OUT 97,INP(97) OR 3
     Conversely, to turn the speaker off:  OUT 97,INP(97) AND 252
------------------------------------------------------------------------------
                      CASETTE PORT CONTROL
     To turn the cassette motor on:  OUT 97,INP(97) AND 247
     To turn the cassette motor off:  OUT 97,INP(97) OR 8
------------------------------------------------------------------------------
                          MISCELLANEOUS
(PEEK (1041) AND 16)/16 = number of game adaptors attached.
PEEK(1043) + 256*PEEK(1044) = size of RAM in KB.
PEEK(1132)+256*PEEK(1133)+65536PEEK(1134)= number of ticks since midnight.
With 18.2 ticks per second up to 1,533,039.
Memory locations 1264 to 1279 are not used by either DOS or BASIC.
Data can be passed from one program to another by POKEing and PEEKING.
To exit BASIC and complicate reinvoking it, you can:  POKE 1295,2:SYSTEM.
Memory location 1295 is set to 2 when the BASIC command SHELL is executed.
The segment number of BASIC's data segment may be found with:
PEEK(1296)+256*PEEK(1297)

===============================================================================
NOTE: DEF SEG BASIC(A) MEMORY PORT ADDRESSES
------------------------------------------------------------------------------
PORT # | FUNCTION, DESCRIPTION OR COMMENTS FOR USE
-------|----------------------------------------------------------------------
  11-13| USED BY BASIC(A) FOR RANDOM NUMBER GENERATION.
     40| CONTAINS LAST ERROR NUMBER IN BASIC(A).
     41| BASIC(A) SCROLLING LIMITER - SEE# 91 FOR MORE DETAILS.
  44-45| CONTAINS BASIC(A) ENVIRONMENT EQUATIONS.
  46-47| "PEEK (46)+256*PEEK(47)" RETURNS CURRENT BASIC(A) LINE NUMBER.
     72| "PEEK(72)" RETURNS CURRENT SCREEN MODE:
       |                 0 = TEXT MODE, WIDTH 40, COLOR BURST DISABLED.
       |                 1 = TEXT MODE, WIDTH 40, COLOR BURST ENABLED.
       |                 2 = TEXT MODE, WIDTH 80, COLOR BURST DISABLED.
       |                 3 = TEXT MODE, WIDTH 80, COLOR BURST ENABLED.
       |                 4 = MEDIUM RESOLUTION GRAPHICS, COLOR BURST ENABLED.
       |                 5 = MEDIUM RESOLUTION GRAPHICS, COLOR BURST DISABLED.
       |                 6 = HIGH RESOLUTION GRAPHICS, COLOR BURST DISABLED.
       |                 7 = MONOCHROME DISPLAY.
     75| "PEEK(75)" DETERMINES TEXT MODE FOREGROUND COLOR.
     76| "PEEK(76)" DETERMINES TEXT MODE BACKGROUND COLOR.
     77| "PEEK(77)" DETERMINES TEXT MODE BORDER COLOR.
     78| "PEEK(78) AND 3" DETERMINES MEDIUM RESOLUTION TEXT COLOR.
       | "POKE 78,c" SETS MEDIUM RES. TO COLOR c=(1/2/3) OF PALETTE.
     81| "POKE (81) AND 15" PROVIDES MEDIUM RES. BACKGROUND COLOR.
     82| "POKE (82) MOD 2" PROVIDES MEDIUM PALETTE.
     86| "POKE (86)" PROVIDES CURSOR ROW NUMBER.
     87| "POKE (87)" PROVIDES CURSOR COLUMN NUMBER.
  91-92| USED TO CREATE SCROLLING LIMITERS.
       | "POKE 41,c:POKE 91,a:POKE 92,b"
       | WHERE:    a=STARTING LINE     b=ENDING LINE     c=NUMBER OF POSITIONS.
       | "POKE 92,0" WILL PREVENT ALL SCROLLING.
       | "POKE 92,25" WILL SCROLL ALL 25 LINES.
    100| "PEEK (100)" RETURNS 1 IF CASSETTE MOTOR OFF / 0 IF OFF.
    113| "PEEK (113)" DETERMINES IF SOFTKEYS DISPLAYED.
       |                          0 = IF SOFTKEYS NOT DISPLAYED.
       |                          1 = ALWAYS DISPAYED.
       |                        255 = INVOKED BY "KEY ON"
835-836| "PEEK (835)+256*PEEK(836)" POINTS TO LAST STATEMENT EXECUTED.
837-838| "PEEK (837)+256*PEEK(838)" MEMORY LOCATION POINTED TO BY THE
       | BASIC(A) STACK POINTER.
839-840| "PEEK (839)+256*PEEK(840)" LINE NUMBER OF LAST BASIC(A) ERROR.
       | BASIC(A) STACK POINTER.
845-846| "PEEK (845)+256*PEEK (846)" LINE NUMBER POINTED TO BY BASIC(A)
       | ON ERROR GOTO STATEMENT.
848-849| "PEEK (848)+256*PEEK (849)" RETURNS BASIC(A) DATA SEGMENT.
862-863| "PEEK (848)+256*PEEK (849)" POINTS TO NEXT BYTE OF LAST
       | BASIC(A) DATA MOST RECENLTY READ. (READ DATA LOOP)
   1116| "PEEK (1116)" RETURNS MINIMUM ALLOWABLE VALUE FOR ARRAY
       | SUBSCRIPTS (OPTION BASE)
   1124| "PEEK (1124) = 0 IF FILE IN MEMORY NOT PROTECTED.
   1125| "POKE 1125,255" PROTECTS BASIC(A) FILE IN MEMORY.
       | "PEEK (1125) AND 1" WILL = 1 IF ACTIVE CRT IS TEXT MODE WIDTH 80.
       | "PEEK (1125) AND 2" WILL = 2 IF ACTIVE CRT IS IN GRAPHICS MODE.
       | "PEEK (1125) AND 4" WILL = 4 IF ACTIVE CRT HAS COLOR DISABLED.
       | "PEEK (1125) AND 8" WILL = 8 IF ACTIVE CRT HAS NOT BEEN BLANKED.
       | "PEEK (1125) AND 16" WILL = 16 IF ACTIVE CRT IS IN HIGH RES. GRAPHICS.
       | "PEEK (1125) AND 32" WILL = 32 IF ACTIVE CRT BLINKING IS ENABLED.
   1247| "PEEK (1247)" REFLECTS NUMBER OF FILES SPECIFIED BY BASIC(A)/F
       | COMMAND LINE PARAMETER.
1248-49| "PEEK (1248)+256*PEEK(1249)" POINTS TO FILE CONTROL BLOCKS.
   1264| "CHR$(64+PEEK(1264)) POINTS TO DRIVE LAST ACCESSED BY BASIC(A)
   1265| "A$="":FOR I=1 TO 10:A$=CHR$(PEEK(1265+I)):NEXT I"
       | POINTS TO FILE MOST RECENTLY ACCESSED BY BASIC(A).
   1295| "POKE 1295,2:SYSTEM" WILL LEAVE THE BASIC(A) FLAG SET TO INDICATE A
       | SHELL TO DOS HAS OCCURRED AND PREVENT ACCESS TO BASIC(A) AGAIN.
1296-97| BASIC(A) DATA SEGMENT NUMBER MAY BE FOUND. "PEEK(1296)+256*PEEK(1297)"
1339-40| "PEEK (1339)+256*PEEK (1340)"POINTS TO Y COORDINATE LAST USED.
1341-42| "PEEK (1341)+256*PEEK (1342)"POINTS TO X COORDINATE LAST USED.
1619 TO| STRINGS OF 15 CHARACTERS SEPARATED BY A NULL CHARACTER ARE STORED
1772   | HERE TO DEFINE THE VALUE OF THE SOFTKEYS. (FUNCTION KEYS 1 THRU 10).
   1782| "PEEK (1782) AND 3" PROVIDES THE CURRENT COLOR FOR DRAW STAT.
       | "POKE 1782,85*c" WILL CHANGE DRAW COLOR TO c.
1794-95| "PEEK (1794)+256*PEEK (1795)" PROVIDES PROGRAM SEGMENT PREFIX.
===============================================================================
 
 
 
  Another file downloaded from:   
                            ??????????????????
                   ?????????? Cheez Whiz BBS ??????????
                            ??????????????????
                              (408) 363-9766

             "Where the conversation flows like liquid cheese"

       A file/message base BBS like you've never seen before! With the
       emphasis on knowledge, free exchange of ideas, thoughtful insights,
       obscure/esoteric information, and libelous speculation regarding
       Madonna. It's all here, and it's all free for the taking. No 900
       numbers, no salesman will visit your home. One of the last few free
       things left in America.

                                  Zardoz -  Sysoping for your pleasure

                      A list of other NIRVANAnet systems
        ?????????????????????????????????????????????????????????????????
        ? Just Say Yes  415/922-2008    Freedom of Speech               ?
        ? Rat Head      415/524-3649    Bad Crazyness and Wild Stuff    ?
        ? &TOTSE        415/935-5845    Screaming Electrons             ?
        ?????????????????????????????????????????????????????????????????