Login

Subversion Repositories NedoOS

Rev

Rev 1514 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

я╗┐        DEVICE ZXSPECTRUM128
        include "../../_sdk/sys_h.asm"

scrbase=0x4000
sprmaxwid=32
sprmaxhgt=32
scrwid=160 ;double pixels
scrhgt=200

STACK=0x3ff0
tempsp=0x3f06 ;6 bytes for prspr
INTSTACK=0x3f00

        org PROGSTART
begin
        jp GO ;patched by prspr
GO
        ld sp,STACK
        OS_HIDEFROMPARENT
        ld e,0 ;EGA
        OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode) +8=noturbo, +0x80=keep gfx pages
        ld de,emptypal
        OS_SETPAL ;╨▓╨║╨╗╤О╤З╨░╨╡╨╝ ╤З╤С╤А╨╜╤Г╤О ╨┐╨░╨╗╨╕╤В╤А╤Г, ╤З╤В╨╛╨▒╤Л ╨▒╤Л╨╗╨╛ ╨╜╨╡╨╖╨░╨╝╨╡╤В╨╜╨╛ ╨┐╨╡╤А╨╡╨▒╤А╨╛╤Б╨║╤Г ╤Н╨║╤А╨░╨╜╨░
        ld e,0
        OS_CLS ;╨╛╤З╨╕╤Б╤В╨╕╨╗╨╕ ╤В╨╡╨║╤Г╤Й╨╕╨╣ ╤Н╨║╤А╨░╨╜

        OS_GETMAINPAGES
;dehl=pages in 0000,4000,8000,c000
        ld a,e
        ld (pgmain4000),a
        ld a,h
        ld (pgmain8000),a
        ld a,l
        ld (pgmainc000),a

        OS_NEWPAGE ;╨╖╨░╨║╨░╨╖╨░╨╗╨╕ ╨╜╨╛╨▓╤Г╤О ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г, ╤З╤В╨╛╨▒╤Л ╨│╤А╤Г╨╖╨╕╤В╤М ╤В╤Г╨┤╨░ ╨┤╨░╨╜╨╜╤Л╨╡
        ld a,e
        ld (pgvorobey),a ;╨╖╨░╨┐╨╛╨╝╨╜╨╕╨╗╨╕ ╨╡╤С ╨╜╨╛╨╝╨╡╤А
        OS_NEWPAGE ;╨╖╨░╨║╨░╨╖╨░╨╗╨╕ ╨╜╨╛╨▓╤Г╤О ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г, ╤З╤В╨╛╨▒╤Л ╨│╤А╤Г╨╖╨╕╤В╤М ╤В╤Г╨┤╨░ ╨┤╨░╨╜╨╜╤Л╨╡
        ld a,e
        ld (pgscrdata0),a ;╨╖╨░╨┐╨╛╨╝╨╜╨╕╨╗╨╕ ╨╡╤С ╨╜╨╛╨╝╨╡╤А
        OS_NEWPAGE ;╨╖╨░╨║╨░╨╖╨░╨╗╨╕ ╨┤╤А╤Г╨│╤Г╤О ╨╜╨╛╨▓╤Г╤О ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г, ╤З╤В╨╛╨▒╤Л ╨│╤А╤Г╨╖╨╕╤В╤М ╤В╤Г╨┤╨░ ╨┤╨░╨╜╨╜╤Л╨╡
        ld a,e
        ld (pgscrdata1),a ;╨╖╨░╨┐╨╛╨╝╨╜╨╕╨╗╨╕ ╨╡╤С ╨╜╨╛╨╝╨╡╤А

        ld de,path
        OS_CHDIR
       
