Login

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

;System-dependent code for ZXZVM: header file

;Entry points for the I/O module:

;General principles:
;Routines marked * will return Carry set if they succeeded
;otherwise Carry clear, with HL = address of fatal error string.

;Filenames are terminated by 0FFh (+3DOS API).
;Fatal error strings are terminated by a character with bit7 set
;(48BASIC API) and should be short (max. 24 characters).
;Strings passed to ZXFDOS are terminated by '$' (CP/M API)

ZXINIT  EQU #4000
;*Initialise the I/O subsystem.
; DE = #705C, address of gamefile name.
; Any data at #705C have to be set by the
; BASIC loader before ZXZVM is started.
; The PCW16 version ignores DE and asks for the
; game name itself, since PCW16s don't have
; command line parameters or BASIC loaders.

ZXEXIT  EQU #4003
;IF carry set
;Deinit I/O subsystem and return.
;Otherwise terminate program & do not return,
;HL = address of fatal error string.

ZXCLS   EQU #4006
;*Clear screen

ZXPEEK  EQU #4009
;*Read Z-machine address EHL; return result in A.

ZXPOKE  EQU #400C
;Store A in machine address HL (max 64k writable memory)

ZXPK64  EQU #400F
;Read Z-machine address HL in the low 64k; return in A.

ZXPKWD  EQU #4012
;Read Z-machine word into BC from EHL.

ZXPKWI  EQU #4015
;As ZXPKWD, but auto-increments EHL.

ZXFDOS  EQU #4018
;*Vaguely CP/M-like functions:
; C=1: Wait for character and return it in A. Echo
; the character to screen.
; C=2: Output character in E
; C=6: IF E=#FF: Poll keyboard, return character
; in A if there is one, else 0.
; IF E=#FE: Poll keyboard, return 1 if a
; character is waiting, else 0.
; IF E=#FD: Wait for character and return it
; in A. Don't echo it to screen
; IF E<#FD: Output character in E
; C=9: Output characters at DE until a "$" is
; encountered.

ZXIHDR  EQU #401B
;*Allow the I/O subsystem to set and clear bytes in
;the header. The I/O subsystem gets first crack at
;the header, followed by the main code. Either
;module can veto the header.

ZXTMEM  EQU #401E
;Get top of memory in HL.

ZXERAW  EQU #4021
;*Erase_window opcode, parameter in A.

ZXZCHR  EQU #4024
;Output a ZSCII character in HL, to stream A.
;<< v0.04 IF A=2 (printer) then carry reset on return
; indicates that the printer is offline.
;>> v0.04

ZXSWND  EQU #4027
;*Split_window opcode, parameter in A.

ZXUWND  EQU #402A
;*Set_window opcode, parameter in A.

ZXSTYL  EQU #402D
;*Set_text_style opcode, parameter in A.

ZXSCUR  EQU #4030
;*Set_cursor opcode, B=row, C=column

ZXINP   EQU #4033
;Line input. HL = byte address of buffer in Z-memory
;DE=timeout, tenths of a second.
;Returns B=10 for success, 0 for timeout

ZXRCHR  EQU #4036
;Read a character. DE=timeout, tenths of second, or 0
;Returns A=character or 0 for timeout

ZXSCOL  EQU #4039
;SET colour. B=foreground C=background, IBM colours

ZXSFNT  EQU #403C
;SET font. A=font, returns A=old font or 0.

ZXRNDI  EQU #403F
;Get a random integer (eg the computer's clock) in DE.

ZXGETX  EQU #4042
;Get cursor X position in L, characters remaining in H,
;total screen width in A

ZXGETY  EQU #4045
;Get cursor Y position in L

ZXSTRM  EQU #4048
;*Called when a stream is opened or closed. A =
;stream number (+ or -)

ZXERAL  EQU #404B
;Erase current line to EOL

ZXSND   EQU #404E
;Sound effect; HL,DE,BC hold the parameters
;number, effect and volume respectively.

ZXRST   EQU #4051
;Restart game

ZXNAME  EQU #4054
;Get filename. Enter with A=0 to get "load" filename,
;1 to get "save" filename. Returns HL = filename ID to
;pass to create/open routine. ZXZVM will not try to
;parse this, so it could be a pointer to ASCIIZ,
;pointer to FCB etc. Carry set if OK, reset for user
;cancel.

ZXOPEN  EQU #4057
;Open filename in HL. B=mode: 0=read 1=create.
;Returns Carry set if OK, clear if error.
;For simplicity, only one file may be open at
;any one time.

ZXCLSE  EQU #405A
;Close current open file.

ZXREAD  EQU #405D
;Read BC bytes to HL.

ZXWRIT  EQU #4060
;Write BC bytes at HL.

ZXRMEM  EQU #4063
;Read BC bytes of Z-machine memory, starting at HL.

ZXWMEM  EQU #4066
;Write BC bytes of Z-machine memory, starting at HL.
;(note: IN these last four, BC=0 is valid and
; means zero bytes, not 64k)

ZXVRFY  EQU #4069
;Checksum the game file. Entered with DBC = game file
;length; return HL = checksum.
;
;0.02+
;

ZXBFIT  EQU #406C
;Check if the text in the buffer at HL will fit on
;the current line. B = no. of letters; C = no. of
;non-letters. Returns:
; A=0 : Everything will fit
; A=1 : Letters will fit, separators won't
; A=2 : Nothing will fit

ZXRCPU  EQU #406F
;Called every 2000 z-cycles (approx) - allow a
;multitasking OS's message pump to run.

ZXILIV  EQU #4072
;Some sort of simple debug breakpoint. This should
;interfere with the screen as little as possible; the
;Spectrum implementation changes the border colour and
;waits for a keypress, and other versions should do
;something similar.
;
;<< v1.01 >> The VM passes EHL = Z-machine program
; counter.

ZXVER   EQU #4075
;Get module compatibility number into A. Used to
;check for version mismatches. Current number is 4:

VMVER   EQU 4

;
;0.03+
;

ZXUSCR  EQU #4078
;Flush any screen output buffers in the I/O module.
;No entry or exit conditions.