;LAST UPDATE: 22.11.2014 savelij
;АВТООПРЕДЕЛЕНИЕ КОДИРОВКИ РАБОТАЕТ НЕПРАВИЛЬНО
RELAXED ON
CPU Z80UNDOC
BUILD_DEBUG EQU 0
TMP_FITCHA EQU 0
DZ MACRO DEFZ
DB DEFZ,0
ENDM
DC MACRO DEFC
IF STRLEN(DEFC)>1
DB SUBSTR(DEFC,0,STRLEN(DEFC)-1)
ENDIF
IF STRLEN(DEFC)>0
DB CHARFROMSTR(DEFC,STRLEN(DEFC)-1)|80H
ENDIF
ENDM
SUM_HOB MACRO STR,AA,BB,CC
DB STR
DW AA
DW BB
DB 0
DB CC
$$I := 0
$$S := 0
REPT 9
$$N := CHARFROMSTR (STR,STRLEN(STR)+$$S-9)
$$I := ($$I+$$S+$$N+($$N*256))&0XFFFF
$$S := $$S+1
ENDM
$$I := ($$I+$$S+LOW (AA)+(LOW (AA)*0X100))&0XFFFF
$$S := $$S+1
$$I := ($$I+$$S+HIGH (AA)+(HIGH (AA)*0X100))&0XFFFF
$$S := $$S+1
$$I := ($$I+$$S+LOW (BB)+(LOW (BB)*0X100))&0XFFFF
$$S := $$S+1
$$I := ($$I+$$S+HIGH (BB)+(HIGH (BB)*0X100))&0XFFFF
$$S := $$S+1
$$I := ($$I+$$S+LOW (CC)+(LOW (CC)*0X100))&0XFFFF
$$S := $$S+1
$$I := ($$I+$$S+HIGH (CC)+(HIGH (CC)*0X100))&0XFFFF
$$S := $$S+1
DW $$I
ENDM
DUPL MACRO LEN,FILL
DUPL:
$$N EQU (LEN) / 1024
$$M EQU (LEN) # 1024
REPT $$N
DB 1024 DUP(FILL)
ENDM
IF $$M <> 0
DB $$M DUP(FILL)
ENDIF
ENDM
HIGH FUNCTION X,((X >> 8) & 0XFF)
LOW FUNCTION X,(X & 0XFF)
PCALL MACRO ADR,PAGE
RST 0X30
DW ADR
DB PAGE
ENDM
ATMPORT MACRO PORT,BYTE
LD BC,PORT
LD A,BYTE
OUT (C),A
ENDM
EVOPORT MACRO PORT,BYTE
LD BC,PORT
LD A,BYTE
OUT (C),A
ENDM
PEC_ON MACRO BYTE
IN A,(PEVO_CONF)
OR BYTE
OUT (PEVO_CONF),A
ENDM
PEC_OFF MACRO BYTE
IN A,(PEVO_CONF)
AND BYTE!0XFF
OUT (PEVO_CONF),A
ENDM
SIZEDATE EQU STRLEN (DATE)
IF SIZEDATE=10
MMOUNTH EQU (CHARFROMSTR (DATE,0)-0X30)*10+(CHARFROMSTR (DATE,1)-0X30)
DDATE EQU (CHARFROMSTR (DATE,3)-0X30)*10+(CHARFROMSTR (DATE,4)-0X30)
YYEAR EQU (CHARFROMSTR (DATE,8)-0X30)*10+(CHARFROMSTR (DATE,9)-0X30)
ELSEIF SIZEDATE=8
MMOUNTH EQU (CHARFROMSTR (DATE,0)-0X30)
DDATE EQU (CHARFROMSTR (DATE,2)-0X30)
YYEAR EQU (CHARFROMSTR (DATE,6)-0X30)*10+(CHARFROMSTR (DATE,7)-0X30)
ELSEIF (CHARFROMSTR (DATE,1))=0X2F
MMOUNTH EQU (CHARFROMSTR (DATE,0)-0X30)
DDATE EQU (CHARFROMSTR (DATE,2)-0X30)*10+(CHARFROMSTR (DATE,3)-0X30)
YYEAR EQU (CHARFROMSTR (DATE,7)-0X30)*10+(CHARFROMSTR (DATE,8)-0X30)
ELSE
MMOUNTH EQU (CHARFROMSTR (DATE,0)-0X30)*10+(CHARFROMSTR (DATE,1)-0X30)
DDATE EQU (CHARFROMSTR (DATE,3)-0X30)
YYEAR EQU (CHARFROMSTR (DATE,7)-0X30)*10+(CHARFROMSTR (DATE,8)-0X30)
ENDIF
DATA_VERS EQU DDATE+(MMOUNTH<<5)+(YYEAR<<9)+0X8000 ;УЖЕ УПАКОВАНО
TEXTDATE MACRO
IF DDATE<10
TDATE DB DDATE+0X30
ELSE
TDATE DB ((DDATE/10)+0X30),(DDATE#10)+0X30
ENDIF
DB "."
; IF MMOUNTH<10
;TMOUNTH DB MMOUNTH+0X30
; ELSE
TMOUNTH DB MMOUNTH/10+0X30,MMOUNTH#10+0X30
; ENDIF
DB ".",CHARFROMSTR (DATE,SIZEDATE-4),CHARFROMSTR (DATE,SIZEDATE-3)
DB CHARFROMSTR (DATE,SIZEDATE-2),CHARFROMSTR (DATE,SIZEDATE-1)
ENDM
RST8 MACRO N1,N2,N3
RST 8
DB N1
IFNB N2
DB N2
ENDIF
IFNB N3
DB N3
ENDIF
ENDM