iMPdos Public Edition v1.17 - AsT/iMPact 2016-2018
Last manual update : 01/05/2018
------------

What's iMPdos ? iMPdos is a new rom which allows you to use your xMass Card.
Maximum size is original xMass size, 128 Mb.

1. How & where to install it ?
iMPdos must be installed between rom 1 and 6. (Before Rom 7, in fact!)

When rom is installed, iMPdos will format your x-Mass to detect it properly.
After done, if all is ok, your xMass is detected and rom is actived. 
If not, xMass will not be detected and rom will have to be invisible.

2. How to use iMPdos ?
For the first time, i suggest you to use the |hlp command to display all possibilities.

3. Let's see all the commands.
xMass is located as drive X, so you can use |x command to access xMass drive.

|a : select drive a
|b : select drive b
|x : select x-Mass drive

a. Root & directories

cat or |cat to display directory.

|cd,"/ to go back to root
|cd,".. for previous directory
|cd,"cmp" to go to "cmp" directory

About Root and directories.
Root has a maximum of 512 files, no more.
Each direcotries can accepted up to 62 files max.
You can't do more.

b. Load, run & save files.

|l,"filename" command will load bin/bas files without any memory basic command in first adr saved.
|l,"filename",&4000 will load bin/bas files at #4000.
|r,"file" command will load and run any bin/bas files.

basic command are also compatibles, so you can use load" save" & run" too.

if |x:run"filename run filename from drive a or b instead of xMass, 
just use : 

|x:|r,"filename

c. Erase files or directories.

|del,"filename" will erase this file in your xMass.
|rd,"filename" will erase the directory name.
You will have to give a confirmation if some files are presents on the directory before erase it.

----- Wildcard can't be used !!! So |del,"*" or |rd,"*" cannot work !!!

------ |era are only used for drive a & b -----

d. Create directories.

|md,"filename" will create a new directory.

e. Formatting your xMass.

|format,1 : Fast format as written in the |hlp.
in fact, this command format your x-mass up to the last files written.
|format,2 : Full format. Format all tracks on your xMass.

f. Filenames header.

|head,"filename" will display important informations as :
 -filename type : 00-01 : basic / basic protected
                  02    : binary
                  #16   : ascii
 -StartAdr : Start Adress
 -Lenght : Lenght of the file
 -Exec   : Execution Adress
 -NbSect : how many sectors compose this file
 -StSect : first file sector
 
g. Extended dos commands

You could access extended dos commands which allow you to have 366k free in drive B.
This command was developped for Gotek users. Before using this command, you'll have 
to create a 366k dsk file by formatting it with 80 tracks. 
And then :

|dos : install drive b 366 driver
|dosoff : drive b back to normal configuration 

In iMPdos boot, you are in normal config (|dosoff)

Don't ask me what is the difference between Parados & iMPdos 366k format ! I don't use Parados, so i don't know.

h. Copying file into xMass and more.

Some commands were done to make fast file copies between drive & xMass.

|cpax,"filename" copies filename from drive a to xMass
|cpbx,"filename" copies filename from drive b to xMass
|cpax,"*" copies all files from drive a to xMass
|cpbx,"*" copies all files from drive b to xMass
---
|cpxa,"filename" copies filename from xMass to drive a
|cpxb,"filename" copies filename from xMass to drive b

----- wildcard will not work in this way.
----- Ascii files can't be copied using this commands
----- Poke &be78,&ff will disable "Insert Disc in Drive A/B"

i. Connect roms.

|connect : connect roms 16 up to 31.

j. Hexa Sector Editor. 

As i love discology's hexa sector editor, i coded one for iMPdos.

|ed,&221,0 : edit 000221 sector.
When you are in editor mode : 

----Up/Down/Left/right 
----Return    : Change byte
----P         : Previous Sector
----N         : Next Sector
----Ctrl+Up   : Page 0/1 - #0000-#00ff
----Crtc+Down : Page 2/1 - #0100-#01ff
----Esc       : Quit Hexa Editor
----Ctrl+R    : Read current sector
----Crtl+S    : Save current sector

k. Some information to use/detect iMPdos properly in your next production.

#b8fa, #b8fb & #b8fc : Sector current directory
#b8fd : Drive Number (0=A | 1=B | 3=X-Mass)


You could find all informations in AmstradPlus forum : http://amstradplus.forumforever.com/t381-Loader-universel.htm

---- Load :
;
; Universal Loader v2 iMPdos - AsT/iMPact 29/03/2018
; #b8fa-fb-fc : Sector current directory
; #b8fd : Drive Number (0=A | 1=B | 3=X-Mass)
;
         org #a000
;
         ld hl,#b8fa ; sauve la config
         ld de,config ; drive+repertoire
         ld bc,4
         ldir