pgvorobey=$+1
        ld a,0
        ld de,filenamevorobey
        ld hl,0xc000 ;╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝
        call loadfile_in_ahl ;╨╖╨░╨│╤А╤Г╨╖╨╕╨╗╨╕ ╨╛╨┤╨╕╨╜ ╤Н╨║╤А╨░╨╜╨╜╤Л╨╣ ╤Д╨░╨╣╨╗ ╨▓ ╨╛╨┤╨╜╤Г ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г
       
        ld a,(pgscrdata0)
        ld de,filename0 ;╨╕╨╝╤П ╤Д╨░╨╣╨╗╨░
        ld hl,0xc000 ;╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝
        call loadfile_in_ahl ;╨╖╨░╨│╤А╤Г╨╖╨╕╨╗╨╕ ╨╛╨┤╨╕╨╜ ╤Н╨║╤А╨░╨╜╨╜╤Л╨╣ ╤Д╨░╨╣╨╗ ╨▓ ╨╛╨┤╨╜╤Г ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г
        ld a,(pgscrdata1)
        ld de,filename1 ;╨╕╨╝╤П ╤Д╨░╨╣╨╗╨░
        ld hl,0xc000 ;╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝
        call loadfile_in_ahl ;╨╖╨░╨│╤А╤Г╨╖╨╕╨╗╨╕ ╨┤╤А╤Г╨│╨╛╨╣ ╤Н╨║╤А╨░╨╜╨╜╤Л╨╣ ╤Д╨░╨╣╨╗ ╨▓ ╨┤╤А╤Г╨│╤Г╤О ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г

;╤Б╨╡╨╣╤З╨░╤Б ╤Г ╨╜╨░╤Б ╨▓╨║╨╗╤О╤З╨╡╨╜╤Л ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Л ╨┐╤А╨╛╨│╤А╨░╨╝╨╝╤Л, ╨║╨░╨║ ╨▒╤Л╨╗╨╛

        call swapimer

;╤З╤В╨╛-╤В╨╛ ╨┤╨╡╨╗╨░╨╡╨╝...
;╨╜╨╡ ╨▓╨░╨╢╨╜╨╛ ╤З╤В╨╛...
;...

;╤В╨╡╨┐╨╡╤А╤М ╨╜╨░╨┤╨╛ ╨▓╤Л╨▓╨╡╤Б╤В╨╕ ╨╖╨░╨│╤А╤Г╨╢╨╡╨╜╨╜╤Л╨╡ ╨┤╨░╨╜╨╜╤Л╨╡ ╨╜╨░ ╤Н╨║╤А╨░╨╜
        ld a,(pgscrdata0)
        SETPGC000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г ╤Б ╨┤╨░╨╜╨╜╤Л╨╝╨╕ ╨▓ c000
        ld a,(user_scr0_low) ;ok
        SETPG4000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╨┐╨╛╨╗-╤Н╨║╤А╨░╨╜╨░ ╨▓ 4000
        ld hl,0xc000
        ld de,0x4000
        ld bc,0x4000
        ldir ;╨┐╨╡╤А╨╡╨▒╤А╨╛╤Б╨╕╨╗╨╕ ╨╜╨░ ╤Н╨║╤А╨░╨╜

        ld hl,0x4000+8000 ;╤В╨░╨╝ ╨▓ ╨║╨░╤А╤В╨╕╨╜╨║╨╡ ╨┐╨░╨╗╨╕╤В╤А╨░ (╨┐╨╛ ╨▒╨░╨╣╤В╤Г ╨╜╨░ ╤Ж╨▓╨╡╤В)
        ld de,pal
        ld b,16
copypal0
        ld a,(hl)
        inc hl
        ld (de),a
        inc de
        ld (de),a
        inc de
        djnz copypal0 ;╤Б╨║╨╛╨┐╨╕╤А╨╛╨▓╨░╨╗╨╕ ╨┐╨░╨╗╨╕╤В╤А╤Г ╨▓ pal (╨┐╨╛ 2 ╨▒╨░╨╣╤В╨░ ╨╜╨░ ╤Ж╨▓╨╡╤В)
       
        ld a,(pgscrdata1)
        SETPGC000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г ╤Б ╨┤╨░╨╜╨╜╤Л╨╝╨╕ ╨▓ c000
        ld a,(user_scr0_high) ;ok
        SETPG4000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╨┤╤А╤Г╨│╨╕╨╡ ╨┐╨╛╨╗-╤Н╨║╤А╨░╨╜╨░ ╨▓ 4000
        ld hl,0xc000
        ld de,0x4000
        ld bc,0x4000
        ldir ;╨┐╨╡╤А╨╡╨▒╤А╨╛╤Б╨╕╨╗╨╕ ╨╜╨░ ╤Н╨║╤А╨░╨╜

        call setpgsscr40008000_current ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Л ╤Н╨║╤А╨░╨╜╨░
        ld a,(pgvorobey)
        SETPGC000
        ld hl,scrbase
        ld de,0xc000
        ld bc,128*256+(224/2)
