        MAIN "",134

HackPgn
        DISP PgnAdr

BHack   CALL SV_UNDO
        CALL CLOSE_ALLW
        JR sopli
SHA     CALL ERASE_ALLW
        CALL ReWin
sopli   LD A,%1111
sha     LD IX,SPH_WIN
        LD (IX+6),A
        LD SP,(SPP)
        CALL Win_
        CP #FF
        JP Z,RES_TSK2
        LD BC,TABjp
        JP TAB_JP

sha_    LD A,%1101
        JR sha

TABjp   DW Open
        DW GO
        DW OnScr
        DW Save
        DW ZDrives

Open    LD HL,SORTall
        CALL FilerE
        JP C,sha_
        LD HL,(START_SEC)
        LD (STCH),HL
        LD B,#40
        EXLOAD #8000,#C000,START_SEC,AddPage
        JP C,errsh
        LD HL,#C000
shaa    LD (ADDE),HL
        JR sha_

errsh   AND A
        SBC HL,HL
        JR shaa

Save    LD HL,0
ADDE    EQU $-2
        LD DE,#C000
        AND A
        SBC HL,DE
        JP C,sha_
        LD IX,MESSAGE
        CALL Window_
        CALL NOKEY_
        CALL ASK
        CALL CLOSE_
        JP C,sha_
        CALL LOADSCR
        CALL AddRam
        LD DE,(ADDE)
        LD IX,IXXM
        CALL SaveWS
        CALL save
        JP SHA

save    LD HL,#8000
        LD DE,#C000
        LD B,#40
        LD IX,(STCH)
        LD (START_SEC),IX
        LD A,4
        LD C,#06
        EX AF,AF'
        LD A,SL_BANK
        JP GUI

ZDrives CALL Driver
        JP sha_

SPH_WIN DEFB 0,2,8,9,2*8+7,7,%00001111
        DEFB 0
        DEFW THack        ; объект-текст
        DEFW SHack        ; объект-подсветка (выборка)
        DEFW #FFFF

THack   DB "Сканер",13
        DB "Открыть_",13
        DB "Сканер",13
        DB "На экран",13
        DB "На диск_",13
        DB "Дисковод",0

SHack   DB 1,3,6,1,%11
        DB 1,4,6,1,%11
        DB 1,5,6,1,%11
        DB 1,6,6,1,%11
        DB 1,7,6,1,%11
        DB #FF

MESSAGE DEFB 7,0,19,9,7*8,2*8+7,%00001111
        DEFB 0
        DEFW TMES         ; объект-текст
        DEFW #FFFF

TMES    DB "          Внимание!",13
        DB "Перед тем, как пользоваться",13
        DB " данной опцией, необходимо",13
        DB " прочитать описание, т.к.",13
        DB " велика возможность потери",13
        DB "      данных на диске..."
        DB #00
;------------------------------------------------------

COIX    DEFB 27,22,4,1,7,7,%00000000,0
        DW ADRTXT
        DW #FFFF
ADRTXT  DB "49152",0

OUT_ADR PUSH IX
        LD HL,(ADDE)
        LD DE,ADRTXT
        LD C,1
        CALL GET_NUM_
        LD IX,COIX
        XOR A
        LD (IX+6),A
        CALL Window_
        LD IX,WCO
        XOR A
        LD (IX+6),A
        CALL Window_
        POP IX
        RET 

GO      CALL AddRam
        CALL CLS
        CALL FUCK
        JP SHA

OnScr   CALL LOADSCR
        CALL AddRam
        LD IX,IXXM
        LD DE,(ADDE)
        CALL LoadWS
        CALL SAVESCR
        JP SHA

FUCK    HALT 
        XOR A
        LD (23560),A

        LD IX,IXXM
Lplay   LD DE,(ADDE)
        CALL LoadWS
        CALL OUT_ADR
