Boriel Basic Forum
3DOS Commands? - Printable Version

+- Boriel Basic Forum (https://forum.boriel.com)
+-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://forum.boriel.com/forumdisplay.php?fid=16)
+---- Thread: 3DOS Commands? (/showthread.php?tid=2643)



3DOS Commands? - tubz74 - 2025-10-05

Hi

I'm looking at using some 3DOS commands, starting to see how I can cat a disk.

I've takend the below code from the +3 manula (pg 200 to 203) which should allow me to get the CAT into memory - the code looks to activate the disk (and for example if I don't attach a disk, it give me abort/retry) but then "reboots"/crashes the emulator back to the +3 menu.

I'm assuming that there might be some incompatibility somewhere between, starting reading, and returning contorl to the program.  Code is below.

Any thoughts?

(PS If the ASM didn't crash, the program wouldn't actually do anything anyway yet, as I've not sorted any output, or any caribles)


Code:
#include <input.bas>
#include <screen.bas>
#INCLUDE <keys.bas>

PRINT "This is the start"
main()


SUB main()
    LET YesNo = "n"
    PRINT "do you want to CAT disk"
    YesNo = INPUT(1)
    IF YesNo="y" then
        Catalogue()
    END IF
    PRINT "Ed#nd Main"
END SUB



SUB Catalogue()
    ASM
        PUSH IX ; dos catalog corrupts ix
        PROC
       
        LOCAL   MYSTACK
        LOCAL   STACKSTORAGE
        LOCAL   BANKM
        LOCAL   PORT1
        LOCAL   CATBUFF
        LOCAL   DOS_CATALOG
       
       
        MYSTACK         EQU     9fffh ;
        STACKSTORAGE    EQU     9000h ; save pointer
        BANKM           EQU     5b5ch ; system var that holds last value output to 7ff0h
        PORT1           EQU     7ffdh ; address of rom/ram switching port
        CATBUFF         EQU     8000h ; location for dos to output
        DOS_CATALOG     EQU     011Eh ; DOS routine to call
   
        JP start
        stardstar:  defb "*.*",255                   
        dosret:     defw 0
   
        start:
            DI
            LD (STACKSTORAGE),SP
            LD BC,PORT1         ;
            LD A,(BANKM)        ; current switch state
            RES 4,A             ; move right to left in horizontal rom switch (3 to 2)
            OR 7                ; switch in ram page 7
            LD (BANKM),A        ; keep system var up to date
            OUT (C),A           ; switch ram and rom
            LD SP,MYSTACK       ; make sure stack is above 4000h and below bfeoh
            EI                  ; enable interrupts
            ;
   
  
            LD HL,CATBUFF
            LD DE,CATBUFF+1
            LD BC,1024
            LD (HL),0
            LDIR
            LD B,64
            LD C,1
            LD DE, CATBUFF
            LD HL,stardstar             ;file name *.*
            CALL DOS_CATALOG            ;call dos catalog
            PUSH AF
            POP HL
            LD (dosret),HL              ; put here so can be seen from basic
            LD C,B                      ; number of files in catalog, low byte of bc
            LD B,0                      ; returned to basic by usr functio
   
            DI
            PUSH BC
            LD BC, PORT1
            LD A, (BANKM)
            SET 4, A                    ; move left to right (riom 2 to 3)
            AND 48h                     ; ram page 9
            LD (BANKM),A                ; update syste value
            OUT (C),A                   ;switch
            POP BC                      ; get back saved number of files
            LD SP,(STACKSTORAGE)        ;
            EI
            ;RET ; not sure if thisis needed
        ENDP
        POP IX
        ;RET ; Not sure if this is needed here
    END ASM
END SUB



RE: 3DOS Commands? - boriel - 2025-10-06

I have no experience in this (you can search for 3DOS in this forum). Some people have managed to do some things:
https://forum.boriel.com/showthread.php?tid=529
But unfortunately, these users have abandoned their projects and even the source code is lost. :-(


RE: 3DOS Commands? - tubz74 - 2025-10-06

(2025-10-06, 09:19 AM)boriel Wrote: I have no experience in this (you can search for 3DOS in this forum). Some people have managed to do some things:
https://forum.boriel.com/showthread.php?tid=529
But unfortunately, these users have abandoned their projects and even the source code is lost. :-(

Thanks, done a bit of searching about, and found some 3DOS stuff on world of spectrum, so I'll look at them and see if I can find a solution.


RE: 3DOS Commands? - boriel - 2025-10-06

This could be of help to other people. Please comment your finding! :-)