---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---- ---- ---- ÛßßßÜ Ûßßßß Ûßßßß Û Û Ü ÛßßßÜ ÜÛßÛÜ Û Û Ûßßßß ---- ---- ÛÜÜÜß ÛÜÜÜ ÛÜÜÜ ÛÜÜß ÜÜÛÜÜ ÛÜÜÜß Û Û ÛÜÜß ÛÜÜÜ ---- ---- Û Û Û Û ßÜ Û Û Û Û Û ßÜ Û ---- ---- Û ÛÜÜÜÜ ÛÜÜÜÜ Û Û Û ßÛÜÛß Û Û ÛÜÜÜÜ ---- ---- ---- ---- ÜßßßÜ Û Û ÜßßßÜ ÛßßßÜ ßßßÛßßß ---- ---- Û ÛÜÜÜÛ ÛÜÜÜÛ ÛÜÜÜß Û ---- ---- Û Û Û Û Û Û Û Û ---- ---- ßÜÜÜß Û Û Û Û Û ÛÝ Û ---- ---- ---- ---- ÜÜÜÜÜ ÜÜÜÜ ÜÜÜÜÜÜÜ ÜÜÜÜ ÜÜÜ ---- ---- FOR Û Û Û Û Û Û Û Û Û ß ---- ---- Û ÛßßßÜ Û Û ßßßßß Ûßßß Û ---- ---- THE ÜÜÛÜÜ ÛÜÜÜß Û Û Û ßÜÜÜß ---- ---- ---- ---- ---- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- This Document has been created for the Universal use of all IBM-PC and PC compatible systems, and encourages all users to participate in it's spirit by appending this document with any additional material that may be useful to other users. It is requested that donators submit peeks and pokes to be used in IBM BASIC(A) Version 2.00. If the peeks and pokes do not function in ALL current versions of DOS, please state which versions it DOES work in. It is also asked that donors keep the same format as has been initiated with the original submissions. Donators to Peeks and Pokes assume NO responsibility for their submissions....Use on your own judgement. ------------------------------------------------------------------- KEYBOARD BUFFER Jeff Askew 1/16/84 --------------- DEF SEG=0: POKE 1050 , PEEK(1052): DEF SEG This clears the DOS system keyboard buffer. Works very well in compiled Basic. ------------------------------------------------------------------- MONITORS Jeff Askew 1/16/84 -------- ADDRESS = &HB000 '--- &HB800 to test for color monitor DEF SEG = ADDRESS: POKE 1,16 IF PEEK(1) = 16 THEN MONOCHROME = TRUE '--- or COLOR=TRUE This is one simple way to see which monitors are connected. If ADDRESS = &HB800 (for color), then substitute COLOR=TRUE for MONOCHRONE=TRUE. ------------------------------------------------------------------- ACTIVE MONITOR Jeff Askew 1/16/84 -------------- DEF SEG=0: IF (PEEK(1040) AND 48) = 48 THEN MONO.ACTIVE = TRUE ELSE COLOR.ACTIVE = TRUE This determines which monitor is active at the time. ------------------------------------------------------------------- MONITOR WIDTH Jeff Askew 1/16/84 ------------- SCREEN 0,0,0,0: WIDTH 40: CLS OUT 948,2: OUT 949,62 This changes the screen dimensions to 40 column width, but centers the screen in the middle of the monitor. ALL of the commands above must be executed before the OUT's even if that is the current video mode set, otherwise strange things happen. ------------------------------------------------------------------- MORE COLORS Jeff Askew 1/16/84 ----------- OUT &H3D8,9 '--- in 80x25 color mode OUT &H3D8,8 '--- in 40x25 color mode This will disable blinking mode, but enable extended background colors in text mode. The full 16 colors will then be available for the background, not just the usual 8. ------------------------------------------------------------------- MONOTOR PORTS Jeff Askew 2/23/84 ------------- ----- Monochrome ---- OUT 952,1 'Disable Monochrome display OUT 952,15 'Disable Mono Bilnk OUT 952,255 'Normal Mono Pattern --- 80 x 25 Color --- --- 40 x 25 Color --- OUT 984,1 'Disable Display OUT 984,0 'Disable Display OUT 984,9 'Disable Blink OUT 984,8 'Disable Blink OUT 984,41 'Normal Pattern OUT 984,40 'Normal Pattern --- 80 x 25 B&W --- --- 40 x 25 B&W --- OUT 984,5 'Disable Display OUT 984,4 'Disable Display OUT 984,13 'Disable Blink OUT 984,12 'Disable Blink OUT 984,45 'Normal Pattern OUT 984,44 'Normal Pattern These OUT's are neat little tricks, and can be quite useful. For example: Disable the color monitor's display while doing the initial drawings for graphics GET statements. This way, the shapes will not flash up on the screen. Not earthshaking but it adds a touch of class to the program. ------------------------------------------------------------------- SCREEN DIMENSIONS Jeff Askew 1/16/84 ----------------- POKE 91,xx '--- Top row POKE 92,xx '--- Bottom row POKE 41,xx '--- Right column These locations store the boundries for Basic's scrolling. By changing these values from the defaults, you may alter the window that the Basic editor scrolls up. This is a most interesting set with many potential uses. ------------------------------------------------------------------- SYSTEM CONFIGURATION Jeff Askew 1/16/84 -------------------- [ DEF SEG=0 ] LOCATION 1040: DDVV RRXI ( Bit-Mapped. ) DD = Number of Disk drives -1. VV = Current video mode: 1 - 40x25 with color/graphics card. 2 - 80x25 with c/g card. 3 - 80x25 with Monochrome card. RR = Ram installed on the motherboard. 0/16k, 1/32k, 2/48k, 3/64k X = Unused. I = 0 if no disk drives on system, 1 if disk drive(s) are present. LOCATION 1041: PPXG CCCX PP = Number of printer adapters. X = Unused. G = Number of game adapters. CCC = Number of RS232-C adapters. ------------------------------------------------------------------- KEYBOARD STATUS Jeff Askew 1/16/84 --------------- [ DEF SEG=0 ] LOCATION 1047: ICNS AXLR ( Bit-Mapped. ) I = Insert state (1/0). C = Caps-Lock state. N = Num-Lock state. S = Scroll-Lock state. A = Alt-Shift being pressed. X = Ctrl-Shift being pressed. L = Left shift being pressed. R = Right shift being pressed. LOCATION 1048: ICNS XXXX I = Insert being pressed. C = Caps-Lock being pressed. N = Num-Lock being pressed. S = Scroll-Lock being pressed. These are very uesful ways to fully control the keyboard input. All bits are either on(1) or off(0). ------------------------------------------------------------------- KEYBOARD Jeff Askew 2/23/84 -------- OUT 97,204 'disables OUT 97,76 'enables These port patterns can be used to easily disable the keyboard interrupts. When the keyboard is disabled or 'Locked-up', any key struck is totally ignored. It will NOT go into the buffer or be processed. Just be sure that your test program enables it again before ending, or you will have to do a hard-IPL!!! ------------------------------------------------------------------- DISK Jeff Askew 2/23/84 ---- [ DEF SEG = 64 ] T=PEEK(69) 'Current Track Number H=PEEK(70) 'Current Head Number S=PEEK(71) 'Current Sector Number B=(128*2^PEEK(72)) 'Number of Bytes per Sector This set of addresses is very useful for determining what version DOS is being used and the current location of the Read/Write heads. ------------------------------------------------------------------- PROTECTION Jeff Askew 2/23/84 ---------- [ DEF SEG ] POKE 1124,255 'Protects program in memory POKE 1124,0 'Un-Protects program This can enable you to protect or un-protect a BASIC program just like saving it with the ',P' argument to the SAVE command. An important point to be aware of is that when you POKE 1124,255 to protect the program, this also blocks out any subsequent POKE statements, and also will not allow you to alter the program in any way!! ------------------------------------------------------------------- MISC Jeff Askew 2/23/84 ---- [ DEF SEG ] LOCATION (hex) PURPOSE ---------- ---------------- 2E & 2F Line number of the current line being executed. 258 & 259 Offset of start of program variables. 30 & 31 Offset of start of program text. The most important of these three is the last one. Using this location in DOS 2.00, one may successfully and con- sistantly use the SHELL command (what shell command?!?!). Use it as such, with the POKE statements IMMEDIATELY following the SHELL command: DEF SEG : A=PEEK(30) : B=PEEK(31) SHELL CHKDSK '-- Invokes any DOS command POKE 30,A : POKE 31,B ------------------------------------------------------------------- COM: Jeff Askew 2/23/84 ---- ADDR = PEEK(com.num*2-2) + 256*(PEEK(com.num*2-1)) STATUS = PEEK(ADDR+6) The byte returned decodes as follows: SRDC LTAB S = Received line signal detect L = Delta receive line signal detect R = Ring indicator T = Trailing edge ring indicator D = Delta set ready A = Delta data set ready C = Clear to send B = Delta clear to send This byte allows easy access and control of communications activity and is especially useful in custom communications software. ( 'com.num' above is the number of the com port: i.e. Com1: = 1 , Com2: = 2 , etc...) ------------------------------------------------------------------- ------------------------------------------------------------------- ------------------------------------------------------------------- -------------------------------------------------------- ---------------------------------------