PX-8 Technical Information We have recently been graciously supplied by Epson America with of good deal of technical information on the PX, information that supplements many areas not found in the PX-8 System Essentials Guide. The following discussion of USERBIOS originates from this documentation. If there are other areas of technical information that you would like presented here, please let us know, and we shall do our best to present them. USERBIOS The PX-8 Systen Essentials Manual lists amd explains most of the BIOS calls of the PX. One particular call that is not explained, however is USERBIOS. The folowing discussion illustrates the use of this call. USERBIOS is one of the extended CP/M BIOS calls of the PX-8. It provides an entry point through which an application program can makes BIOS calls after loading its own BIOS routine in the RAM USERBIOS area. It neither requires nor returns any parameter. The following procedure must be observed when using a user- provided BIOS routine through the entry point at USERBIOS. 1) Load the BIOS routine into the RAM USERBIOS area. 2) Replace the contents of addreses (WBOOT + 7EH) + 1 and (WBOOT +7EH) + 2 with the entry address bytes of the user routine in the USERBIOS area. 3) Call this BIOS in an application program. Notes on Programming the USERBIOS Area The user BIOS area mau be shared by more than one program or block of data by placing a 16 byte header at the end of the area. The header is used by thenapplication program to check whether the program or data to be used ia available in the user BIOS area. The header is always located at EBF0H-EBFFH since the bottom address of the user BIOS area is fixed, while the top address differs depending on the size user BIOS. 1) The header ID, 2 bytes in length, and fixed to "UB". 2) The routine name, 8 bytes in length. The name of the routine loaded in the user BIOS area. Any name may be specified in ASCII, as long as it is not used in another routine. 3) The size of the routine loaded into the user BIOS area in 256- byte units stored in binary. This is 1 byte in length. 4) The overwrite flag indicates hwether the currently loaded routine can be overwritten. This is also 1 byte and if set to 00H disables the overwrite feature. 5) The release address area. The processing routine at this address is executed before a routine currently loaded in the user BIOS area is overwritten by a new routine. This release processing routine may be executed only when the overwrite flag for the currently loaded routine is set to 00H. The relaese address must fall within in the user BIOS area. The release processing routine must end with a RET instruction. 6) Not used and fixed to 00H. 7) The checksum, which is laoded with the resilt obtained by subtracting the contents of the 15 bytes (from the header top to the item preceeding checksum) from 00H, sequentially one byte at a time. This result is used for checking the validity of the header data. Overwrite Flag and Release Processing Routine Set the overwrite flag to 00H when loading a routine which must be resident in the user BIOS area (such as scheduler resident routines) once it is loaded. This routine can be deleted from the user BIOS area only by the program that loaded it. For routines that allow loading of new routines after execution of a release processing routine, a nonzero value must be specified to allow a new routine to be loaded into the user BIOS areawhen this area can be restored to the original state after the executon of a release processing routine. Set this flag to a nonzero value for routines which alter the system area at load time, but which can restore the system area into the original state by executing the release processing routine and loading a new one into the user BIOS area. A user BIOS routine which is to modify the contents of the system area ( hook or jump table, for example) must save the original contents of the ssytem area into the user BIOS area before starting execution. The release processing routine is called to restore the system into the state before the user BIOS routine is loaded by placing the saved contents back into the system area and setting all header fields to 00H. The header must be cleared even if the system area need not be restored to the original state. The release processing routine must be placed in the highest 256 bytes (including the header) of the user BIOS area. Using User BIOS with an Application Program The application program must verify that the user BIOS routine is available before accessing the routine. The procedure illustrated below must be followed to check this. *********************** FIGURE TO BE TYPSET *********************** (A) Checks whether the correct header is present by matching the header ID with "UB" and checksum. If the header ID field contains "US", it is unconditionaly concluded that the scheduler is using the user BIOS area because it defines the header as "US". (B) Check to determine whether the required user BIOS routine is loaded into the ser BIOS area by checking the routine name in the header. (C) Call the routine addressed by the release address in the header. (D) Load a new routine to the user BIOS area and update the header contents. Compiling PX-8 BASIC Programs There is no specific compiler designed for the version of BASIC implemented on the PX-8. MicroSoft's BASCOM will work to a certain degree with PX-8 BASIC, however. It is available in 3 1/2 disk format for use on the PF-10 from SofTeam (800-438-7638). David Western has taken the time to outline the specific areas of incompatiility between BASCOM and the version of BASIC on the PX, with certain suggestions on how to overcome some of these descrepencies. Here are his comments. Here is a list of many important commands that I have found to be incompatable in some way and a corresponding solution wherever possible. by David Western ----------------------------------------------------------------- All commands commonly entered on the command line such as LIST, AUTO, LOAD, and SAVE can not be used. Other files can be chained, however, using the PX-8 compatable CHAIN command. ALARM$ None of the alarm functions work in BASCOM. I have found no way other than a machine language routine to fix this problem. BEEP The only thing you can do to make much noise in BASCOM is to use PRINT CHR$(7) to activate the bell. CLS Use PRINT CHR$(12) instead of CLS. FRE(0) This will return 0 according to the BASCOM manual. INSTR The INSTR function is not supported. Here is a short routine to do the same thing. A$ contains the string you are searching and E$ contains the string you are finding in A$. Z returns the position where found or 0 if not found. 1000 FOR I=1 TO LEN(A$) 1010 IF MID$(E$,I,LEN(E$))=MID$(A$,I,LEN(E$)) THEN X=I:RETURN 1020 NEXT I 1030 X=0:RETURN LINE LINE is not supported. Here is an ESC sequence that will do the same thing once in SCREEN 3. Use the way listed here to get into that screen mode. PRINT CHR$(27);CHR$(198);CHR$(X1);CHR$(X2);CHR$(Y1); CHR$(Y2);CHR$(X3);CHR$(X4);CHR$(Y3);CHR$(Y4); CHR$(Z1);CHR$(Z2);CHR$(Z3); X1 = 1st byte of 1st X coordinate X2 = 2nd byte of 1st X coordinate Y1 = 1st byte of 1st Y coordinate Y2 = 2nd byte of 1st Y coordinate X3 = 1st byte of 2nd X coordinate X4 = 2nd byte of 2nd X coordinate Y3 = 1st byte of 2nd Y coordinate Y4 = 2nd byte of 2nd Y coordinate Z1 = 1st byte of mask pattern Z2 = 2nd byte of mask pattern Z3 = 1 for OFF, 2 for ON, 3 for COMPLIMENT .pa LINE (400,18)-(18,18) is PRINT CHR$(27);CHR$(198);CHR$(1);CHR$(144); CHR$(0);CHR$(18);CHR$(0);CHR$(18);CHR$(0);CHR$(18); CHR$(&HFF);CHR$(&FF);CHR$(2); LOCATE Here is an ESC sequence to use as LOCATE does not work with BASCOM. PRINT CHR$(27);"=";CHR$(Y+31);CHR$(X+31); X and Y stand for the X and Y position. OPEN Only files that access the disk drives can be used. All other specs are considered part of the filename. IN and OUT must be used along with a call to the open routine to directly use the PX-8 RS232 port. LPRINT works fine, though. OPTION Option Country is not supported in BASCOM. In order to use COUNTRY this feature you must use the procedure described on pages C-3 and C-4 of the PX-8 BASIC manual. OPTION Option Currency does not work and I can find no control CURRENCY sequence to remedy this. PCOPY PCOPY is not used as there are not seperate BASIC areas in the BASIC compiler at this time. POINT The POINT command, which returns the status of a dot on the screen, is not implemented. It would be possible to peek the graphics memory to get this but I don't know where that is or how it is formatted. I wish it DID work because then I could compile my OKIDATA screen dump routine which takes forever in BASIC. POWER All of the POWER commands (POWER OFF, CONT, or RESUME) do not work. I know of no remedy for this either. PRESET PRESET can be done by using control sequences. The same basic sequence is used by both PSET and PRESET. A full description is on page C-8 and C-9 of the PX-8 BASIC manual under the section for ESC CHR$(199). SCREEN The SCREEN command along with all of its options are supported by control codes. All of them are on page C-9 of the BASIC manual under the section describing ESC CHR$(208). All Features are supported using these. SOUND I know of no way to use SOUND in BASCOM. I imagine there are routines you can call but EPSON doesn't seem to think anyone would be interested. STAT STAT is not handled in any way, but there is no real need for it. STOP KEY I can find no alternative for the STOP KEY command, but I am pretty sure there is one. If anyone knows of an MBASIC command or routine to do this please notify someone about it. TAPCNT TAPCNT can not be used though I am sure there is some location that can be peeked for the value. I'm not an expert on the special memory locations for the PX-8 as there is no information for it that I can get a hold of. TIME$ No time routines are present. This was because all TIME routines are different and Microsoft wanted to make sure BASCOM worked on most CP/M machines. There is a machine language routine for it floating around somewhere... TITLE TITLE is not used as multiple program areas are not used. WIND No command to control the micro-cassette's motor could be found though it is likely that one exists. That is the end of the list. I hope that it has proved helpful to PX-8 Geneva users. If anyone has anything to add to the list then login to the SOCIS Epson Connection BBS and leave mail to David Western or Bob Hermann. Otherwise call The Board Room at (803) 548-1243 and leave mail to the SYSOP or upload the file.