    device pentagon1024
    EMPTYTRD "bge_xxx.trd"

dehr=#4000

    org #8000
    incbin "dehrust"
    ds 255
szbdehrust=($-#8000)/256

    org #8000
    incbin "bge_main.hst"
    ds 255
szbgemain=($-#8000)/256

    org #8000
    incbin "bge_3.hst"
    ds 255
szbgegui=($-#8000)/256

    org #8000
    incbin "bge_6.hst"
    ds 255
szbgepgn1=($-#8000)/256

    org #8000
    incbin "bge_7.hst"
    ds 255
szbgepgn2=($-#8000)/256

    org #5d3b
beginbasic
    db 0,10
    dw remlinelen ;#88
;#5d3f
remline
    db #ea ;rem
entry
    ;ld sp,#5FFE
     ld (iy+1),#cc ;was not in the original BGE loader
    ld hl,#4000
    ld de,#4001
    ld bc,#1aff
    xor a
    ld (hl),a
    ldir
    out (#fe),a

    ld hl,dehr
    ;ld a,#10
    ld b,szbdehrust
    call load ;dehrust

    ld hl,#6000
    ld a,#10
    ld b,szbgemain ;#2d
    call loaddepk
    ;call #6000
    ld hl,#c000
    ld a,#13
    ld b,szbgegui ;#20
    call loaddepk
    ;call #c000
    ld hl,#c000
    ld a,#16
    ld b,szbgepgn1 ;#2a
    call loaddepk
    ;call #c000
    ld hl,#db00
    ld a,#17
    ld b,szbgepgn2 ;#1a
    call loaddepk
    ;call #db00

    jp #6003

loaddepk
    push af
    call setpg
    push hl
    call load
    pop hl
    pop af
    call setpg ;fix divIDE?
    ld d,h
    ld e,l
    di
    call dehr
    ei
    ret

setpg
    push bc
    ld bc,#7ffd
    ld (#5b5c),a
    out (c),a
    pop bc
    ret

load
    ld c,5
    ld de,(#5cf4)
    jp #3d13

    ;db #20
    ;db #0d
    ;db "!Alone Coder removed the fucks             "
    ;db #0d
remlinelen=$-remline
;#5dc7
    db 0,20
    dw runlinelen ;#15
;#5dcb
runline
    db #fd,#b0,#22,"24575",#22 ;clear val "24575"
    db ":"
    db #f9,#c0,#b0,#22,"23872",#22 ;randomize usr val
    db #0d
runlinelen=$-runline
;#5de0
endbasic


    SAVETRD "bge_xxx.trd", "boot.B",beginbasic,endbasic-beginbasic