;b=hgt,c=wid (/2)
;de=gfx
;hl=scr
        call primgega_onescreen
       

        ld de,pal;sprpal
        OS_SETPAL ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╨┐╨░╨╗╨╕╤В╤А╤Г ╤Б╨┐╤А╨░╨╣╤В╨╛╨▓;╨║╨░╤А╤В╨╕╨╜╨║╨╕
       
        call setpgsmain40008000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г ╨┐╤А╨╛╨│╤А╨░╨╝╨╝╤Л ╨▓ 4000, ╨║╨░╨║ ╨▒╤Л╨╗╨╛
        call setpgmainc000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г ╨┐╤А╨╛╨│╤А╨░╨╝╨╝╤Л ╨▓ c000, ╨║╨░╨║ ╨▒╤Л╨╗╨╛

        ld de,scrwid/4 + (256*scrhgt) ;d=hgt,e=wid (/8)
        ld hl,0x4000 ;hl=scr
        call copyimgega_curtodefault ;╨║╨╛╨┐╨╕╤А╤Г╨╡╨╝ ╨║╨░╤А╤В╨╕╨╜╨║╤Г ╨╜╨░ ╨┤╤А╤Г╨│╨╛╨╣ ╤Н╨║╤А╨░╨╜
        call changescrpg ;╤Б ╤Н╤В╨╛╨│╨╛ ╨╝╨╛╨╝╨╡╨╜╤В╨░ (╤В╨╛╤З╨╜╨╡╨╡, ╤Б ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╤П) ╨╝╨╛╨╢╨╡╨╝ ╨▓╨╕╨┤╨╡╤В╤М, ╤З╤В╨╛ ╨╜╨░╤А╨╕╤Б╨╛╨▓╨░╨╗╨╕

        ld a,(timer)
        ld (uvoldtimer),a
       
;╨│╨╗╨░╨▓╨╜╤Л╨╣ ╤Ж╨╕╨║╨╗
mainloop

;╨▓╤Л╨▓╨╛╨┤ ╤Д╨╛╨╜╨░ ╨╕╨╗╨╕ ╨▓╨╛╤Б╤Б╤В╨░╨╜╨╛╨▓╨╗╨╡╨╜╨╕╨╡ ╤Д╨╛╨╜╨░ ╨┐╨╛╨┤ ╤Б╨┐╤А╨░╨╣╤В╨░╨╝╨╕
;... ╤А╨╡╨║╨╛╨╝╨╡╨╜╨┤╤Г╤О ╨▓╨╖╤П╤В╤М ╨╕╨╖ sprexamp!
restorer_cursprlist=$+1
        ld hl,sprlist1
        ld de,sprlist1^sprlist2
        ld a,h
        xor d
        ld h,a
        ld a,l
        xor e
        ld l,a
        ld (restorer_cursprlist),hl
       push hl ;curlist

restorer0
        ld e,(hl) ;x/2
        ld a,e
        cp 200
        jr z,restorer0q
        inc hl
        ld c,(hl) ;y
        inc hl
       ld a,scrhgt
       sub (hl) ;hgt
       ld b,a
        inc hl
       push hl
        ld a,e ;x/2
        sub +(sprmaxwid-1)
        jr nc,$+3
        xor a ;╨╡╤Б╨╗╨╕ <0
        ;cp scrwid-sprmaxwid
        ;jr c,$+4
        ;ld a,scrwid-sprmaxwid
        srl a
        srl a
        ld e,a ;x/8 >=0
        ld a,c ;y
        cp -(sprmaxhgt-1)
        jr c,$+3
        xor a ;╨╡╤Б╨╗╨╕ <0
        cp b
        jr c,$+3
        ld a,b
        ld c,a
;e=x/8 >=0
;c=y >=0
        ld b,0
        ld l,c
        ld h,b;0
        add hl,hl ;y*2
        add hl,hl ;y*4
        add hl,bc ;y*5
        add hl,hl ;y*10
        add hl,hl ;y*20
        add hl,hl ;y*40
        ld d,b;0
        add hl,de ;+x/8
        ld bc,0x4000
        add hl,bc
        ;ld hl,0x4000 ;hl=scr
        ;ld de,scrwid/4 + (256*scrhgt) ;d=hgt,e=wid (/8)
        ld de,3 + (256*16) ;d=hgt,e=wid (/8)        
        call copyimgega_defaulttoshadow
       pop hl
        jr restorer0