;
         LD   HL,(&BE7D) ; Amsdos Start Adr
         LD   A,(HL) ; A=Drive number xx
         push af ; save drive number
         ld (#b8fd),a ; save drive in iMPdos drive adress
         DI
         LD   BC,&7F88+2 ; mode 2 - Lower Rom On | Upper Rom Off
         OUT  (C),C
         EXX
         CALL &44     ; Restore zone 0-#3f
         CALL &08BD   ; Restore all vectors systems (vecteur pour 6128 et 6128 plus)
         CALL &BB00   ; Init Key Manager
         LD   A,&C9    ; Disable char                                               
         LD   (&BB5A),A  ; No chars will be printed
         LD   DE,&40    ; init All ROMs
         LD   HL,&ABFF
         CALL &BCCB
         LD   A,&CF    ; enable char 
         LD   (&BB5A),A
;
          ld hl,config ; restore old config
          ld de,#b8fa ; repertory + drive number
          ld bc,4
          ldir
          ld hl,#b8fa ; Copy repertories sectors adresses
          ld de,#b34A ; into iMPdos buffer
                      ; Sector Low
          ldi:ldi
          ld a,(hl)   ; Sector High
          ld (#b349),a 
          inc hl      ; Drive
;         
          ld a,(hl)
          CP   3
          CALL Z,foundrsx    ; if drive=3 (impdos) then search Rsx (ùX)   
;
          pop af ; a=drive number
          LD   HL,(&BE7D) ; put correct drive number in Amsdos start Adr
          LD   (HL),A
;
; Load a file
;
loading   LD   DE,&C000     ; buffer
          LD   HL,file      ; name to load
          LD   B,endfile-file ; 
          CALL &BC77        ; load the Header
           
          LD   HL,&c000      ; startadr
          CALL &BC83
          CALL &BC7A
          JP   &bb18    ; wait a key !!!
 
;
; Find iMPdos rom ?          
;
foundrsx
          LD   HL,rsxX ; search for rsx "|x"
          CALL &BCD4
          JR   NC,bip ; if not found then bip !!!
          jp #1b ; execute rsx
;
config byte 0,0,0,0 ; repertory+drive data save                
;
; Rsx Not found -> Bip
; Bip if iMPdos is not found.
;
bip       LD   A,7      ; biiiip
           JP   &BB5A
;
rsxX   BYTE "X"+&80
file  BYTE "ast.scr"
endfile

----- Save :

;
; Universal Xmass save - Drive A/B/xMass iMPdos  
; by AsT/iMPact 
;
  org #a000
        LD   HL,(&BE7D) ; Amsdos Startadr
        LD   A,(HL) ; a=drive
        push af ; save drive number
        ld (#b8fd),a ; into iMPdos adress
;
  ld hl,#b349 ; save all sectors data
  ld de,config
  ld bc,3
  ldir
;
  ld hl,#B300 ; save directory parameters
  ld de,param
  ld bc,#60
  ldir
;
  ld hl,#b8fa ; save repertory adress sector
  ld de,config2
  ld bc,3
  ldir
;
        DI
        LD   BC,&7F88+2 ; mode 2 - Lower Rom On | Upper Rom Off
        OUT  (C),C
        EXX
        CALL &44     ; restore zone 0-#3f
        CALL &08BD   ; restore vectors system (vecteur pour 6128 et 6128 plus)
        CALL &BB00   ; init Key Manager
        LD   A,&C9    ; disable char                                               
        LD   (&BB5A),A  ; 
        LD   DE,&40    ; init All ROMs
        LD   HL,&ABFF
        CALL &BCCB
        LD   A,&CF    ; enable char 
        LD   (&BB5A),A
;
  ld bc,#7f8c+2
  out (c),c
;
  ld hl,config ; get sector where you have to write
  ld de,#b349 ; the file into your directory
  ld bc,3
  ldir
 
  ld hl,(#be7d)
  pop af
  ld (hl),a
  ld (#b8fd),a
;
        ld a,(hl)
        CP   3
        CALL Z,foundrsx        
;
   ld b,finnom-nom 
  ld hl,nom ; filename 
  ld de,#c000 ; buffer
  call #bc8c ; cas out write
  jr nc,bip  ; if error -> bip
  ld hl,#c000 ; startadr
  ld de,#3FFF ; Lenght
  ld bc,#caca ; exec
  ld a,2      ; file type (0 : basic | 1 : Protected Basic | 2 : Binary | #16 : Ascii)
  call #bc98  ; save
  jr nc,bip   ; if error -> Bip
  call #bc8f  ; close the file
;
lastconfig
;
  ld hl,config2 ; Get last sector adress
  ld de,#B34A
  ld bc,2
  ldir
  ld a,(hl)
  ld (#b349),a
;
   ld hl,param ; restore directory parameters 
  ld de,#b300
  ld bc,#60
  ldir
  ret
;
; Find iMPdos Rom ?          
;
foundrsx
LD   HL,rsxX
        CALL &BCD4
        JR   NC,bip
        jp #1b
;
; Rsx Not found -> Bip
; Bip if iMPdos isn't found.
;
bip   LD   A,7      ; biiiip
        call   &BB5A
  jr lastconfig
;
rsxX  BYTE "X"+&80
;
nom  byte "chany.ch1"
finnom
;
config  byte 0,0,0,0 ;                  
config2 byte 0,0,0 ; 
param  ds #60,0
;

L. Thanks & Bugs reports

Thanks to all my beta-testers : Kris, Cmp, Chany, Dirtybb, Madram, Power, ArnoldEmu, Audronic & Subaru.
Other people ask me to be beta-tester but never send me feedback. so...

For bugs reports : 

http://amstradplus.forumforever.com/t293-iMPdos.htm