CALL CHDIR
This page was last modified 16:47, 26 May 2023 by Mars2000you. Based on work by Gdx and Rderooy.

This instruction is available in Disk Basic and RMSX Basic.

Contents

CALL CHDIR in Disk Basic

Effect

Changes the current working directory to the one specified.

Each drive has its own current directory. This remains at the directory specified by the last CALL CHDIR instruction for that drive (or at the root directory initially) until another CALL CHDIR instruction is given or it cannot be found on the disk when it is accessed (because the disk has been changed, for example). It is then returned to the root directory.

Only works with

  • version 2 of Disk BASIC, as provided by the MSX-DOS 2 cartridge or the MSX turbo R machines
  • version 3 of Disk BASIC, as provided by the Nextor operating system version 2.0 and higher

Syntaxes

  • CALL CHDIR ("<Device>:\<Path>")
  • CALL CHDIR("..")
  • CALL CHDIR(".")

Notes:

  • Character backslash (\) serves as a separator between the folders and the file name in MSX-DOS2. You don't have to put it after the colon of the device name.
  • Character backslash is replaced by the character yen (¥) on Japanese MSX or the character won (₩) on Korean MSX.
  • Wildcards can not be used.

Parameters

<Device> is the name for used device. It can only be a disk drive.

If you don't specify the drive, the instruction will be applied to the currently active drive (by default, it's drive A:)

Device type Device name Remark
Disk drive A, B, C, D, E, F, G, H A floppy disk interface can control until 2 drives.


<Path> is used to specify the location in folders of the new current folder.

If no path is specified, then the current directory path for the current or specified drive is displayed. This is the directory path from the root directory to the current directory.

\ used alone allows to display the root directory.

Dot (.) represents the current working directory, Dot Dot (..) represents the directory before the current (one level up).

Examples

CALL CHDIR ("GAMES")  'Changes to the GAMES directory
Ok
CALL CHDIR ("..") 'Changes to the previous directory
Ok
CALL CHDIR ("\") 'Changes to the root of the filesystem 
Ok
CALL CHDIR ("B:\TEST\DATA\APP1") 'Absolute directory change on drive B
Ok
CALL CHDIR ("..\APP2") 'Relative directory change
Ok
CALL CHDIR ("FAIL") 'Non existent directory
Directory NOT found
Ok

Related to

CALL CHDRV, CALL MKDIR, CALL RMDIR, FILES

Compatibility

Disk BASIC 2.0 or higher / MSX-DOS 2 mode of Nextor OS


CALL CHDIR in RMSX Basic

Effect

Changes the current working directory of a real disk in a drive of the MSX turbo R, used as host for a MSX1/MSX2 computer emulated on this machine with the rMSX emulator.

Note: This instruction 'replaces' the CALL CHDIR of Disk Basic, while being very similar, but it can also be used when you have started rMSX with the NODISK parameter or when you have booted the MSX1 or MSX2 computer emulated by rMSX while pressing the SHIFT key to get maximum free memory for running games on tape image (CAS file).

Syntaxes

  • CALL CHDIR ("<Device>:\<Path>")
  • CALL CHDIR("..")
  • CALL CHDIR(".")

Notes:

  • Character backslash (\) serves as a separator between the folders and the file name in MSX-DOS2. You don't have to put it after the colon of the device name.
  • Character backslash is replaced by the character yen (¥) on Japanese MSX or the character won (₩) on Korean MSX.
  • Wildcards can not be used.

Parameters

<Device> is the name for used device. It can only be a disk drive.

If you don't specify the drive, the instruction will be applied to the currently active drive (by default, it's drive A:)

Device type Device name Remark
Disk drive A, B, C, D, E, F, G, H A floppy disk interface can control until 2 drives.


<Path> is used to specify the location in folders of the new current folder.

If no path is specified, then the current directory path for the current or specified drive is displayed. This is the directory path from the root directory to the current directory.

\ used alone allows to display the root directory.

Dot (.) represents the current working directory, Dot Dot (..) represents the directory before the current (one level up).

Examples

_CHDIR ("C:\GAMES")  'Changes to the GAMES directory on drive C:
Ok
_CHDIR ("..") 'Changes to the previous directory
Ok
_CHDIR ("\") 'Changes to the root of the filesystem 
Ok
_CHDIR ("\GAMES\DSK") 'Absolute directory change
Ok
_CHDIR ("..\GAMES") 'Relative directory change
Ok
_CHDIR ("FAIL") 'Non existent directory
Bad file NAME
Ok

Related to

CALL CASRUN, CALL CHCAS, CALL CHDSK, CALL FILES

Compatibility

RMSX BASIC