restorer0q
;╨▓╤Л╨▓╨╛╨┤ ╤Б╨┐╤А╨░╨╣╤В╨╛╨▓
;...
        call setpgsscr40008000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Л ╤Н╨║╤А╨░╨╜╨░

        ;ld hl,sprlist1
       pop hl
        ld (cursprlistaddr),hl

        ld iy,spaceship0
        ld e,50 ;e=x = -(sprmaxwid-1)..159 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ x+(sprmaxwid-1))
        ld c,50 ;c=y = -(sprmaxhgt-1)..199 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ ╨╡╤Б╤В╤М)
        call keepspr
        call prspr
        ld iy,fly0
curx=$+1
        ld e,80 ;e=x = -(sprmaxwid-1)..159 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ x+(sprmaxwid-1))
       ld a,e
       ;add a,sprmaxwid-1
       cp scrwid-1+(sprmaxwid-1)
       jr nc,noprspr
cury=$+1
        ld c,60 ;c=y = -(sprmaxhgt-1)..199 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ ╨╡╤Б╤В╤М)
       ld a,c
       add a,sprmaxhgt-1
       cp scrhgt-1+(sprmaxhgt-1)
       jr nc,noprspr
        call keepspr
        call prspr
noprspr
        ld iy,explosion4
        ld e,60 ;e=x = -(sprmaxwid-1)..159 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ x+(sprmaxwid-1))
        ld c,60 ;c=y = -(sprmaxhgt-1)..199 (╨║╨╛╨┤╨╕╤А╤Г╨╡╤В╤Б╤П ╨║╨░╨║ ╨╡╤Б╤В╤М)
        call keepspr
        call prspr

        call endkeepspr

        call setpgsmain40008000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Л ╨┐╤А╨╛╨│╤А╨░╨╝╨╝╤Л ╨▓ 4000,8000, ╨║╨░╨║ ╨▒╤Л╨╗╨╛

;╨╖╨░╨║╨╛╨╜╤З╨╕╨╗╨╕ ╤А╨╕╤Б╨╛╨▓╨░╤В╤М
       ld a,(timer)
       push af
        call changescrpg ;╤Б ╤Н╤В╨╛╨│╨╛ ╨╝╨╛╨╝╨╡╨╜╤В╨░ (╤В╨╛╤З╨╜╨╡╨╡, ╤Б ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╤П) ╨╝╨╛╨╢╨╡╨╝ ╨▓╨╕╨┤╨╡╤В╤М, ╤З╤В╨╛ ╨╜╨░╤А╨╕╤Б╨╛╨▓╨░╨╗╨╕

;╨╗╨╛╨│╨╕╨║╨░
;... ╨╡╤С ╨▓╤Л╨╖╤Л╨▓╨░╤В╤М ╤Б╤В╨╛╨╗╤М╨║╨╛ ╤А╨░╨╖, ╤Б╨║╨╛╨╗╤М╨║╨╛ ╨┐╤А╨╛╤И╨╗╨╛ ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╨╣!
mainloop_uvwaittimer0
        ld a,(timer)
uvoldtimer=$+1
        ld b,0
        ld (uvoldtimer),a
        sub b
        ld b,a
        jr z,mainloop_uvwaittimer0 ;╨╡╤Б╨╗╨╕ ╨╜╨╕ ╨╛╨┤╨╜╨╛╨│╨╛ ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╤П ╨╜╨╡ ╨┐╤А╨╛╤И╨╗╨╛, ╨║╤А╤Г╤В╨╕╨╝╤Б╤П ╤В╤Г╤В
;b=╤Б╨║╨╛╨╗╤М╨║╨╛ ╨┐╤А╨╛╤И╨╗╨╛ ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╨╣
mainloop_uvlogic0
        push bc
        ;call logic ;<----------------- ╤Б╨▓╨╛╤О ╨╗╨╛╨│╨╕╨║╤Г ╨┐╨╕╤И╨╕ ╤Б╤О╨┤╨░
        ld hl,curx
        inc (hl)
        ld hl,cury
        inc (hl)
        pop bc
        djnz mainloop_uvlogic0

