NewsProductsSprinterSupportDownloadSprinter ForumAbout usLinksSite map Russian site
Sprinter
 Documentation | Software | F.A.Q. | Spectrum mode |

BIOS v3.00 functions.

The BIOS functions can be call from an assembly code.

    The number of required function you must specify at the register C. And other required parameters must specify at another registers (see BIOS table).
When the BIOS functions will return control to your program, Carry Flag are specify error status (CF=1 - error, CF=0 - no errors).
The Stack pointer must be at 8000h..0BFFFh when the BIOS functions are working. Because some functions use switch of frame 1 and frame 3.

You can use BIOS functions in all configuration:

In Spectrum configuration: use CALL 3D13h. And all TR-DOS functions are available too.

In Sprinter configuration: use RST 18h with system ROM at frame 0 or RST 08h with shadow RAM.(from DSS)

For turn on system ROM use:

        LD A,0
        OUT (07Ch),A

For turn off system ROM use:

        LD A,0
        OUT (03Ch),A

EXE programs (which executing by OS Estex) use BIOS functions through RST 8.

The following is a list of the categories of BIOS functions


Memory functions
0C0h (192) EMM_FN0 Information about memory allocation
input:
  C=0C0h
output:
  HL - total memory in 16k pages
  BC - free memory in 16k pages
0C1h (193) EMM_FN1 Initialization of memory allocation.
  All information about allocated memory blocks is clearing.
  And reserved some system memory.
input:
  C=0C1h
output:
none
0C2h (194) EMM_FN2 Allocate a memory block
input:
  C=0C2h
  B - size of required memory block in 16K pages
output:
  if CF=0 - A - handle of memory block
  if CF=1 - error - A=1 - no memory
0C3h (195) EMM_FN3 Deallocate a memory block
input:
  C=0C3h
  A - handle of memory block
output:
  CF=0 - no error
  CF=1 - incorrect handle
0C4h (196) EMM_FN4 Get physical page number from the memory block by logic number
input:
  C=0C4h
  A - handle of memory block
  B - logic page number
output:
  CF=0 - A - physical page number
  CF=1 - error:
      A=0 - incorrect memory handle
      A=255 - incorrect logic number (too big)
0C5h (197) EMM_FN5 Get list of physical page numbers
input:
  C=0C5h
  A - handle of memory block
  HL - buffer 256 bytes for numbers list
output:
  CF=0 - no errors:
      B - size of memory block in 16K pages
      HL - address of buffer; buffer contains list of physical numbers for all pages; 0FFh - end of list
  CF=1 - incorrect handle of memory block; Data in the buffer may be lost
0C6h (198) EMM_FN6 Detect ports for CPU memory frames
input:
  C=0C6h
  A - number of CPU memory frame - 0,1,2 or 3
output:
  CF=0 - no errors:
      C - 8 bit address of CPU frame port
      B - physical number of memory page which set to CPU frame
  CF=1 - error - incorrect number of CPU frame
0C7h (199) EMM_FN7 Get next physical number of the memory page which assigned for block by the physical page number
input:
  C=0C7h
  A - physical number of memory page
output:
  CF=0 - no errors
      A - number of the next page in the memory block
      A=0FFh - it is the end of block
  CF=1 - error - this memory page is free.
09Eh (158) EMM_FN8 Merge memory blocks
input:
  A - handle of first memory block
  B - handle of second memory block
output:
  CF=0 - no error
      A - new handle of the memory block
  CF=1 - error - incorrect handle of memory block
09Dh (157) EMM_FN9 Split memory block
input:
  C=09Dh
  A - handle of memory block
  B - size of first memory block
output:
  CF=0 - no errors
      A - handle of first memory block
      B - handle of second memory block
  CF=1 - error - incorrect handle of memory block
Hardware related functions
0EFh (239) FN_VERSION Get the BIOS version number and information about model of computer
input:
  C=0EFh
  HL - address of buffer for ASCIIZ string
output:
  CF=0 - no error
      HL - address of this buffer
      DE - BIOS version number
      BC - information about hardware comment
      A - 2 (counter of fields)
          first field - BIOS version number.
          second field - model of computer.
  CF=1 - error - very old version which hasn't this function
0F2h (242) FN_SYNC=0 Set a synchronization
input:
  C=0F2h
  A - mode of the synchronization
output:
  CF=1 - error - incorrect number of the synchronization
0F5h (245) CMOS_TEST Detect of CMOS chip installed
comment
input:
  C=0F5h