lplay   HALT 
lplay_  CALL BREAK
        BIT 1,A
        JP NZ,scf            ;!!!!!!!!!!!!

        CALL IMM

        LD IX,IXXM

        CALL DIRSCN_
        LD A,(DIRECT)
        BIT 4,A
        JP NZ,FFire
        BIT 0,A
        JP NZ,RightH
        BIT 1,A
        JP NZ,LeftH
        BIT 2,A
        JP NZ,DownH
        BIT 3,A
        JP NZ,UpH
        JR lplay

LeftH   HALT 
        LD HL,(ADDE)
        INC HL
        LD (ADDE),HL
        JR Lplay

RightH  HALT 
        LD HL,(ADDE)
        DEC HL
        LD (ADDE),HL
        JR Lplay

UpH     LD A,(StepH)
        LD B,A
        LD C,(IX+2)
        CALL Mult
        EX DE,HL
        LD HL,(ADDE)
        ADD HL,DE
        LD (ADDE),HL
        JP Lplay

DownH   LD A,(StepH)
        LD B,A
        LD C,(IX+2)
        CALL Mult
        EX DE,HL
        LD HL,(ADDE)
        AND A
        SBC HL,DE
        LD (ADDE),HL
        JP Lplay
;***************************************************************
FFire   LD DE,(ADDE)
        CALL LoadWS
        CALL OUT_ADR

ffire   HALT 
        CALL DIRSCN_
        LD A,(DIRECT)

        BIT 4,A
        JP Z,lplay;           ffire
        BIT 0,A
        JP NZ,FRight
        BIT 1,A
        JP NZ,FLeft
        BIT 2,A
        JP NZ,FDown
        BIT 3,A
        JP NZ,FUp
        JP ffire
        JP lplay

FRight  LD A,(IX+2)
        CP 32
        JP Z,ffire
        INC (IX+2)
        JP FFire

FLeft   LD A,(IX+2)
        CP 1
        JP Z,ffire

        LD A,(IX+2)
        DEC A
        LD (ixxM+0),A
        XOR A
        LD (ixxM+1),A
        LD A,1
        LD (ixxM+2),A
        LD A,(IX+3)
        LD (ixxM+3),A
        LD IX,ixxM
        CALL CLSVV

        LD IX,IXXM
        DEC (IX+2)
        JP FFire

FDown   LD A,(IX+3)
        CP 24
        JP Z,ffire
        INC (IX+3)
        JP FFire

FUp     LD A,(IX+3)
        CP 1
        JP Z,ffire

        XOR A
        LD (ixxM+0),A
        LD A,(IX+3)
        DEC A
        LD (ixxM+1),A
        LD A,(IX+2)
        LD (ixxM+2),A
        LD A,1
        LD (ixxM+3),A
        LD IX,ixxM
        CALL CLSVV

        LD IX,IXXM
        DEC (IX+3)
        JP FFire
;...
IXXM    DB 0,0,1,1
ixxM    DB 0,0,0,0

IMM     LD A,(23560)
        EX AF,AF'
        XOR A
        LD (23560),A
        EX AF,AF'
        CP "+"
        JP Z,PLUS
        CP "-"
        JP Z,MINUS
        CP "n"
        JP Z,NEXT
        CP "N"
        JP Z,NEXT
        RET 

MINUS   LD A,8
StepH   EQU $-1
        CP 1
        JR Z,ouwco
        DEC A
        LD (StepH),A
        JR ouwco

PLUS    LD A,(StepH)
        INC A
        LD (StepH),A
ouwco   LD DE,ADRCO
        LD C,0
        CALL GET_NUM_
        LD IX,WCO
        XOR A
        LD (IX+6),A
        JP Window_

WCO     DB 27,21,4,1,7,7,%00000000,0
        DW ADRCO
        DW #FFFF
ADRCO   DB "008",0

NEXT    LD HL,0
STCH    EQU $-2
        LD B,#40
        CALL TRAK
        LD (STCH),HL
        LD (START_SEC),HL
        LD B,#40
        EXLOAD #8000,#C000,START_SEC,AddPage
        LD HL,#C000
        LD (ADDE),HL
        LD IX,IXXM
        LD DE,(ADDE)
        CALL LoadWS
        JP OUT_ADR

LHack   EQU $-BHack
        ENT 