;╨╢╨┤╤С╨╝ ╤Д╨╕╨╖╨╕╤З╨╡╤Б╨║╨╛╨│╨╛ ╨┐╨╡╤А╨╡╨║╨╗╤О╤З╨╡╨╜╨╕╤П ╤Н╨║╤А╨░╨╜╨░!
;╨╝╨╛╨╢╨╡╨╝ ╨╜╨░╤З╨░╤В╤М ╨╜╨╛╨▓╤Г╤О ╨╛╤В╤А╨╕╤Б╨╛╨▓╨║╤Г, ╤В╨╛╨╗╤М╨║╨╛ ╨╡╤Б╨╗╨╕ ╤Б ╨╝╨╛╨╝╨╡╨╜╤В╨░ changescrpg ╨┐╤А╨╛╤И╨╗╨╛ ╤Е╨╛╤В╤П ╨▒╤Л ╨╛╨┤╨╜╨╛ ╨┐╤А╨╡╤А╤Л╨▓╨░╨╜╨╕╨╡ (╨▓╨╛╨╖╨╝╨╛╨╢╨╜╨╛, ╨▓╨╜╤Г╤В╤А╨╕ logic)
       pop bc ;b=timer ╨╜╨░ ╨╝╨╛╨╝╨╡╨╜╤В changescrpg
waitchangescr0
        ld a,(timer)
        cp b
        jr z,waitchangescr0

        ld a,(curkey)
        cp key_esc
        jp nz,mainloop ;╨▓╤Л╤Е╨╛╨┤ ╨┐╨╛ esc (break)
       
        ;YIELDGETKEYLOOP ;╨╢╨┤╤С╨╝ ╨║╨╜╨╛╨┐╨║╤Г
        call swapimer
        QUIT
       
keepspr
cursprlistaddr=$+1
        ld hl,0
        ld (hl),e ;x
        inc hl
        ld (hl),c ;y
        inc hl
        ld a,(iy-1)
        ld (hl),a ;hgt
        inc hl
        ld (cursprlistaddr),hl
        ret
       
endkeepspr
        ld hl,(cursprlistaddr)
        ld (hl),200
        ret

sprlist1
        ds 3*128,200
sprlist2
        ds 3*128,200

pal
        ds 32 ;╤В╤Г╤В ╨▒╤Г╨┤╨╡╤В ╨┐╨░╨╗╨╕╤В╤А╨░ ╨║╨░╤А╤В╨╕╨╜╨║╨╕
;sprpal
        include "sprpal.ast" ;╨┐╨░╨╗╨╕╤В╤А╨░ ╤Б╨┐╤А╨░╨╣╤В╨╛╨▓ (╨╜╨░╨┤╨╛ ╤А╨╕╤Б╨╛╨▓╨░╤В╤М ╨║╨░╤А╤В╨╕╨╜╨║╤Г ╤Н╤В╨╛╨╣ ╨╢╨╡ ╨┐╨░╨╗╨╕╤В╤А╨╛╨╣!)
emptypal
        ds 32,0xff ;╨┐╨░╨╗╨╕╤В╤А╨░, ╨│╨┤╨╡ ╨▓╤Б╨╡ ╤Ж╨▓╨╡╤В╨░ ╤З╤С╤А╨╜╤Л╨╡

loadfile_in_ahl
;de=╨╕╨╝╤П ╤Д╨░╨╣╨╗╨░
;hl=╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝ (0xc000)
;a=╨▓ ╨║╨░╨║╨╛╨╣ ╤Б╤В╤А╨░╨╜╨╕╤Ж╨╡
        SETPG32KHIGH ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г A ╨▓ 0xc000
        push hl ;╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝
        OS_OPENHANDLE
        pop de ;╨║╤Г╨┤╨░ ╨│╤А╤Г╨╖╨╕╨╝
        push bc ;b=handle
        ld hl,0x4000 ;╤Б╤В╨╛╨╗╤М╨║╨╛ ╨│╤А╤Г╨╖╨╕╨╝ (╨╡╤Б╨╗╨╕ ╤Б╤В╨╛╨╗╤М╨║╨╛ ╨╡╤Б╤В╤М ╨▓ ╤Д╨░╨╣╨╗╨╡)
        OS_READHANDLE
        pop bc ;b=handle
        OS_CLOSEHANDLE
        jp setpgmainc000 ;╨▓╨║╨╗╤О╤З╨╕╨╗╨╕ ╤Б╤В╤А╨░╨╜╨╕╤Ж╤Г ╨┐╤А╨╛╨│╤А╨░╨╝╨╝╤Л ╨▓ c000, ╨║╨░╨║ ╨▒╤Л╨╗╨╛

