-

LIBRARIES PUBLIC DOCUMENT MCLIB BIOS

From HI-TECH C for CP/M Fan WIKI(EN)
Jump to: navigation, search

Lower compatible library of MSX-BIOS function library in "MSX-C Library" By Tatsuhiko Syoji(Tatsu) 1999-2000

About This Library

This library is compatible to BIOS library in "MSX-C Library". Source codes are consisted from totally confirmed free codes. Functions other than slot related is implemented because this is very complicated but not used so much.

Files

* .AS  
Source of this libraey.
BIOS .TXT  
This file.
MSXBIOS.H  
Header file of this library.

Assembling

Source files of this library can be compiled by executing MKBLIB.BAT. Library file is generated as "LIBM.LIB".

Function screen() calls internally iniplt() which is a part of MSX-C lower compatible MSX-Graphic library, thus append or link it behind this library.

In addition, copy MSXBIOS.H to directory where header files exist and copy library file to where other library files exist.

Miscellaneous

Corresponding function to rnd() exists in HI-TECH C and it does not planed to be implemented.

Functions

void disscr(void);
Prohibits from displaying.
void enascr(void);
Allows displaying.
void screen(char sc);
Sets screen mode to number "sc"
void gicini(void);
Initializes PSG
void sound(char reg,unsigned char val);
Writes value "val" to PSG register number "reg"
unsigned char rdpsg(char reg);
Reads PSG register number "reg"
int chsns(void);
Returns 0 if key buffer is empty, otherwise returns 1.
void chput(unsigned char ch);
Prints character code number "ch" on text screen.
unsigned char chget(void);
Inputs one chatracter from keyboard and return it.
unsigned char lptout(char ch);
Output character code number "ch". Returns 0 when succeeded and 1 when failed.
unsigned char lptstt(void);
Returns 0 when printer is ready and 1 when printer is not ready.
unsigned char *pinlin(void);
Returns pointer to string which is input on screen editor of MSX-BASIC as one line.
unsigned char *inlin(void);
Returns pointer to string which is input on screen editor of MSX-BASIC. This is same as pinlin except AUTFLG(F6AAH) is set.
char breakx(void);
Returns 1 when CTRL+STOP is pressed otherwise returns 0.
void beep(void);
Rings BEEP sound.
void cls(void);
Clears screen.
void locate(char x,char y);
Moves cursor to (x,y).
void erafnk(void);
Erases display of function keys.
void dspfnk(void);
Displays of function keys.
char gtstck(char port);

Returns status of joystick port number "port" using BIOS.

0 Cursor key
1 Port 1
2 Port 2

Corresponding of returned value and directions are below.

0 Not pressed
1 Up
2 Upper right
3 Right
4 Lower right
5 Down
6 Lower left
7 Left
8 Upper left
char gstex(char port);
Return status of joystick port of :number "port" accessing to I/O port directly.
0 Cursor Keys
1 Port1
2 Port2

Returned velue are as follows are append to values same as gtstck.

9 RUN button of TM-TOWNS joypad
10 SELECT button of TM-TOWNS joypad
This function does not exist in MSX-C libarary.
I suppose this is faster than gtstck because does not need slot control.
char gttrig(char no);
Returns status of joystick port "port".
Returns 0 when button is not pressed otherwise returns -1.
0 Cursor key
1 Trigger A of port1
2 Trigger A of port2
3 Trigger B of port1
4 Trigger B of port2
char gtpad(char no);
Checks status of I/O number "no" calling to GTPAD(00DBH) on BIOS.
unsigned char gtpdl(char no);
Checks status of paddle number "no" and returns degree.
char chgsnd(char stat);
Change status of 1 bit sound port.
Sets "off" when stat is 0 and "on" when stat is 1.
unsigned char snsmat(char row);
Returns status of keyboard matrix of row number "row".
void kilbuf(void);
Clears key buffers.
void ei(void);
Allow interruption.
void di(void);
Prohibit interruption.
/* MSX Turbo R BIOS function */
void chgcpu(char no);
Change CPU mode to "no".
CPU mode is set by lower 2bit and LED status is set by bit7. This function does nothing if executed on lower than MSX2+ models.
Lower 2 bit means as follows.
0 Z80
1 R800 ROM
2 R800 DRAM
This function does not exist in MSX-C Library, because MSX turbo R was not existed when it is released.
char getcpu(void);
Checks current CPU mode. Values mean as follows.
0 Z80
1 R800 ROM
2 R800 DRAM
This function does not exist in MSX-C Library, because MSX turbo R was not existed when it is released.
;Copyright (c) 1999-2000 Tatsuhiko Syoji, Japan . All rights reserved.
;
;Redistribution and use in source and binary forms, with or without 
;modification, are permitted provided that the following conditions are 
;met:
;
;1 Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer as the first lines
; of this file unmodified.
;-
;2 Redistributions in binary form must reproduce the above copyright 
;notice, this list of conditions and the following disclaimer in the 
;documentation and/or other materials provided with the distribution.
;
;THIS SOFTWARE IS PROVIDED BY Tatsuhiko Syoji ``AS IS AND ANY EXPRESS 
;ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL Tatsuhiko Syoji BE LIABLE FOR ANY DIRECT,
; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
;(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
;HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
;STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
;IN
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
;POSSIBILITY OF SUCH DAMAGE.