CPCWiki forum

General Category => Programming => Topic started by: Ast on 11:05, 22 November 19

Title: M4 directories access
Post by: Ast on 11:05, 22 November 19

Hi,


I'm still working on iMPdraw v2 fixing.
All seems working well except cpc+ features and m4 directories.


Concerning cpc+ access, i will try with new fixed m4rom soon, but i need help about asm directories access on m4. (Duke if you read it!)
What works perfectly on xmass Doesn't work with m4.


here is the sample code i used



enterrepm4
;
ld   de,filename
ld   (&B07F),de
ld   a,endf-filename
ld   (&B07E),a
;
ld   hl,rsxCD
call &BCD4
jr   nc,beep
;
jp   &1B
;
beep ld a,7
jp #bb5a
;
rsxCD byte "CD"+&80
filename
byte "m4"
endf
;
Title: Re: M4 directories access
Post by: SOS on 12:02, 22 November 19
You need to build an RSX-Buffer first and then call the CD-Command.
The following example code (similar) from YANCC works with M4DOS, ACMEDOS + CUBEMDOS:

ld   hl,rsxCD
call &BCD4
jr   nc,beep
;

ld a,l
ld (CHDIR_command_),a
ld a,h
ld (CHDIR_command_+1),a
ld a,c
ld (CHDIR_command_+2),a


ld ix,buffer_fn
push ix
pop hl
inc hl
inc hl
ld (ix+0),l
ld (ix+1),h
ld   a,endf-filename
ld (ix+2),a

ld hl,filename
ld (ix+3),l
ld (ix+4),h

ld a,1


defb &df    ;  RST 3   (=RST &18)   KL FAR CALL
defw CHDIR_command_
ret
;
rsxCD defm "C","D"+&80
CHDIR_command_: defs 3
buffer_fn: defs 5
org &a100
filename
byte "TMP",0
endf
Title: Re: M4 directories access
Post by: Ast on 13:53, 22 November 19

It works ! Thank you very much @SOS (http://www.cpcwiki.eu/forum/index.php?action=profile;u=941) !


Here is iMPdos m4 routine. I hope that will help you if you need about it.



;
; Enter in iMPdos m4 directory
; AsT/iMP4CT -> Thanks to SoS for help.
;
          ld   hl,rsxCD
          call &BCD4
          jp   nc,beep
;
          ld   ix,(&B07F)
          push ix
          pop  de
          inc  de
          inc  de
          ld   (ix+0),e
          ld   (ix+1),d
          ld   a,endf-filename
          ld   (ix+2),a
          ld   de,filename
          ld   (ix+3),e
          ld   (ix+4),d

          ld   a,1
          jp   &1B
;
rsxCD BYTE "CD"+&80
      ORG &A500
filename
      BYTE "impdos",0
endf


beep      ld   a,7
          jp   &BB5A


Title: Re: M4 directories access
Post by: Ast on 18:53, 24 November 19

I found a Strange bug in the directories accesses.


To reproduce it easily :
|MKDIR,"123456789"


call &bc9b,&4000


then just look at #4000 you could see 12345679 -> 8 is missing strangely ???


It seems your Cat routine is buggy @Duke (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1624) ! Any idea ?


Secondly, when you do


ùcd,"toto" then cat M4dos displays :


Drive a:/toto


Where can i find toto ? I think it's saved in the m4 card, but where ???


Thanks for your reply.
Title: Re: M4 directories access
Post by: Duke on 07:18, 25 November 19
Quote from: Ast on 18:53, 24 November 19
To reproduce it easily :
|MKDIR,"123456789"


call &bc9b,&4000


then just look at #4000 you could see 12345679 -> 8 is missing strangely ???
Thanks for reporting, will check it out and fix soon.

Quote
ùcd,"toto" then cat M4dos displays :


Drive a:/toto


Where can i find toto ? I think it's saved in the m4 card, but where ???
Not sure I follow, when I type |cd,"toto" it says unknown directory.
So if you have a directory named toto, it will cd into it and CAT will display the path as "Drive a:/toto"  the location would be a sub directory to the root ?
Title: Re: M4 directories access
Post by: Ast on 10:00, 25 November 19
My question was Where in memory can i found these data??? (If the sub directory exists of course!)
Title: Re: M4 directories access
Post by: Duke on 10:41, 25 November 19
Quote from: Ast on 10:00, 25 November 19
My question was Where in memory can i found these data??? (If the sub directory exists of course!)

Ah ok.
There is a special RSX called |GETPATH that @SOS (http://www.cpcwiki.eu/forum/index.php?action=profile;u=941) added.
Check under "Special RSX Commands" -> http://www.spinpoint.org/cpc/m4info.txt   (almost at the end)
Title: Re: M4 directories access
Post by: Ast on 18:01, 25 November 19
https://www.youtube.com/watch?v=hcCkv8FKid4
Title: Re: M4 directories access
Post by: roudoudou on 18:47, 25 November 19
Who is Pedro?
Title: Re: M4 directories access
Post by: Ast on 18:57, 25 November 19
No sabé!
Title: Re: M4 directories access
Post by: Ast on 21:14, 25 November 19

@all : It's working now !!!

Powered by SMFPacks Menu Editor Mod