[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DOS 3.3 commands from 6502 assembly? (Aztec)
- Subject: Re: DOS 3.3 commands from 6502 assembly? (Aztec)
- From: dalloff@freenet.columbus.oh.us (Dave Althoff)
- Date: 1997/11/07
- Newsgroups: comp.sys.apple2
- Organization: The Greater Columbus FreeNet
- References: <63uuri$ehn$1@news.monad.net>
Scalar (scalar@blues.jpj.net) wrote:
: I don't have Beneath Apple DOS (I wish I did), so I guess I'd like to make
: a request. Can someone tell me how a 6502 machine language program can go
: about executing DOS 3.3 or ProDOS commands?
: So far there seems to be hints that point to putting the DOS command in
: the keyboard buffer ($200-2FF), with a Control-D as the first character of
: the buffer, and then somehow calling a subroutine to "fake" hitting
: Return and treating the keyboard buffer like the command was entered in
: immediate mode. And I want the machine code to continue running once the
: DOS command is finished.
No, it is simpler than that. All you have to do is send the command
string through the standard DOS output routine, normally pointed to by CSW
($36-$37). That can be done with the usual call to COUT ($FD0C, if I
remember correctly), which calls the CSW routine.
In other words, you do the same thing that you would do from BASIC. I
have a favorite output routine, based on the one in Roger Wagner's book,
"Assembly Lines", that uses the stack to find the text to be outputted,
then resets the pointer on the stack to RTS to the first instruction after
the text. Cute routine, useful for blowing text to the screen or the
printer, or for sending commands to DOS. Remember the caveats for DOS
commands--
1. Make sure that the DOS command begins with a $84 (^D).
2. Make sure that the ^D is the first character sent after a carriage
return ($8D/^M), otherwise, the command will be printed to the screen
and not executed.
3. If you are working with text files, you will need to reset the prompt
character byte so that DOS will think that a program is running. Or,
another solution is to run your 6502 routine from within an Applesoft
program (i.e. "10 CALL 32768").
Just as when you do this from Applesoft, each command must be preceeded by
the ^D and followed by a ^M. For instance, if I wanted my program to
display a directory, the fragment would look like this--
* Display disk directory
JSR PRINT ;Call neat-o print routine
HEX 8D84 ;^M^D
ASC "CATALOG" ;DOS command
HEX 8D00 ;^M, terminator
whatever comes next...
: You may be wondering why. Well, I am doing some exploration and learning
: about DOS, and trying to do something interesting and useful. It's a major
: sort of a hack on a game I like.
No, I don't wonder at all. It's a perfectly reasonable concept for an
Apple ][ person to want to know about. 8-)
: Basically, I am attempting to turn the ol' Apple II game AZTEC into a game
: that uses normal DOS/ProDOS binary files rather than using direct RWTS as
: it does now. This way it can run under DOS/ProDOS, instead of having to
: always boot it off its own custom 5.25" disk.
Hmmm...I'm not sure if the print tactic actually works under ProDOS, as
ProDOS does not trap display output. BASIC.SYSTEM does, but ProDOS, as I
understand it, does not. I think under ProDOS you need to communicate
with the MLI, but I know nothing about that...yet.
: I have figured out a great deal, and I now know how it gets/puts data on a
: disk It has five subroutines located in $320-3CF that do direct RWTS calls
: to read and write game data. The routines are: read/write sector,
: read/write 1 track, and read 2 tracks.
: I want to put in normal DOS commands in place of the current direct RWTS
: commands. Where it does a direct read of a sector, 1 track, or two tracks,
: I will have code that does a substitute BLOAD command, and where it
: writes a sector or one track, I will do a BSAVE command. This way Aztec
: will use the normal DOS catalog and track/sector lists, and would make
: it runnable under ProDOS as well.
: EXAMPLE--- Start track: 20 Start sector: 0 Address $0900
: For reading a sector, 1 track, or 2 tracks: BLOAD AZTEC-T20-S0,A$0900
: For writing a sector BSAVE AZTEC-T20-S0,A$0900,L$0100
: For writing 1 track BSAVE AZTEC-T20-S0,A$0900,L$1000
That will work for DOS 3.3; again, I am not so sure it would work under
ProDOS.
: I would greatly appreciate any help here, since I do not have access to
: Beneath Apple DOS, which would probably answer my question easily.
: And once the conversion is done, if I had Beneath Apple ProDOS, I could
: probably turn the binary code into a ProDOS-8 system program, so
: BASIC.SYSTEM isn't needed to run the game under ProDOS. :)
The easiest thing to do would probably be to write a loader as a SYSTEM
program (I think the only major difference between a SYSTEM program and a
BINARY file is that the SYS file *always* loads at $2000...there is
probably more than that, but then I have not yet done any 6502 under ProDOS)
Come to think of it, the command trick *won't* work under ProDOS, as there
are no commands in ProDOS...the commands are in BASIC.SYSTEM. I think in
ProDOS you have to use the MLI.
--Dave Althoff, ][.
--
/-\ _ _ *** Thanks for a great season!!! ***
/XXX\ /X\ /X\_ _ /X/|_ _ _ _____
/XXXXX\ /XXX\ _/XXXX\_ /X\ <#&/XXX\ /X\ /X\ /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_o==oXXXX\__/XXX\_/XXX\_/\_/XXXXXX