; http://CPCrulez.fr
;

         ORG #8000

TABADR   EQU #A000
AMPTR    EQU #5000
ECRAN    EQU #C000
;
CREADRES LD      HL, #B800
         LD     DE, #C050
         LD B,200
         LD IX,TABADR
CREAD    LD A,8
         ADD  A,H
         LD   H,A
         JR   NC,RANGAD
         ADD  HL,DE
RANGAD   LD   (IX+0),L
         LD   (IX+1),H
         INC  IX
         INC  IX
         DJNZ CREAD
;
LOADING  LD    HL,NOM
         LD    B,NOM2-NOMI
         LD    DE,ECRAN
         CALL  #BC77
         LD    HL, ECRAN
         CALL  #BC83
         CALL  #BC7D
;
INIT     LD    HL,ECRAN
         LD    DE,TAMPTR
         LD    BC,#50
         LDIR
         PUSH  DE
         POP   IX
         LD    IY,10
         ADD   IY,DE
         LD    C,0
;
GETAD    LD    HL,TABADR
         LD    A,C
         SLA   A
         JR    NC,GETAD1
         INC   H
GETAD1   LD    L,A
         LD    E,(HL)
         INC   HL
         LD    D,(HL)
         INC   HL
         PUSH  DE
         LD    E, (HL)
         INC   HL
         LD    D, (HL)
         POP   HL
         LD    A,#7E
         LD    (SUICP+3),A
         LD    B,80
;
CPLIG    LD    A, (SUICP+3)
         OR    #40
         ADD   A,8
         JR    NC ,METOP
         INC   IX
         LD    A,#86
METOF    AND   #BF
         LD    (SUICP+3),A
         LD    A, (DE)
         CP    (HL)
         JR    Z,SUICP
         LD    (IY+0) ,A
         INC   IY
         LD    A,(SUICP+3)
         OR    #40
         LD    (SUICP+3),A
SUICP    RES   0,(IX+0)
         INC   HL
         INC   DE
         DJNZ  CPLIG
         PUSH  IY
         POP   IX
         LD    DE,10
         ADD   IY,DE
         INC   C
         LD    A,C
         CP    199
         JR    NZ,GETAD
;
SAVING   LD    HL,NOMI
         LD    B,NOM2-NOM1
         LD    DE, #9800
         CALL  #BC8C
         XOR   A
         PUSH  IY
         POP   HL
         LD    DE, TAMPTR
         SBC   HL,DE
         LD    (NOM) ,HL
         EX    DE ,HL
         LD    HL,TAMPTR
         LD    BC,TAMPTR
         CALL  #BC98
         CALL  #BC8F
;
FIN      RET
NOM      DM    DESSIN2A.BIN
NOM1     DM    DES2.BIN
NOM2