output:
  CF=0 - CMOS is installed
  CF=1 - CMOS is not installed
0F6h (246) CMOS_RD Read from register of CMOS
comment
input:
  C=0F6h
  D - register number
output:
  A - data
  CF=1 - CMOS is not present
0F7h (247) CMOS_WR Write to register of CMOS
comment
input:
  C=0F7h
  D - register number
  A - data
output:
  CF=1 - CMOS is not present
08Fh (143) FN_TURBO Turbo mode control.
input:
  C=08Fh
  A - 2 - turbo off
        3 - turbo on
        12h - 720 floppy disk
        13h - 1.44 floppy disk
output:
  CF=1 - error - incorrect mode
Screen functions
0B0h (176) WIN_OPEN Open window
input:
  C=0B0h
  IX - descriptor of window
  E - flags of window:
      0 bit screen page which will show(0/1);
      4 bit screen page where window will open(0/1)
output:
  CF=0 - no error:
      A - handle of window
  CF=1 - error - too many windows
0B1h (177) WIN_CLOSE Close window
input:
  C=0B1h
  A - handle of window
output:
  CF=1 - error - incorrect handle
      Note: window with number '0' can't be closed.
0B2h (178) WIN_COPY_WIN Copy a text window to the memory
  When you use this function you should disable interrupt.
input:
  C=0B2h
  A - handle of global window
  H - height of window, quantity of graphic elements
  L - width of window, quantity of graphic elements
  D - vertical position in the global window
  E - horizontal position in the global window
  IX - address of buffer for copy data of window
  A' - page memory number for copy data of window
output:
  CF=1 - error - incorrect handle
0B3h (179) WIN_RESTORE_WIN Restore a text window
  When you use this function you should disable interrupt.
input:
  C=0B2h
  A - handle of global window
  H - height of window, quantity of graphic elements
  L - width of window, quantity of graphic elements
  D - vertical position in the global window
  E - horizontal position in the global window
  IX - address of buffer with data of window
  A' - page with data of window
output:
  CF=1 - error - incorrect handle
0B4h (180) WIN_GET_SYM Get symbol from the screen
input:
  C=0B4h
  A - handle of the window
  DE - position of symbol at the window:
      D - vertical, E - horizontal
output:
  CF=0 - no errors:
      L - symbol, H - attribute,
      B - font
  CF=1 - incorrect handle of the window
0B5h (181) WIN_PUT_SYM Put symbol to the screen
input:
  C=0B5h
  A - handle of the window
  DE - position of symbol at the window:
      D - vertical, E - horizontal
  L - symbol, H - attribute
  B - font
output:
  CF=1 - incorrect handle of the window
0B6h (182) WIN_SET_ZG Set font
input:
  C=0B6h
  A - number of the font
  DE - address of 2K with font data
output:
  CF=1 - error - unknown function
0B7h (183) WIN_MOVE_WIN Move window
  When you use this function you should disable interrupt.
input:
  C=0B7h
  A - handle of global window
  H - height of local window, quantity of graphic elements
  L - width of local window, quantity of graphic elements
  D - vertical position in the global window
  E - horizontal position in the global window
  IX - new position of local window (like DE)
output:
  CF=1 - error - incorrect handle of window
0B8h (184) WIN_GET_ZG Get font
input:
  C=0B8h
  DE - buffer address for save 2k of font data
output:
  CF=1 - error - unknown function
Text function
081h (129) LP_PRINT_ALL Print symbol with attribute
  Print 'B' repeating symbols
input:
  C=081h
  A - symbol
  E - attribute
  B - count
 You may not save the registers HL and IX at the stack when will use it.
output:
none
082h (131) LP_PRINT_SYM Print symbol without attribute
  Print 'B' repeating symbols, without color attribute
input:
  C=082h
  A - symbol
  B - count
 You may not save the registers HL and IX at the stack when will use it.
output:
none
083h (131) LP_PRINT_ATR Print an attributes
  Print 'B' repeating attributes without symbols
input:
  C=083h
  E - attribute
  B - count
 You may not save the registers HL and IX at the stack when will use it.
output:
none
084h (132) LP_SET_PLACE Set the coordinates for the text cursor's current position
input:
  C=084h
  E - horizontal
  D - vertical
output:
none
085h (133) LP_PRINT_LN Print string from current position
input:
  C=085h
  HL - address of string should be between 04000h and 0BFFFh
  E - attribute
  B - length of string