primgega_onescreen
;b=hgt,c=wid (/2)
;de=gfx
;hl=scr
primgega0
        push bc
        ld hx,b
        push hl
        ld bc,40
primgegacolumn0
        ld a,(de)
        inc de
        ld (hl),a
        add hl,bc
        dec hx
        jr nz,primgegacolumn0
        pop hl
        ld a,0x9f;0xa0
        cp h
        ld bc,0x4000
        adc hl,bc
        jp pe,primgegacolumn0q ;╨▓ ╨┐╨╛╨╗╨╛╨▓╨╕╨╜╨╡ ╤Б╨╗╤Г╤З╨░╨╡╨▓
;8000->╤Б000 (╨╜╨░╨┤╨╛ 6000) ╨╕╨╗╨╕ a000->e001 (╨╜╨░╨┤╨╛ 4001)
         inc a
        xor h
        ld h,a
primgegacolumn0q
        pop bc
        dec c
        jr nz,primgega0
        ret



copyimgega_curtodefault
;d=hgt,e=wid (/8)
;hl=scr
        call getuser_scr_low_cur
        SETPG4000 ;set "from" page in 4000
        call getuser_scr_low
        SETPGC000 ;set "to" page in c000
        call copyimgegalayer
        call getuser_scr_high_cur
        SETPG16K ;set "from" page in 4000
        call getuser_scr_high
copyimgegaq
        SETPGC000 ;set "to" page in c000
        call copyimgegalayer
        call setpgmainc000
        jp setpgsmain40008000

copyimgega_defaulttocur
;d=hgt,e=wid (/8)
;hl=scr
        call getuser_scr_low
        SETPG4000 ;set "from" page in 4000
        call getuser_scr_low_cur
        SETPGC000 ;set "to" page in c000
        call copyimgegalayer
        call getuser_scr_high
        SETPG4000 ;set "from" page in 4000
        call getuser_scr_high_cur
        jr copyimgegaq ;set "to" page in c000, copy

copyimgega_defaulttoshadow
;d=hgt,e=wid (/8)
;hl=scr
        ld a,(pgscrdata0)
        SETPG4000 ;set "from" page in 4000
        call getuser_scr_low
        SETPGC000 ;set "to" page in c000
        call copyimgegalayer
        ld a,(pgscrdata1)
        SETPG4000 ;set "from" page in 4000
        call getuser_scr_high
        jr copyimgegaq ;set "to" page in c000, copy

copyimgegalayer
        push hl
        ld hx,e ;wid/8
copyimgega0
        push de
        push hl
        ld b,d ;hgt
        ld de,40-0x8000
copyimgegacolumn0
        ld a,(hl)
        set 5,h
        ld c,(hl)
         set 7,h
        ld (hl),c
        res 5,h
        ld (hl),a
        add hl,de
        djnz copyimgegacolumn0
        pop hl
        pop de
        inc hl
        dec hx
        jr nz,copyimgega0
        pop hl
        ret
       
pgscrdata0
        db 0
pgscrdata1
        db 0

curkey
        db 0
joystate
;bit - button (ZX key)
;7 - A (A)
;6 - B (S)
;5 - Select (Space)
;4 - Start (Enter)
;3 - Up (7)
;2 - Down (6)
;1 - Left (5)
;0 - Right (8)
        db 0

path
        db "loadscr",0
filenamevorobey
        db "vorobey.bin",0
filename0
        ;db "solkey.scr",0
        db "0kubik.bmpx",0
filename1
        db "1kubik.bmpx",0

        include "mem.asm"
        include "int.asm"

        include "spr.ast"
        include "prspr.asm"

end

        ;display "End=",end
        ;display "Free after end=",/d,#c000-end
        ;display "Size ",/d,end-begin," bytes"
       
        savebin "loadscr.com",begin,end-begin
       
        LABELSLIST "../../../us/user.l",1