bugbiter Posted August 21, 2015 Share Posted August 21, 2015 I have several apps that I want to run from a central menu excecutable. How can I make dos load and excecute? Is there an iocb command? Or do I have to code my own routine (loading the blocks to initad and runad and jumping to them) ? Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted August 21, 2015 Share Posted August 21, 2015 Good topic here discussing XIO 40: http://atariage.com/forums/topic/207064-xio-or-similar-to-run-comxex-from-mydos-spartados/ DOS 2.x is a little different, IIRC, since it doesn't present binary load via CIO. My personal preference is a bespoke loader, since it's then guaranteed to work (and it doesn't take much code). Quote Link to comment Share on other sites More sharing options...
xxl Posted August 21, 2015 Share Posted August 21, 2015 I have several apps that I want to run from a central menu excecutable. How can I make dos load and excecute? Is there an iocb command? Or do I have to code my own routine (loading the blocks to initad and runad and jumping to them) ? for Atari DOS fs (MyDOS, BiboDOS and so) you can use Load_File func: xBIOS_RENAME_ENTRY equ xBIOS+$03 xBIOS_LOAD_FILE equ xBIOS+$06 xBIOS_OPEN_FILE equ xBIOS+$09 xBIOS_LOAD_DATA equ xBIOS+$0c xBIOS_WRITE_DATA equ xBIOS+$0f xBIOS_OPEN_CURRENT_DIR equ xBIOS+$12 xBIOS_GET_BYTE equ xBIOS+$15 xBIOS_PUT_BYTE equ xBIOS+$18 xBIOS_FLUSH_BUFFER equ xBIOS+$1b xBIOS_SET_LENGTH equ xBIOS+$1e xBIOS_SET_INIAD equ xBIOS+$21 xBIOS_SET_FILE_OFFSET equ xBIOS+$24 xBIOS_SET_RUNAD equ xBIOS+$27 xBIOS_SET_DEFAULT_DEVICE equ xBIOS+$2a xBIOS_OPEN_DIR equ xBIOS+$2d xBIOS_LOAD_BINARY_FILE equ xBIOS+$30 xBIOS_OPEN_DEFAULT_DIR equ xBIOS+$33 xBIOS_SET_DEVICE equ xBIOS+$36 xBIOS_RELOCATE_BUFFER equ xBIOS+$39 xBIOS_GET_ENTRY equ xBIOS+$3c xBIOS_OPEN_DEFAULT_FILE equ xBIOS+$3f xBIOS_READ_SECTOR equ xBIOS+$42 xBIOS_FIND_ENTRY equ xBIOS+$45 xBIOS_SET_BUFFER_SIZE equ xBIOS+$48 http://xxl.atari.pl/#xBIOS_LOAD_FILE also... you could merge all files in one big file and do load & run any part of file. 1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted August 21, 2015 Share Posted August 21, 2015 (edited) When I used real floppies, my main 2.5 Dos had an Autorun which optionally loaded my copy of AsmEd. It did so by recursively putting the keycodes into CH - $2FC, so the program loads as if the user typed the commands needed to do so (including DOS if Basic is present). You could do something like that - use a VBlank routine that puts each keystroke in then waits for CH = $FF which means that it has been processed and the next one can be inserted. On the XL OS you can also disable the keyclick if desired. And if you want go the extra step of setting colour registers so it's hidden from view. Alternatively like mentioned, do your own loader. The binary load algorithm is fairly simple. Pseudo code follows: Open file. Set Run address points to "RTS". Loop until EOF. Get start address. If start address = $FFFF then get start address again. Get end address. Set current = start address. Set Init address points to "RTS". Loop until current>end address. Get byte, store at current. Increment current. End loop. JSR indirect through INIT. End loop. JSR indirect through RUN. JMP through DOSVEC ($0A) - this covers the case if the program returns control to the loader. Edited August 21, 2015 by Rybags Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted August 21, 2015 Share Posted August 21, 2015 Here's actual code. It's the loader for the segmented FDISK (loaded from the SDX CAR: device). ; CAR: loader for FDISK ; icl 'sdx_equ.inc' icl 'macros.inc' org $80 BStart .ds 2 BEnd .ds 2 BLen .ds 2 org $8000 .local Start Loop jsr LoadBin bmi Error inc FileNum lda FileNum cmp #'3' bcc Loop jmp $2000 ; comes here if no run address Error ldx #0 mwa #ErrorMsg icbadr,x mwa #40 icblen,x mva #9 iccom,x jmp ciov .endl .local OpenFile ldx #16 mva #12 iccom,x jsr ciov mva #<File icbadr,x mva #>File icbadr+1,x mwa #64 icblen,x mva #3 iccom,x mva #4+32+64 icaux1,x ; use SDX path and scan mode mva #2 icaux2,x ; look for hidden files jmp ciov .endl .local LoadBin jsr OpenFile bmi Error Loop jsr ReadBlock bpl Loop Error php tya pha mva #12 iccom,x jsr ciov pla tay cpy #136 ; EOF bne @+ plp ldy #1 rts @ plp rts .endl .local ReadBlock jsr GetPair bmi Error lda HeadBuf and HeadBuf+1 cmp #$ff bne NoSignature jsr GetPair bmi Error NoSignature mwa HeadBuf BStart jsr GetPair mwa HeadBuf BEnd sbw BEnd BStart BLen inw BLen mwa BStart icbadr,x mwa BLen icblen,x mva #7 iccom,x jsr ciov bmi Error cpw BStart $02E2 bne NotInitBlock jmp ($2e2) NotInitBlock lda #1 Error rts .endl .local GetPair ldx #16 mwa #HeadBuf icbadr,x mwa #2 icblen,x mva #7 iccom,x jmp ciov .endl ErrorMsg .byte 'Error loading ' File .byte 'D:FDISK' FileNum .byte '0.OVL',155,0 HeadBuf .ds 2 run Start The code to handle the three overlay files is superfluous to the loading of a single binary, so there's really not much to it. Just be careful to assemble the loader somewhere out of the way (e.g. in the stack or somewhere you're sure won't be overwritten by the loaded binary). Quote Link to comment Share on other sites More sharing options...
drac030 Posted August 21, 2015 Share Posted August 21, 2015 In SpartaDOS X (mads format): U_LOAD smb 'U_LOAD' FLAG smb 'FLAG' FILE_P smb 'FILE_P' blk reloc main start ldx #$01 lp lda fnamep,x sta FILE_P,x dex bpl lp lda #$00 sta FLAG jsr U_LOAD rts fnamep .word fname fname .byte 'FOOBAR.COM',$9b This will load and run a binary named FOOBAR.COM from the current drive/directory. The binary can be of any type recognized by SDX. When the loaded program returns (with RTS), this one will also terminate. 1 Quote Link to comment Share on other sites More sharing options...
bugbiter Posted August 21, 2015 Author Share Posted August 21, 2015 Thanks guys, you never let me down! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.