output:
none
086h (134) LP_PRINT_LN2 Print string without attribute
input:
  C=086h
  HL - address of string should be between 04000h and 0BFFFh
  B - length of string
output:
none
087h (135) LP_PRINT_LN3 Print string till the separator and clear for length
  some spaces will be print after the separator for line of 'B' symbols
input:
  C=087h
  HL - address of string should be between 04000h and 0BFFFh
  E - attribute
  B - length of string
  D - separator of the end string
output:
none
088h (136) LP_PRINT_LN4 Print string without attributes till the separator
input:
  C=088h
  HL - address of string should be between 04000h and 0BFFFh
  B - length of string
  D - separator of the end string
output:
none
089h (137) LP_CLS_WIN Clear the screen
  Printing spaces with attributes
input:
  C=089h
  DE - position of local window
  H - vertical size of local window
  L - horizontal size local window
  B - attribute for filling
output:
none
08Ah (138) LP_SCROLL_UD Scroll a part of window (up/down)
  You can scroll full lines of global window
input:
  C=08Ah
  B: 1 - up; 2 - down
  D - start line for scroll
  E - number lines for scroll
output:
none
08Bh (139) LP_PRINT_LN5 Print string till separator
input:
  HL - address of string should be between 04000h and 0BFFFh
  E - attribute
  B - max length of string
  D - separator of the end string
output:
none
08Ch (140) LP_PRINT_LN6 Print string till separator without attribute
input:
  C=08Ch
  HL - address of string should be between 04000h and 0BFFFh
  B - max length of string
  D - separator of the end string
output:
none
08Dh (141) LP_CLS_WIN2 Fill screen with the symbol and attribute
input:
  C=08Dh
  DE - position of local window
  H - vertical size of windiw
  L - horizontal size of window
  B - attribute for filling
  A - symbol for filling
output:
none
08Eh (142) LP_GET_PLACE Get the current position for printing
input:
  C=08Eh
output:
  CF=0 - no errors
  DE - place for printing next symbol:
      D - vertical, E - horizontal
Graphic functions
0A1h (161) PIC_POINT Set a point
input:
  C=0A1h
  DE - vertical coordinate (in pixels)
  HL - horizontal coordinate (in pixels)
      from the up-left corner
  A - handle of window
  B - colour of point
output:
  CF=1 - error - incorrect handle of window
0A4h (164) PIC_SET_PAL Set the palettes
input:
  C=0A4h
  HL - buffer with palette data
  E - number of first replaced colour
  D - count of colours for replacing
  B - mask (#FF for not masking)
  A - 0..3 bits:
        - 0..7 - number of palette
        - 8..15 - reserved
      - 4..6 bits - reserved (value = 0)
      - 7 bit:
        - 0 - set palette
        - 1 - load palette into the memory

output:
none
0A6h (166) SET_PAL_INIT Set the internal palette
input:
  C=0A6h
  A - page of palette
  B - number of palette:
      B=1 - palette of graphic screens
      B=2 - palette of Spectrum screen
      B=3 - palette of CGA text screen
output:
  CF=1 - wrong number of palette
Disk functions
50h,52h,53h (80,82,83) Reserved
input:
  none
output:
none
51h (81) DRV_RESET Reset disk
input:
  C=51h
  A - number and drive type
7..4 bits - drive type:
  #0x - FDD
  #6x - RAM-DISK
  #8x - HDD
  #Cx - CD drive
áèò 3..0 - drive number
output:
  CF=1 - error - no disk or drive not present
54h (84) DRV_VERIFY Verify sectors
input:
  C=54h
  A - drive number and type
  HL:IX - sector number (32 bit, HL bits 31..16, IX bits 15..0)
  B - sectors count
output:
  CF=1 - verify error
55h (85) DRV_READ Read from drive
input:
  C=55h
  A - drive number and type
  HL:IX - sector number (32 bit, HL bits 31..16, IX bits 15..0)
  B - sectors count
  DE - address for data buffer
output:
  CF=1 - read error
  HL:IX - sector number + number sectors which was reading
  DE - address of data buffer + (number sectors which was reading * sector size)
56h (86) DRV_WRITE Write to the drive
input:
  C=56h
  A - drive number and type
  HL:IX - sector number (32 bit, HL bits 31..16, IX bits 15..0)
  B - sectors count
  DE - address for data buffer
output:
  CF=1 - write error
  HL:IX - sector number + number sectors which was writing
  DE - address of data buffer + (number sectors which was writing * sector size)
57h (87) DRV_DETECT Disk detecting
input:
  C=57h
  A - drive number and type
output:
      A - bit 7 = 0 - 720Êb disk (for FDD only)
              bit 7 = 1 it's 1,44Mb disk (for FDD only)
  CF=1 - no disk
58h (88) DRV_GET_PAR Get drive parameters
input:
  C=58h
  A - drive number and type

output:
      L - sectors per track
      H - heads per drive
      DE - cylinders per drive
          if HL=DE=0FFFFh - drive not present
      IX - size of sector (bytes)
      B - additional parameters of floppy disk:
          bit 7 - type (1.44Mb or 720Kb)
  CF=1 - drive not present
59h (89) DRV_SET_PAR Set the drive parameters
input:
  A - drive number and type
      L - sectors per track
      H - heads per drive
      DE - cylinders per drive
          if HL=DE=0FFFFh - drive not present
      IX - size of sector (bytes)
      B - additional parameters of floppy disk:
          bit 7 - type (1.44Mb or 720Kb)
output:
  CF=0 - no errors
5Ah (90) EXT_VERSION Version of the disk specification
input:
  C=5Ah
output:
  CF=0 - no errors
  D - version number
  E - modifycation
  CF=1 - error
5Fh (95) DRV_LIST Get list of drives
input:
  C=5Fh
  IX - Buffer of drives list
output:
  CF=0 - no errors
Format of drives list:
IX+0 - size of buffer struct
IX+1 - FDD count
IX+2 - HDD count
IX+3 - CD drive count
IX+4 - #00 - the end of list



Comments.

Comment for FN_VERSION function (0EFh).

BC register and Sprinter configuration

  BC=FFFF - not used
  BC=FFFE - Spectrum configuration, Sprinter ZX mode
  BC=FFFD - Sprinter configuration (main configuration)
  BC=FFFC - Reserved
  BC=FFFB - Reserved
  BC=FFFA - Reserved
  BC=FFF9 - Reserved
Comment for CMOS functions (0F5h-0F7h)

CMOS_RD, CMOS_WR and CMOS_TEST functions will work always. If computer has not CMOS chip, CMOS will emulating at the memory.

Comment for text functions.

These functions works with last opened window. Don't use these functions with graphic mode screen.

Descriptor of window:

 IX - 32 bytes descriptor of window
 (IX+0) - horizontal size (graphic element of screen)
 (IX+1) - vertical size (graphic element of screen)
 (IX+2) - horizontal place (graphic element of screen)
 (IX+3) - vertical place (graphic element of screen)
 (IX+4) - mode of graphic element
         4th bit = 1 - text mode; 4th bit = 0 - graphic mode
         5th bit = 0 - 16 pixels for graphic element, 5th bit = 1 - 8 pixels for graphic element
         in graphic mode 6th..7th bits - number of palette
         text mode 6th..7th bits  and 0..3d bits - number of font
                   except: 6th..7th bits= Bh (decimal 11) - border
 (IX+5) - additional font
         0 bit=1 - spectrum screen addresses
 (IX+6) - horizontal place (graphic element of screen)
 (IX+7) - vertical place (graphic element of screen)
 (IX+8..31) - reserved. Must be filled by '0'

Window handle keep the information about opened window. Local window is window in other window. The handle of window defines a global window, from which are addressed local window. Today BIOS support one description for window only. Value of window handle is '0'.

Type of standard windows:
   0 - 32x24 of graphic elements  (Spectrum window)
   1 - 64x24 of graphic elements (text window)
   2 - 40x32 of graphic elements (text window)
   3 - 80x32 of graphic elements (text window)
   4 - Spectrum window, HL - window place on the screen (graphic elements)
   5 - 64x24 text window, HL - window place on the screen (graphic elements)
   6 - 40x32 text window, HL - window place on the screen (graphic elements)
   7 - 80x32 text window, HL - window place on the screen (graphic elements)
   8 - graphic window 0, HL - window place on the screen
   9 - graphic window 1, HL - window place on the screen

Palette data:
        DB blue1,green1,red1,0
        DB blue2,green2,red2,0
        .....................
        DB blueN,greenN,redN,0
Where N - max. number of replaced color. The 0 is equal 256. When palette writing to video RAM, the data has masking that specified at register B.

Palettes 3..0 used for graphic modes. It's number must be specified at bits7..6 of mode of graphic element

Palettes 7..4 used for text or Spectrum mode.