mirror of
https://github.com/pfusik/xasm.git
synced 2024-11-15 14:07:24 +00:00
xasm 2.6.0 release.
This commit is contained in:
parent
10c0c534ea
commit
aa5efc560f
274
compack.asm
274
compack.asm
@ -1,274 +0,0 @@
|
||||
; COMpack
|
||||
; b. Fox
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
ORG 100h
|
||||
include 'fox.mak'
|
||||
start:
|
||||
; db 1024 dup(0) ;4 self-packing
|
||||
|
||||
inplen = 24000
|
||||
outlen = 27000
|
||||
|
||||
print hello
|
||||
mov di, 81h
|
||||
movzx cx, [di-1]
|
||||
jcxz usg
|
||||
mov al, ' '
|
||||
repe scasb
|
||||
je usg
|
||||
push cx di
|
||||
dec di
|
||||
inc cx
|
||||
mov al, '?'
|
||||
repne scasb
|
||||
pop di cx
|
||||
jne nousg
|
||||
|
||||
usg: print usgtxt
|
||||
int 20h
|
||||
|
||||
getfil: lea si, [di-1]
|
||||
mov al, ' '
|
||||
repne scasb
|
||||
jne noout1
|
||||
dec di
|
||||
noout1: mov cx, di
|
||||
sub cx, si
|
||||
mov di, offset fname
|
||||
rep movsb
|
||||
mov bx, di
|
||||
srchex: dec bx
|
||||
cmp [byte bx], '\'
|
||||
je addext
|
||||
cmp [byte bx], '.'
|
||||
je extexs
|
||||
cmp bx, offset fname
|
||||
ja srchex
|
||||
addext: mov ax, 'c.'
|
||||
stosw
|
||||
mov ax, 'mo'
|
||||
stosw
|
||||
extexs: mov [word di], 0a0dh
|
||||
mov [byte di+2], '$'
|
||||
print namtxt
|
||||
print fname
|
||||
mov [byte di], 0
|
||||
rts: ret
|
||||
|
||||
smartdisk
|
||||
|
||||
nousg: print srctxt
|
||||
call getfil
|
||||
push si
|
||||
|
||||
fopen
|
||||
mov cx, inplen
|
||||
fread inpbuf
|
||||
mov dx, offset lontxt
|
||||
cmp ax, inplen
|
||||
je panic
|
||||
push ax
|
||||
add [filend], ax
|
||||
fclose
|
||||
pop cx
|
||||
|
||||
mov dx, offset emptxt
|
||||
jcxz panic
|
||||
mov di, offset inpbuf
|
||||
xor al, al
|
||||
repe scasb
|
||||
jne spox
|
||||
panic: print
|
||||
int 20h
|
||||
|
||||
spox: dec di
|
||||
push di
|
||||
mov [filbgn], di
|
||||
sub di, offset inpbuf
|
||||
add [destad], di
|
||||
add [reljad], di
|
||||
lda cx
|
||||
inc ax
|
||||
call prilen
|
||||
|
||||
pop bx
|
||||
mov si, offset firflg
|
||||
mov di, offset outbuf
|
||||
|
||||
pack1: push si di
|
||||
mov ax, 1
|
||||
mov bp, [filend]
|
||||
lea si, [bx-0ffh]
|
||||
cmp si, [filbgn]
|
||||
jnb pack2
|
||||
mov si, [filbgn]
|
||||
cmp si, bx
|
||||
je packn
|
||||
|
||||
pack2: mov di, bx
|
||||
mov cx, bp
|
||||
sub cx, bx
|
||||
push si
|
||||
repe cmpsb
|
||||
pop si
|
||||
je pack3
|
||||
dec di
|
||||
pack3: mov cx, di
|
||||
sub cx, bx
|
||||
cmp cx, ax
|
||||
jbe pack4
|
||||
lda cx
|
||||
mov dx, si
|
||||
pack4: inc si
|
||||
cmp si, bx
|
||||
jb pack2
|
||||
|
||||
packn: pop di si
|
||||
mov bp, ax
|
||||
sta cx
|
||||
mov ax, 1
|
||||
|
||||
putfl1: cmp cx, 2
|
||||
rcl [byte si], 1
|
||||
jnc putfl2
|
||||
mov si, di
|
||||
stosb
|
||||
putfl2: loop putfl1
|
||||
|
||||
cmp bp, ax
|
||||
mov al, [bx]
|
||||
je putbyt
|
||||
mov al, dl
|
||||
sub al, bl
|
||||
putbyt: stosb
|
||||
mov ah, 1
|
||||
cmp [si], ah
|
||||
jne swpflg
|
||||
mov [si], ax
|
||||
inc si
|
||||
swpflg: add bx, bp
|
||||
cmp bx, [filend]
|
||||
jb pack1
|
||||
|
||||
shl [byte si], 1
|
||||
jnc corfl1
|
||||
mov al, 80h
|
||||
stosb
|
||||
jmp corfl3
|
||||
corfl1: stc
|
||||
corfl2: rcl [byte si], 1
|
||||
jnc corfl2
|
||||
corfl3: rcl [firflg], 1 ;+
|
||||
xor al, al
|
||||
stosb
|
||||
|
||||
sub di, offset depack
|
||||
mov [filend], di
|
||||
|
||||
print pkdtxt
|
||||
pop di
|
||||
mov cx, 81h
|
||||
add cl, [80h]
|
||||
sub cx, di
|
||||
jz nowri
|
||||
mov al, ' '
|
||||
repe scasb
|
||||
je nowri
|
||||
mov ax, [filend]
|
||||
inc ah
|
||||
cmp ax, [destad]
|
||||
ja nospac
|
||||
|
||||
call getfil
|
||||
fcreate
|
||||
mov cx, [filend]
|
||||
fwrite depack
|
||||
fclose
|
||||
|
||||
nowri: mov ax, [filend]
|
||||
|
||||
prilen: mov di, offset lenlst
|
||||
mov bx, 10
|
||||
outnm1: xor dx, dx
|
||||
div bx
|
||||
add dl, '0'
|
||||
outnm2: mov [di], dl
|
||||
dec di
|
||||
test ax, ax
|
||||
jnz outnm1
|
||||
mov dl, ' '
|
||||
cmp di, offset lennum
|
||||
jnb outnm2
|
||||
print lentxt
|
||||
ret
|
||||
|
||||
nospac: mov dx, offset zertxt
|
||||
dos 9
|
||||
jmp nowri
|
||||
|
||||
hello db 'COMpack 1.0 by Fox/Taquart',eot
|
||||
usgtxt db 'This is FREEWARE packer for .COM programs.',eol
|
||||
db 'Syntax:',eol
|
||||
db 'COMPACK inpfile [outfile]',eol
|
||||
db '"inpfile" specifies source path\filename',eol
|
||||
db '"outfile" specifies target path\filename',eol
|
||||
db 'The ".COM" extension of filename is default and you don''t have to write it',eol
|
||||
db 'If you don''t give "outfile" parameter, no file will be saved',eol
|
||||
db 'and you can only watch the results of packing',eol
|
||||
zertxt db 'If you want the file saved, you must compile some zero bytes at the beginning',eol
|
||||
db 'of file to reserve the space for packed data. The code should immediately',eol
|
||||
db 'follow the zeros.',eot
|
||||
|
||||
srctxt db 'Source file:',eot
|
||||
pkdtxt db 'Packed file:',eot
|
||||
namtxt db ' Name: $'
|
||||
lentxt db 'Length: '
|
||||
lennum db ' '
|
||||
lenlst db ' bytes',eot
|
||||
emptxt db 'File is empty!',eot
|
||||
lontxt db 'File is too long!',eot
|
||||
smarterr
|
||||
|
||||
filbgn dw inpbuf
|
||||
filend dw inpbuf
|
||||
|
||||
depack: mov si, offset packed-depack+100h
|
||||
mov di, 100h
|
||||
destad = word $-2
|
||||
mov al, 1
|
||||
firflg = byte $-1
|
||||
xor cx, cx
|
||||
dep1: movsb
|
||||
dec cx
|
||||
dep2: inc cx
|
||||
dep3: add al, al
|
||||
jnz dep4
|
||||
lodsb
|
||||
adc al, al ;+
|
||||
dep4: jnc dep2
|
||||
jcxz dep1
|
||||
sbb bx, bx ;+
|
||||
and bl, [si]
|
||||
db 0fh,84h ;jz near
|
||||
reljad dw depack-reljmp
|
||||
reljmp: inc si
|
||||
inc cx
|
||||
push si
|
||||
lea si, [di+bx]
|
||||
rep movsb
|
||||
pop si
|
||||
jmp dep3
|
||||
packed:
|
||||
|
||||
outbuf db outlen dup(?)
|
||||
|
||||
fname:
|
||||
|
||||
inpbuf db inplen dup(?)
|
||||
|
||||
ENDS
|
||||
END start
|
BIN
doc/6502proc.gif
BIN
doc/6502proc.gif
Binary file not shown.
Before Width: | Height: | Size: 586 B |
171
doc/editors.htm
171
doc/editors.htm
@ -1,66 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Configuring editors for X-Assembler</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<H2>How to configure a text editor for convenient use of X-Assembler</H2>
|
||||
This document describes, how to setup a text editor to:
|
||||
<UL>
|
||||
<LI> highlight X-Assembler mnemonics
|
||||
<LI> invoke the assembler with a single keystroke
|
||||
<LI> place the cursor where an assembly error occured
|
||||
</UL>
|
||||
Of course these features are not available in <I>Windows Notepad</I>, so you must
|
||||
pick another text editor. Fortunately there are many general-purpose text
|
||||
editors for Windows. I'll fucus on three:
|
||||
<UL>
|
||||
<LI> <I>EditPlus</I> (<A HREF="http://www.editplus.com">www.editplus.com</A>)
|
||||
<LI> <I>ConTEXT</I> (<A HREF="http://www.fixedsys.com/context">www.fixedsys.com/context</A>)
|
||||
<LI> <I>Code-Genie</I> (<A HREF="http://www.code-genie.com">www.code-genie.com</A>)
|
||||
</UL>
|
||||
All of these have similar features. <I>EditPlus</I> is very good, unfortunately it is
|
||||
shareware (you have to pay $30). The other editors are freeware. Personally
|
||||
I prefer <I>Code-Genie</I>, which offers unique feature of editing binary files.<P>
|
||||
<H3>Highlighting X-Assembler mnemonics</H3>
|
||||
In the <TT>syntax</TT> subdirectory you'll find X-Assembler syntax definitions for all
|
||||
these editors.
|
||||
<UL>
|
||||
<LI> Installation for <I>EditPlus</I>:
|
||||
Select <B>Tools/Preferences</B>, then <B>Files/Settings & syntax</B>,
|
||||
then <B>Add</B>. Type <B>Description</B> (<TT>X-Assembler</TT>), <B>File extensions</B>
|
||||
(<TT>asx</TT>), click <B>...</B> next to <B>Syntax file</B> and locate
|
||||
the <TT>xasm.stx</TT> file. Then click <B>Syntax colors</B> and select your
|
||||
favourite colors.
|
||||
<LI> Installation for <I>ConTEXT</I>: Just copy <TT>X-Assembler.chl</TT>
|
||||
to <TT>Highlighters</TT> subdirectory in the <I>ConTEXT</I> directory.
|
||||
<LI> Installation for <I>Code-Genie</I>:
|
||||
Copy <TT>X-Assembler.cgsyn</TT> to <TT>syn</TT> subdirectory in the <I>Code-Genie</I>
|
||||
directory. Edit <TT>cgenie.conf</TT>, you can do it by selecting
|
||||
<B>View/Settings</B>. Type:<BR>
|
||||
<NOBR><TT>DefaultSyntax x-assembler asx</TT></NOBR><BR>
|
||||
near other <TT>DefaultSyntax</TT> lines.
|
||||
</UL>
|
||||
<H3>Single-keystroke assembly</H3>
|
||||
<UL>
|
||||
<LI> <I>EditPlus</I>: Select <B>Tools/Configure User Tools</B>.
|
||||
Then click <B>Add Tool</B>, type <B>Menu text</B> (<TT>xasm</TT>), <B>command</B>
|
||||
(path to <TT>xasm.exe</TT>), <B>Argument</B> (<TT>$(FilePath)</TT>) and <B>Initial directory</B>
|
||||
(<TT>$(FileDir)</TT>). Check <B>Capture output</B>.
|
||||
<LI> <I>ConTEXT</I>: Select <B>Options/Environment Options</B>, then
|
||||
the <B>Execute Keys</B> tab. Click <B>Add</B>, type <TT>asx</TT>, click
|
||||
e.g. <B>F9</B>, locate <TT>xasm.exe</TT> by pressing the <TT>...</TT> button
|
||||
in the top-right corner. Type <B>Start in</B> (<TT>%p</TT>)
|
||||
and <B>parameters</B> (<TT>%n</TT>). Check <B>Use short DOS names</B>
|
||||
and <B>Capture console output</B>.
|
||||
Type <B>Compiler output parser rule</B> (<TT>%n (%l)</TT>).
|
||||
<LI> <I>Code-Genie</I>: Select <B>View/Settings</B>, type:<BR>
|
||||
<NOBR><TT>AddUserTool xasm xasm.exe /p\s$FP CaptureOutput $FD</TT></NOBR><BR>
|
||||
near other <TT>AddUserTool</TT> lines (if <TT>xasm.exe</TT> is not on your
|
||||
<TT>PATH</TT>, then you must type full path to it).
|
||||
</UL>
|
||||
<H3>Placing the cursor where an assembly error occured</H3>
|
||||
This works same for all these three editors: just double-click the line
|
||||
with the error message.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Configuring editors for xasm</title>
|
||||
<meta name="Author" content="Piotr Fusik"/>
|
||||
</head>
|
||||
<body>
|
||||
<h2>How to configure a text editor for a convenient use of xasm</h2>
|
||||
<p>This document describes, how to setup a text editor to:</p>
|
||||
<ul>
|
||||
<li>highlight xasm mnemonics</li>
|
||||
<li>invoke the assembler with a single keystroke</li>
|
||||
<li>place the cursor where an assembly error occured</li>
|
||||
</ul>
|
||||
<p>Of course these features are not available in the <i>Windows Notepad</i>,
|
||||
so you must pick another text editor. Fortunately there are many
|
||||
general-purpose text editors for Windows. I'll fucus on four of them:</p>
|
||||
<ul>
|
||||
<li><i>EditPlus</i>
|
||||
(<a href="http://www.editplus.com">www.editplus.com</a>)</li>
|
||||
<li><i>ConTEXT</i>
|
||||
(<a href="http://www.fixedsys.com/context">www.fixedsys.com/context</a>)</li>
|
||||
<li><i>Code-Genie</i>
|
||||
(<a href="http://www.code-genie.com">www.code-genie.com</a>)</li>
|
||||
<li><i>PSPad</i>
|
||||
(<a href="http://pspad.zde.cz">pspad.zde.cz</a>)</li>
|
||||
</ul>
|
||||
<p>All of these have similar features. Personally I prefer
|
||||
<i>Code-Genie</i>.</p>
|
||||
<h3>Highlighting xasm mnemonics</h3>
|
||||
<p>In the <tt>syntax</tt> subdirectory you'll find xasm syntax definitions
|
||||
for all of these editors.</p>
|
||||
<ul>
|
||||
<li>Installation for <i>EditPlus</i>:
|
||||
Select <b>Tools/Preferences</b>, then <b>Files/Settings & syntax</b>,
|
||||
then <b>Add</b>. Type <b>Description</b> (<tt>xasm</tt>),
|
||||
<b>File extensions</b> (<tt>asx</tt>), click <b>...</b> next to <b>Syntax
|
||||
file</b> and locate the <tt>xasm.stx</tt> file. Then click
|
||||
<b>Syntax colors</b> and select your favourite colors.</li>
|
||||
<li>Installation for <i>ConTEXT</i>: Just copy <tt>xasm.chl</tt>
|
||||
to the <tt>Highlighters</tt> subdirectory of the <i>ConTEXT</i>
|
||||
directory.</li>
|
||||
<li>Installation for <i>Code-Genie</i>:
|
||||
Copy <tt>xasm.cgsyn</tt> to the <tt>syn</tt> subdirectory in the
|
||||
<i>Code-Genie</i> directory. Edit <tt>cgenie.conf</tt>, you can do it by
|
||||
selecting <b>View/Settings</b>. Type:<br/>
|
||||
<tt>DefaultSyntax xasm asx</tt><br/>
|
||||
near other <tt>DefaultSyntax</tt> lines.</li>
|
||||
<li>Installation for <i>PSPad</i>: Copy <tt>xasm.ini</tt> to the
|
||||
<tt>Syntax</tt> subdirectory of the <i>PSPad</i> directory. Edit
|
||||
<tt>PSPad.ini</tt>. In the <tt>[Config]</tt> section set:<br/>
|
||||
<tt>UserHighLighterName=xasm</tt><br/>
|
||||
In the <tt>[General]</tt> section set:
|
||||
<pre>Filter=xasm (*.asx)|*.asx
|
||||
HLTabWidth=0
|
||||
IndentChar=
|
||||
UnIndentChar=
|
||||
Comment=0000800080000005000
|
||||
Identifier=8000000880000005000
|
||||
Key=00FF000080000005000
|
||||
Label=0000000080000005000
|
||||
Number=8000000880000005000
|
||||
Preprocessor=0080800080000005010
|
||||
Reserved word=00FF000080000005000
|
||||
Space=0080800080000005000
|
||||
String=0080008080000005000
|
||||
Symbol=8000000880000005000
|
||||
</pre></li>
|
||||
</ul>
|
||||
<h3>Single-keystroke assembly</h3>
|
||||
<ul>
|
||||
<li><i>EditPlus</i>: Select <b>Tools/Configure User Tools</b>.
|
||||
Then click <b>Add Tool</b>, type <b>Menu text</b> (<tt>xasm</tt>),
|
||||
<b>command</b> (path to <tt>xasm.exe</tt>), <b>Argument</b>
|
||||
(<tt>$(FilePath)</tt>) and <b>Initial directory</b>
|
||||
(<tt>$(FileDir)</tt>). Check <b>Capture output</b>.</li>
|
||||
<li> <i>ConTEXT</i>: Select <b>Options/Environment Options</b>, then
|
||||
the <b>Execute Keys</b> tab. Click <b>Add</b>, type <tt>asx</tt>, click
|
||||
e.g. <b>F9</b>, locate <tt>xasm.exe</tt> by pressing the <tt>...</tt> button
|
||||
in the top-right corner. Type <b>Start in</b> (<tt>%p</tt>)
|
||||
and <b>parameters</b> (<tt>%n</tt>). Check <b>Use short DOS names</b>
|
||||
and <b>Capture console output</b>.
|
||||
Type <b>Compiler output parser rule</b> (<tt>%n (%l)</tt>).</li>
|
||||
<li><i>Code-Genie</i>: Select <b>View/Settings</b>, type:<br/>
|
||||
<tt>AddUserTool xasm xasm.exe /p\s$FP CaptureOutput $FD</tt><br/>
|
||||
near other <tt>AddUserTool</tt> lines (if <tt>xasm.exe</tt> is not on your
|
||||
<tt>PATH</tt>, then you must type full path to it).</li>
|
||||
<li><i>PSPad</i>: Edit the <tt>[General]</tt> section of <tt>PSPad.ini</tt>:
|
||||
<pre>Compilator File=C:\U\XASM.EXE
|
||||
Compilator Param=/q /o:%Dir%%Name%.xex %File%
|
||||
Compilator LOG=
|
||||
Compilator Run=C:\Atari\a800win\Atari800Win.exe -run %Dir%%Name%.xex
|
||||
Compilator Help=
|
||||
Compilator SaveAll=1
|
||||
Compilator ParsLog=%F (%L) *
|
||||
Compilator Capture=1
|
||||
</pre>
|
||||
(replace the paths to xasm and the emulator).</li>
|
||||
</ul>
|
||||
<h3>Placing the cursor where an assembly error occured</h3>
|
||||
<p>This works same for all these four editors: just double-click the line
|
||||
with the error message.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
30
doc/faq.htm
30
doc/faq.htm
@ -1,30 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm FAQ</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<H2>Frequently Asked Questions</H2>
|
||||
<B>What is xasm?</B><BR>
|
||||
xasm is a set of a few tools for developing software for 8-bit Atari
|
||||
computers using a PC computer. It is mainly for people who are familiar
|
||||
with Quick Assembler, which runs directly on Atari.
|
||||
<P><B>I want to run xasm on my Amiga / Atari ST / Mac / ...</B><BR>
|
||||
Unfortunately xasm is written in x86 assembly language, so it is
|
||||
not portable.
|
||||
<P><B>Why xasm, not X-ASM as in previous versions?</B><BR>
|
||||
It's easier to pronounce. ;-)
|
||||
<P><B>Why 'second final edition'?</B><BR>
|
||||
<I>Quote from FAQ in version 2.4, regarding 'final edition':</I><BR>
|
||||
Because I don't plan adding any new features. xasm is already a very
|
||||
sophisticated tool, much more powerful than Quick Assembler.
|
||||
Of course, it does not mean there won't be any new releases.
|
||||
Very likely there will be bug fixes.<BR>
|
||||
<I>Comment to 'second':</I><BR>
|
||||
I found that new features are quite useful and easy to implement. :-)
|
||||
<P><B>What about supporting other 6502-based machines, other processors (65816 etc.) ?</B><BR>
|
||||
xasm is not a universal 6502 cross-assembler. If you need a portable
|
||||
cross-assembler (and maybe even an excellent C compiler), then visit
|
||||
<A HREF="http://www.cc65.org">www.cc65.org</A>.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,46 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm 2.5.2 second final edition</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<TABLE ALIGN=center WIDTH=70%><TR><TD>
|
||||
<CENTER>
|
||||
<IMG SRC="6502proc.gif" ALT="intel outside - 6502 processor">
|
||||
<BR CLEAR=all>
|
||||
<H1>xasm 2.5.2 second final edition</H1>
|
||||
Copyright (c) 1998-2002 by <A HREF="mailto:fox@scene.pl">Piotr Fusik</A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
<P>this package contains following utilities (click program name for documentation):
|
||||
<P>
|
||||
<TABLE ALIGN=center BGCOLOR=white>
|
||||
<TR><TD><FONT COLOR=black><B>Name</B></FONT></TD>
|
||||
<TD><FONT COLOR=black><B>Description</B></FONT></TD></TR>
|
||||
<TR><TD BGCOLOR=black><NOBR><A HREF="xasm.htm">X-Assembler</A></NOBR></TD>
|
||||
<TD BGCOLOR=black>6502 cross-assembler</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xboot.htm">X-BOOT</A></TD>
|
||||
<TD BGCOLOR=black>Converts Atari executables to disk images</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xhead.htm">X-HEAD</A></TD>
|
||||
<TD BGCOLOR=black>Prints headers of an Atari executable file</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xload.htm">X-LOAD</A></TD>
|
||||
<TD BGCOLOR=black>Loads an executable file to an Atari computer via the SIO2PC interface</TD></TR>
|
||||
</TABLE>
|
||||
<P>other documents:
|
||||
<UL>
|
||||
<LI> <A HREF="editors.htm">How to configure a text editor for convenient use of X-Assembler</A><BR>
|
||||
<LI> <A HREF="faq.htm">Frequently Asked Questions</A><P>
|
||||
</UL>
|
||||
<P>
|
||||
xasm home page:
|
||||
<A HREF="http://xasm.atari.org">http://xasm.atari.org</A>
|
||||
<P>
|
||||
<HR>
|
||||
<P>Permission is granted to anyone to use this software and its documentation
|
||||
for any purpose, including commercial applications, and redistribute it
|
||||
freely in its original form. The author makes no representations about
|
||||
the suitability of this software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
</TD></TR></TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
1455
doc/xasm.htm
1455
doc/xasm.htm
File diff suppressed because it is too large
Load Diff
@ -1,98 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-BOOT 5.0</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-BOOT version 5.0</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool converts Atari executable files to disk images (ATR).
|
||||
Since its first version, X-BOOT lost significance, because now you
|
||||
can load an executable directly to Atari (e.g. using
|
||||
<A HREF="xload.htm">X-LOAD</A>), and the emulators (e.g.
|
||||
<A HREF="http://www.a800win.atari-area.prv.pl">Atari800Win PLus</A>).
|
||||
However, X-BOOT may still be useful, especially when using
|
||||
professional loader.
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 5.0</H4>
|
||||
<UL>
|
||||
<LI> long file names support
|
||||
<LI> more flexible syntax: both <TT>obxmask atrfile</TT>
|
||||
and <TT>obxfile atrpath</TT> can be used
|
||||
<LI> internal write protection flag (supported by APE and Atari800)
|
||||
set in generated disk images
|
||||
<LI> headers with end address less than start allowed
|
||||
<LI> Unix-like <TT>-p</TT> option allowed
|
||||
</UL>
|
||||
<H4>Version 4.0</H4>
|
||||
<UL>
|
||||
<LI> wildcards support - now you can convert a set of files
|
||||
<LI> .ATR name not required - name can be taken from executable
|
||||
<LI> no length limit - files longer than 60k allowed
|
||||
<LI> truncated executables are supported
|
||||
<LI> checking for memory conflicts
|
||||
<LI> better errors handling
|
||||
</UL>
|
||||
<H4>Version 3.2</H4>
|
||||
<UL>
|
||||
<LI> .OBX is default extension of Atari executable
|
||||
</UL>
|
||||
<H4>Version 3.1</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
Syntax for invoking X-BOOT is following:<P>
|
||||
<TT>XBOOT [/p] obxfiles [atrpath][atrfile]</TT><P>
|
||||
Parameters in brackets are optional.<P>
|
||||
If file name extension is omitted, the default .OBX or .ATR is added.
|
||||
If no <TT>atrpath</TT> is given, disk images are written by default in
|
||||
the directory where executables are.<P>
|
||||
If file name contains spaces, you should enclose it in quotation marks.<P>
|
||||
<TT>/p</TT> switch (or equivalent <TT>-p</TT>) forces writing 'professional
|
||||
loader', which allows you to load code/data intro the RAM under ROM and starts
|
||||
the program with disabled ROM and interrupts. By default, standard loader is
|
||||
used, which can load any Atari executable not demanding DOS nor any special
|
||||
loader.<P>
|
||||
Both loaders disable Atari Basic, so you don't need to hold the OPTION key
|
||||
while booting.<P>
|
||||
Below are some examples:<P>
|
||||
<DL>
|
||||
<DT><TT>XBOOT -p test</TT>
|
||||
<DD>Converts <TT>test.obx</TT> to <TT>test.atr</TT> in current directory
|
||||
using professional loader.
|
||||
<DT><TT>XBOOT d:\games\*.xex \atrs\</TT>
|
||||
<DD>Converts all files in <TT>d:\games</TT> with <TT>.xex</TT> extension
|
||||
and writes disk images to directory <TT>\atrs</TT> on current drive
|
||||
using standard loader.
|
||||
<DT><TT>XBOOT "c:\test\Very Long File Name.AtariExecutable" /p</TT>
|
||||
<DD>Converts <NOBR><TT>c:\test\Very Long File Name.AtariExecutable</TT></NOBR> to
|
||||
<NOBR><TT>c:\test\Very Long File Name.atr</TT></NOBR> using professional loader.
|
||||
<DT><TT>XBOOT d:* /p .</TT>
|
||||
<DD>Converts all .OBX files in current directory on <TT>d:</TT>
|
||||
to current directory on current drive using professional loader.
|
||||
</DL>
|
||||
<HR>
|
||||
<H2>DETAILS</H2>
|
||||
Produced ATR is single density and as short as possible.
|
||||
Loader occupies one boot sector.<P>
|
||||
X-BOOT does not store the executable file in ATR as an Atari file.
|
||||
You can't read it from an Atari DOS nor extract it somehow or other.
|
||||
You can only run it by booting.<P>
|
||||
For more details, read source files of the loaders:
|
||||
<UL>
|
||||
<LI>Standard: <A HREF="xbootstd.asx">XBOOTSTD.ASX</A>
|
||||
<LI>Professional: <A HREF="xbootpro.asx">XBOOTPRO.ASX</A>
|
||||
</UL>
|
||||
Loaders are so simple that they even do not detect end of file. Instead,
|
||||
they are modified when end of file is reached. The disk image contains one
|
||||
additional block, which doesn't belong to the executable file, but alters
|
||||
the loader to run the program instead of initializing.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,64 +0,0 @@
|
||||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Reads file from ATR prepared with X-BOOT.
|
||||
* Professional version - can load file under ROM.
|
||||
* Interrupts and ROM are disabled when running loaded program.
|
||||
|
||||
opt h-
|
||||
org $480
|
||||
|
||||
bufr equ $400 128-byte buffer
|
||||
|
||||
tp equ $43 Temporary byte
|
||||
vc equ $44 Start and end vectors (4 bytes)
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot,$e477) Boot header
|
||||
mva #0 $22f Make screen blank...
|
||||
mva #$52 $2c8 ... and pink ;)
|
||||
lda 20 Wait for VBLK
|
||||
cmp:req 20
|
||||
mwa #rts $2e0 Set default run vector
|
||||
dta b({lda a:0}) Skip two bytes
|
||||
secrts sec Return with error
|
||||
rts rts
|
||||
mva:pha >rts $2e3 Set init address...
|
||||
mva:pha <rts $2e2 ... and put return address on stack
|
||||
ldx #-5 Load header
|
||||
hput sta vc+4,x+ Store byte of header
|
||||
stx tp
|
||||
next inc bufx Increment buffer index
|
||||
bpl getx Branch if within buffer
|
||||
inw $30a Increment sector number
|
||||
mva #$ff ^31 Turn ROM on
|
||||
lsr ^4e Enable NMI interrupts
|
||||
cli Enable IRQ interrupts
|
||||
jsr $e453 Read sector
|
||||
bmi secrts Exit on error
|
||||
sei Disable IRQ interrupts
|
||||
inc ^4e Disable NMI interrupts
|
||||
dec ^31 Turn ROM off
|
||||
asl bufx Change $80 to $00
|
||||
getx lda bufr+$7f Get byte from buffer
|
||||
bufx equ *-2 Buffer index
|
||||
ldx tp Check if header or block data
|
||||
bne hput Branch to store header
|
||||
sta (vc,x) Store block data
|
||||
inw vc Increment vector
|
||||
lda vc+2 Check if end of block reached
|
||||
cmp vc
|
||||
lda vc+3
|
||||
sbc vc+1
|
||||
bcs next No: read next byte
|
||||
mva #3 ^2f Yes: Reset POKEY...
|
||||
init jmp ($2e2) ... and call init routine
|
||||
|
||||
dta c'5.0p' Unused boot sector space
|
||||
ert *<>boot+$80 Exactly 128 bytes should be used
|
||||
|
||||
* X-BOOT adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
@ -1,63 +0,0 @@
|
||||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Reads file from ATR prepared with X-BOOT.
|
||||
* Standard loader - ROM and interrupts enabled.
|
||||
|
||||
opt h-
|
||||
org $780
|
||||
|
||||
bufr equ $700 128-byte buffer
|
||||
|
||||
tp equ $43 Temporary byte
|
||||
vc equ $44 Start and end vectors (4 bytes)
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot,$e477) Boot header
|
||||
txtpos equ 215
|
||||
ldy #txtpos Print text
|
||||
print mva text-txtpos,y ($58),y+
|
||||
cpy #txtpos+txtlen
|
||||
bcc print
|
||||
mwa #rts $2e0 Set default run vector
|
||||
mva >bufr $305 Set buffer address
|
||||
mva #$ff ^31 Turn BASIC off
|
||||
dta b({lda a:0}) Skip two bytes
|
||||
secrts sec Return with error
|
||||
rts rts
|
||||
mva:pha >rts $2e3 Set init address...
|
||||
mva:pha <rts $2e2 ... and put return address on stack
|
||||
ldx #-5 Load header
|
||||
hput sta vc+4,x+ Store byte of header
|
||||
stx tp
|
||||
next inc bufx Increment buffer index
|
||||
bpl getx Branch if within buffer
|
||||
inw $30a Increment sector number
|
||||
jsr $e453 Read sector
|
||||
bmi secrts Exit on error
|
||||
asl bufx Change $80 to $00
|
||||
getx lda bufr+$7f Get byte from buffer
|
||||
bufx equ *-2 Buffer index
|
||||
ldx tp Check if header or block data
|
||||
bne hput Branch to store header
|
||||
sta (vc,x) Store block data
|
||||
inw vc Increment vector
|
||||
lda vc+2 Check if end of block reached
|
||||
cmp vc
|
||||
lda vc+3
|
||||
sbc vc+1
|
||||
bcs next No: read next byte
|
||||
mva #3 ^2f Yes: Reset POKEY...
|
||||
init jmp ($2e2) ... and call init routine
|
||||
|
||||
text dta d'Loading... '
|
||||
txtlen equ *-text
|
||||
|
||||
dta c'5.0' Unused boot sector space
|
||||
ert *<>boot+$80 Exactly 128 bytes should be used
|
||||
|
||||
* X-BOOT adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
@ -1,45 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-HEAD 1.1</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-HEAD version 1.1</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool prints headers of an Atari executable file.
|
||||
It shows, into which memory areas the file loads,
|
||||
and what are init and run addresses.<P>
|
||||
<B>Important note:</B> X-HEAD is an extremely simple tool. Jindrich Kubec
|
||||
wrote a tool with similar purpose, but much more features (disassembly
|
||||
in different formats, including X-Assembler), called ChkExe.
|
||||
You can find it on
|
||||
<A HREF="http://jindroush.atari.org">http://jindroush.atari.org</A>.
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 1.1</H4>
|
||||
<UL>
|
||||
<LI> .OBX is default extension of Atari executable
|
||||
</UL>
|
||||
<H4>Version 1.0</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
Simply run X-HEAD with executable filename. No options are supported.<P>
|
||||
X-HEAD will read the file and display its headers in following format:
|
||||
<PRE> bbbb-eeee xxxx</PRE>
|
||||
where <TT>bbbb</TT> is the begin, <TT>eeee</TT> - the end of the block,
|
||||
and <TT>xxxx</TT> is the execution (init or run) address.<P>
|
||||
The summary includes:<BR>
|
||||
<TT>xxxx bytes</TT> - length of file, including headers<BR>
|
||||
<TT>xxxx blocks</TT> - number of headers<BR>
|
||||
<TT>xxxx inits</TT> - number of init blocks (<TT>02e2-02e3</TT>)<BR>
|
||||
<TT>xxxx modules</TT> - number of <TT>FFFF</TT> headers (one at the beginning is required)<P>
|
||||
All displayed numbers are hexadecimal, of course.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,85 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-LOAD 1.1</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-LOAD version 1.1</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool may be used to load an Atari executable file, stored on the PC,
|
||||
into a real Atari computer, via the SIO2PC interface.
|
||||
Only data input and data output lines are used, so X-LOAD should work
|
||||
with all types of the interface.<P>
|
||||
It is experimental version. I'm not sure if it will work
|
||||
with every hardware. I've noticed it is not stable and sometimes
|
||||
transmission can hang or distortions in loaded data may appear.
|
||||
The reason is that there is no error-checking, while transmission is
|
||||
fast (57.6 kbits/sec).<P>
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 1.1</H4>
|
||||
<UL>
|
||||
<LI> files with no explicit run address are started from the beginning
|
||||
of the first block
|
||||
</UL>
|
||||
<H4>Version 1.0</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
You should pass as the parameters the executable file name and optionally
|
||||
the options:<P>
|
||||
<DL>
|
||||
<DT><TT>/1</TT> - <TT>/4</TT>
|
||||
<DD>Serial port number. Default is 2.<P>
|
||||
<DT><TT>/p</TT>
|
||||
<DD>Force using 'professional loader', which allows you to load code/data
|
||||
into the RAM under ROM ($c000-$ffff) and starts the program with disabled
|
||||
ROM and interrupts. By default, standard loader is used, which can load
|
||||
any Atari executable not demanding DOS or any special loader.<P>
|
||||
</DL>
|
||||
After you run X-LOAD, you only have to boot your Atari and the program
|
||||
will be loaded and run.<P>
|
||||
While loading, PC prints memory locations, which the program loads into.<P>
|
||||
After the program is loaded and run, X-LOAD terminates. You may exit it
|
||||
earlier at any time by pressing the ESC key.<P>
|
||||
|
||||
<HR>
|
||||
<H2>DETAILS</H2>
|
||||
First, X-LOAD sends a byte to Atari and then waits until the Atari is booted.
|
||||
The byte can be used to detect from Atari, that PC is ready for transmission.
|
||||
When you are testing your program, you may code periodic checking
|
||||
if a byte was received, and performing cold reset in that case.
|
||||
So you don't need to touch your Atari to run your program on it.<P>
|
||||
While booting, X-LOAD accepts two commands for disk drive 1:<P>
|
||||
<UL>
|
||||
<LI> <TT>'S'</TT> - read status. Used by the Atari OS to check presence
|
||||
of a disk drive.
|
||||
<LI> <TT>'R'</TT> - read sector (only first). Used to transfer the loader.
|
||||
</UL>
|
||||
After the Atari receives and runs the loader, the transmission runs at 57600
|
||||
bits/sec.<P>
|
||||
The transmission protocol is very simple: Atari sends a byte to inform that
|
||||
it is ready for receiving data. Then PC sends a 3-byte header and a block
|
||||
of data. First two bytes of the header are the high and the low byte of the
|
||||
address of the last byte in the block minus $ff. Third byte equals low byte
|
||||
of ($100-block_length). Then come block data, which are loaded directly
|
||||
into their memory locations.
|
||||
For more details, view source files of the loaders:
|
||||
<UL>
|
||||
<LI>Standard: <A HREF="xloadstd.asx">XLOADSTD.ASX</A>
|
||||
<LI>Professional: <A HREF="xloadpro.asx">XLOADPRO.ASX</A>
|
||||
</UL>
|
||||
You may have noticed that X-LOAD is somehow similar to X-BOOT, which also
|
||||
has two loaders. The main difference is that X-BOOT loaders use system
|
||||
routines to get sectors at regular speed of 19200 bits/sec.
|
||||
They use sector buffer and require some low memory locations not to be altered
|
||||
because of Atari operating system. In this respect X-LOAD loaders are better,
|
||||
because they allow loading into whole memory except for the loader code.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,60 +0,0 @@
|
||||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Receives file from X-LOAD via SIO2PC interface.
|
||||
* Professional version - can load file under ROM.
|
||||
* Interrupts and ROM are disabled when running loaded program.
|
||||
|
||||
opt h-
|
||||
org $400
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot) Boot header
|
||||
arts dta a(rts)
|
||||
|
||||
dta b({lda #$60}) Skip rts
|
||||
rts rts
|
||||
|
||||
sei Disable interrupts
|
||||
inc ^4e
|
||||
inc ^40 Make screen blank
|
||||
mva #$08 ^24 Set transmission speed
|
||||
mva #$00 ^26
|
||||
mva #$28 ^28
|
||||
sta ^29 Reset counters
|
||||
mva #$23 ^2f Send enable
|
||||
sta ^2d Send a byte
|
||||
wait sta ^4a Wait until sent
|
||||
asl @
|
||||
bcc wait
|
||||
mva #$13 ^2f Receive enable
|
||||
ldy #2
|
||||
head jsr get Receive address (high/low byte)
|
||||
sta stor,y
|
||||
mva arts-1,y $2e2-1,y Set init address
|
||||
pha Put return address on stack
|
||||
dey
|
||||
bne head
|
||||
jsr get Receive length (one byte)
|
||||
tax
|
||||
load jsr get Receive data
|
||||
stor sta a:0,x+ Store in memory
|
||||
bne load
|
||||
mva $10 ^2e Reset POKEY
|
||||
mva #3 ^2f
|
||||
init jmp ($2e2) Call init routine
|
||||
|
||||
get lda #$20 Function: Receive one byte
|
||||
sta ^2e Enable receive interrupt
|
||||
bit:rne ^2e Wait for interrupt request
|
||||
sty ^2e Disable receive interrupt
|
||||
lda ^2d Get byte
|
||||
rts
|
||||
|
||||
:boot+$80-* dta b(0) Padd with zeros to full sector
|
||||
|
||||
* X-LOAD adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
@ -1,60 +0,0 @@
|
||||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Receives file from X-LOAD via SIO2PC interface.
|
||||
* Standard loader - ROM and interrupts enabled while running loaded program.
|
||||
|
||||
opt h-
|
||||
org $700
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot) Boot header
|
||||
arts dta a(rts)
|
||||
|
||||
dta b({lda #$60}) Skip rts
|
||||
rts rts
|
||||
|
||||
sei Disable interrupts
|
||||
inc ^4e
|
||||
mva #$08 ^24 Set transmission speed
|
||||
mva #$00 ^26
|
||||
mva #$28 ^28
|
||||
sta ^29 Reset counters
|
||||
mva #$23 ^2f Send enable
|
||||
sta ^2d Send a byte
|
||||
wait sta ^4a Wait until sent
|
||||
asl @
|
||||
bcc wait
|
||||
mva #$13 ^2f Receive enable
|
||||
ldy #2
|
||||
head jsr get Receive address (high/low byte)
|
||||
sta stor,y
|
||||
mva arts-1,y $2e2-1,y Set init address
|
||||
pha Put return address on stack
|
||||
dey
|
||||
bne head
|
||||
jsr get Receive length (one byte)
|
||||
tax
|
||||
load jsr get Receive data
|
||||
stor sta a:0,x+ Store in memory
|
||||
bne load
|
||||
mva $10 ^2e Reset POKEY
|
||||
mva #3 ^2f
|
||||
lsr ^4e Enable interrupts
|
||||
cli
|
||||
init jmp ($2e2) Call init routine
|
||||
|
||||
get lda #$20 Function: Receive one byte
|
||||
sta ^2e Enable receive interrupt
|
||||
bit:rne ^2e Wait for interrupt request
|
||||
sty ^2e Disable receive interrupt
|
||||
lda ^2d Get byte
|
||||
rts
|
||||
|
||||
:boot+$80-* dta b(0) Padd with zeros to full sector
|
||||
|
||||
* X-LOAD adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
--== xasm 2.5.2: second final edition ==--
|
||||
interactive visual development environment
|
||||
only for 8-bit Atari programming gurus
|
||||
|
||||
requirements: 386 + DOS or Windows
|
248
fox.mak
248
fox.mak
@ -1,248 +0,0 @@
|
||||
;b. Fox/Tqa
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ;shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
;±±±±±±± DOS / FILE I/O ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO dos _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
IFDEF smartio
|
||||
call xdisk
|
||||
ELSE
|
||||
int 21h
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO smartdisk
|
||||
smartio = 1
|
||||
xdisk: dos
|
||||
IFDEF rts
|
||||
jnc rts
|
||||
ELSE
|
||||
jc _derr
|
||||
ret
|
||||
_derr:
|
||||
ENDIF
|
||||
mov dx, offset errtxt
|
||||
jmp panic
|
||||
ENDM
|
||||
|
||||
MACRO smarterr
|
||||
errtxt db 'Disk error!',eot
|
||||
ENDM
|
||||
|
||||
MACRO fcreate _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
xor cx, cx
|
||||
file 3ch
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fopen _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
file 3d00h
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fupdate _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
file 3d02h
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fclose ; ENTRY: bx = handle
|
||||
file 3eh
|
||||
ENDM
|
||||
|
||||
MACRO fread _fbufr ; ENTRY: DS:_fbufr = buffer, cx = no. of bytes
|
||||
IFNB <_fbufr>
|
||||
mov dx, offset _fbufr
|
||||
ENDIF
|
||||
file 3fh
|
||||
ENDM
|
||||
|
||||
MACRO fwrite _fbufr ; ENTRY: DS:_fbufr = buffer, cx = no. of bytes
|
||||
IFNB <_fbufr>
|
||||
mov dx, offset _fbufr
|
||||
ENDIF
|
||||
file 40h
|
||||
ENDM
|
||||
|
||||
;±±±±±±± PRINT ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO print _text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
MACRO PEOL
|
||||
mov dl, 13
|
||||
dos 2
|
||||
mov dl, 10
|
||||
dos 2
|
||||
ENDM
|
||||
|
||||
MACRO PrintAXdec
|
||||
LOCAL _outn1,_outn2,_dectxt,_cont
|
||||
mov di, offset _dectxt+4
|
||||
mov bx, 10
|
||||
_outn1: xor dx, dx
|
||||
div bx
|
||||
add dl, '0'
|
||||
_outn2: mov [di], dl
|
||||
dec di
|
||||
test ax, ax
|
||||
jnz _outn1
|
||||
mov dl, ' '
|
||||
cmp di, offset _dectxt
|
||||
jnb _outn2
|
||||
print _dectxt
|
||||
jmp _cont
|
||||
_dectxt db 5 dup(' '),eot
|
||||
_cont:
|
||||
ENDM
|
||||
|
||||
MACRO PrintEAXdec
|
||||
LOCAL _outn1,_outn2,_dectxt,_cont
|
||||
mov di, offset _dectxt+9
|
||||
mov ebx, 10
|
||||
_outn1: xor edx, edx
|
||||
div ebx
|
||||
add dl, '0'
|
||||
_outn2: mov [di], dl
|
||||
dec di
|
||||
test eax, eax
|
||||
jnz _outn1
|
||||
mov dl, ' '
|
||||
cmp di, offset _dectxt
|
||||
jnb _outn2
|
||||
print _dectxt
|
||||
jmp _cont
|
||||
_dectxt db 10 dup(' '),eot
|
||||
_cont:
|
||||
ENDM
|
||||
|
||||
MACRO D2A
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
ENDM
|
||||
|
||||
MACRO Printdig
|
||||
d2a
|
||||
sta dx
|
||||
dos 2
|
||||
ENDM
|
||||
|
||||
MACRO PrintAL
|
||||
push ax
|
||||
shr al, 4
|
||||
PrintDig
|
||||
pop ax
|
||||
and al, 0fh
|
||||
PrintDig
|
||||
ENDM
|
||||
|
||||
MACRO PrintAX
|
||||
push ax
|
||||
mov al, ah
|
||||
PrintAL
|
||||
pop ax
|
||||
PrintAL
|
||||
ENDM
|
||||
|
||||
MACRO PrintEAX
|
||||
push ax
|
||||
shr eax, 16
|
||||
PrintAX
|
||||
pop ax
|
||||
PrintAX
|
||||
ENDM
|
||||
|
||||
;±±±±±±± GFX ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO setgfx _gmode
|
||||
mov ax, _gmode
|
||||
int 10h
|
||||
ENDM
|
||||
|
||||
MACRO bar _jaki
|
||||
IFDEF bars
|
||||
mov dx, 3c8h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
inc dx
|
||||
mov al, _jaki
|
||||
out dx, al
|
||||
out dx, al
|
||||
out dx, al
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO EndVBl
|
||||
LOCAL w1,w2
|
||||
mov dx, 3dah
|
||||
w1: in al, dx
|
||||
test al, 8
|
||||
jz w1
|
||||
w2: in al, dx
|
||||
test al, 8
|
||||
jnz w2
|
||||
ENDM
|
||||
|
||||
MACRO StartVBL
|
||||
LOCAL w1,w2
|
||||
mov dx, 3dah
|
||||
w1: in al, dx
|
||||
test al, 8
|
||||
jnz w1
|
||||
w2: in al, dx
|
||||
test al, 8
|
||||
jz w2
|
||||
ENDM
|
@ -1,4 +1,4 @@
|
||||
# X-Assembler syntax for Code-Genie 3.0 (www.code-genie.com)
|
||||
# xasm syntax for Code-Genie 3.0 (www.code-genie.com)
|
||||
# written by Piotr Fusik <fox@scene.pl>
|
||||
|
||||
CaseInsensitive true
|
@ -1,8 +1,8 @@
|
||||
// X-Assembler highlighter for ConTEXT v0.97.1 (www.fixedsys.com/context)
|
||||
// xasm highlighter for ConTEXT v0.97.1 (www.fixedsys.com/context)
|
||||
// written by Piotr Fusik <fox@scene.pl>
|
||||
|
||||
Language: X-Assembler
|
||||
Filter: X-Assembler files (*.asx)|*.asx
|
||||
Language: xasm
|
||||
Filter: xasm files (*.asx)|*.asx
|
||||
HelpFile:
|
||||
|
||||
CaseSensitive: 0
|
134
syntax/xasm.ini
Normal file
134
syntax/xasm.ini
Normal file
@ -0,0 +1,134 @@
|
||||
# xasm highlighter for PSPad 4.2.1 (pspad.zde.cz)
|
||||
# written by Piotr Fusik <fox@scene.pl>
|
||||
[Settings]
|
||||
Name=xasm
|
||||
HTMLGroup=0
|
||||
FileType=*.asx
|
||||
CommentString=
|
||||
ANSIComment=0
|
||||
PasComment=0
|
||||
SlashComment=0
|
||||
CComment=0
|
||||
SpecComment=0
|
||||
BasComment=1
|
||||
FoxComment=0
|
||||
REMComment=0
|
||||
ExclComment=0
|
||||
ByComment=0
|
||||
SharpComment=0
|
||||
SlashComment=0
|
||||
PerCentComment=0
|
||||
SinglQComment=0
|
||||
DblQComment=0
|
||||
SQLComment=0
|
||||
SingleQuote=1
|
||||
DoubleQuote=1
|
||||
Preprocessors=0
|
||||
IndentChar=
|
||||
UnIndentChar=
|
||||
TabWidth=0
|
||||
[KeyWords]
|
||||
ADC=
|
||||
ADD=
|
||||
AND=
|
||||
ASL=
|
||||
BCC=
|
||||
BCS=
|
||||
BEQ=
|
||||
BIT=
|
||||
BMI=
|
||||
BNE=
|
||||
BPL=
|
||||
BRK=
|
||||
BVC=
|
||||
BVS=
|
||||
CLC=
|
||||
CLD=
|
||||
CLI=
|
||||
CLV=
|
||||
CMP=
|
||||
CPX=
|
||||
CPY=
|
||||
DEC=
|
||||
DEX=
|
||||
DEY=
|
||||
EOR=
|
||||
INC=
|
||||
INW=
|
||||
INX=
|
||||
INY=
|
||||
JCC=
|
||||
JCS=
|
||||
JEQ=
|
||||
JMI=
|
||||
JMP=
|
||||
JNE=
|
||||
JPL=
|
||||
JSR=
|
||||
JVC=
|
||||
JVS=
|
||||
LDA=
|
||||
LDX=
|
||||
LDY=
|
||||
LSR=
|
||||
MVA=
|
||||
MVX=
|
||||
MVY=
|
||||
MWA=
|
||||
MWX=
|
||||
MWY=
|
||||
NOP=
|
||||
ORA=
|
||||
PHA=
|
||||
PHP=
|
||||
PLA=
|
||||
PLP=
|
||||
RCC=
|
||||
RCS=
|
||||
REQ=
|
||||
RMI=
|
||||
RNE=
|
||||
ROL=
|
||||
ROR=
|
||||
RPL=
|
||||
RTI=
|
||||
RTS=
|
||||
RVC=
|
||||
RVS=
|
||||
SBC=
|
||||
SCC=
|
||||
SCS=
|
||||
SEC=
|
||||
SED=
|
||||
SEI=
|
||||
SEQ=
|
||||
SMI=
|
||||
SNE=
|
||||
SPL=
|
||||
STA=
|
||||
STX=
|
||||
STY=
|
||||
SUB=
|
||||
SVC=
|
||||
SVS=
|
||||
TAX=
|
||||
TAY=
|
||||
TSX=
|
||||
TXA=
|
||||
TXS=
|
||||
TYA=
|
||||
[ReservedWords]
|
||||
DTA=
|
||||
EIF=
|
||||
ELI=
|
||||
ELS=
|
||||
END=
|
||||
EQU=
|
||||
ERT=
|
||||
ICL=
|
||||
IFT=
|
||||
INI=
|
||||
INS=
|
||||
OPT=
|
||||
ORG=
|
||||
RUN=
|
@ -1,5 +1,5 @@
|
||||
#TITLE=X-Assembler
|
||||
; X-Assembler syntax file for EditPlus 2.11 (www.editplus.com)
|
||||
#TITLE=xasm
|
||||
; xasm syntax file for EditPlus 2.11 (www.editplus.com)
|
||||
; written by Piotr Fusik <fox@scene.pl>
|
||||
|
||||
#DELIMITER=+-*/%&|^!~=<>()[]{},:"#
|
||||
|
BIN
www/cgenie.gif
BIN
www/cgenie.gif
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
BIN
www/gbak.gif
BIN
www/gbak.gif
Binary file not shown.
Before Width: | Height: | Size: 69 B |
BIN
www/green64.gif
BIN
www/green64.gif
Binary file not shown.
Before Width: | Height: | Size: 477 B |
129
www/index.html
129
www/index.html
@ -1,50 +1,79 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm home page</TITLE>
|
||||
<META NAME="Description" CONTENT="xasm is a set of a few tools for developing software
|
||||
for Atari 8-bit computers on a PC with MS-DOS or Windows.">
|
||||
<META NAME="Keywords" CONTENT="xasm,6502,cross-assembler,atari,fox,taquart">
|
||||
<META NAME="Author" CONTENT="Piotr Fusik">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#000000" BACKGROUND="gbak.gif" TEXT="#ffffff" LINK="#00c0ff" VLINK="#ff80ff" ALINK="#d06060">
|
||||
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0><TR>
|
||||
<TD WIDTH=10% BGCOLOR=#008080><FONT SIZE=6><B>
|
||||
<NOBR> xasm home page</NOBR></B></FONT></TD>
|
||||
<TD BGCOLOR=#008080><IMG SRC="green64.gif" WIDTH=100% HEIGHT=50></TD></TR></TABLE>
|
||||
<CENTER><P>
|
||||
<B>xasm</B> is a set of a few tools for developing software for Atari 8-bit computers
|
||||
on a PC with MS-DOS or Windows.<P>
|
||||
<A HREF="xasm252.zip">Download (38 KB)</A> |
|
||||
<A HREF="doc/index.htm">Browse documentation on-line</A> |
|
||||
<A HREF="mailto:fox@scene.pl">E-mail me</A>
|
||||
<P>
|
||||
<TABLE><TR>
|
||||
<TD><IMG SRC="cgenie.gif" WIDTH=489 HEIGHT=461 ALT="Some 6502 code in Code-Genie"></TD>
|
||||
<TD>
|
||||
<HR><P>
|
||||
<B>News:</B>
|
||||
<UL>
|
||||
<LI> 03-10-2002: released version 2.5.2 (fixes bugs introduced in 2.5.1)
|
||||
<LI> 21-08-2002: released version 2.5.1 (a small bug fix)
|
||||
<LI> 08-07-2002: released version 2.5
|
||||
<LI> 27-06-2002: released version 2.4.1 (a small bug fix)
|
||||
<LI> 22-05-2002: released version 2.4
|
||||
</UL>
|
||||
<P><HR><P>
|
||||
<B>Features of the assembler:</B>
|
||||
<UL>
|
||||
<LI> backward compatibility with Quick Assembler
|
||||
<LI> pseudo instructions (<TT>add</TT>, <TT>sub</TT>, <TT>inw</TT>, <TT>mva</TT> etc.)
|
||||
<LI> pseudo addressing modes (e.g. indexing with autoincrementation)
|
||||
<LI> two instructions with same operand may be written in single line
|
||||
<LI> full set of arithmetic and logical operators
|
||||
<LI> 6502 opcodes may be used in expressions
|
||||
<LI> conditional assembly
|
||||
<LI> sine lookup-table generator
|
||||
<LI> Atari floating-point numbers
|
||||
<LI> Atari executable and raw output formats
|
||||
</UL>
|
||||
</TD>
|
||||
</TR></TABLE>
|
||||
</CENTER>
|
||||
</BODY></HTML>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>xasm</title>
|
||||
<meta name="Description" content="xasm is a 6502 cross-assembler for DOS/Windows."/>
|
||||
<meta name="Keywords" content="xasm,6502,cross-assembler,atari"/>
|
||||
<meta name="Author" content="Piotr Fusik"/>
|
||||
</head>
|
||||
<body style="background-color: #c0ffc0">
|
||||
<h1>xasm.atari.org</h1>
|
||||
<p><b>xasm</b> is a 6502 cross-assembler for DOS/Windows.
|
||||
It is mainly targeted at Atari 8-bit computers,
|
||||
but it can be also used for programming
|
||||
Atari 2600/5200/Lynx, Commodore C64, Apple ][ and others.
|
||||
<b>xasm</b> is freeware.</p>
|
||||
<p><a href="xasm260.zip">Download version 2.6.0
|
||||
(22 KB, includes full documentation)</a></p>
|
||||
<p><b>xasm</b> no longer includes the tools X-BOOT, X-LOAD and X-HEAD.
|
||||
If you really need them,
|
||||
<a href="xasm252.zip">download version 2.5.2 (38 KB)</a>.</p>
|
||||
<h3>Target audience</h3>
|
||||
<p><b>xasm</b> is for people who are fluent in the 6502 assembly language.
|
||||
There is no sample code for beginners, no easy-to-use libraries.
|
||||
You are warned that programming 8-bit machines in the assembly language
|
||||
is a tedious work.</p>
|
||||
<p>There are several 6502 cross-assemblers to choose from and new ones
|
||||
still appear. Just search the web. Make sure to not overlook
|
||||
the <a href="http://www.cc65.org">cc65</a> compiler which includes
|
||||
a cross-assembler, portable across many host and target platforms.</p>
|
||||
<h3>Features</h3>
|
||||
<p>Although <b>xasm</b> does not support user-defined macros, it has a rich
|
||||
set of built-in facilities.</p>
|
||||
<p>Here is some typical 6502 code (also valid in <b>xasm</b>):</p>
|
||||
<pre>
|
||||
lda #<dest
|
||||
sta ptr
|
||||
lda #>dest
|
||||
sta ptr+1
|
||||
ldx #192
|
||||
do_line
|
||||
ldy #39
|
||||
do_byte
|
||||
lda pattern,y
|
||||
sta (ptr),y
|
||||
dey
|
||||
bpl do_byte
|
||||
lda #40
|
||||
clc
|
||||
adc ptr
|
||||
sta ptr
|
||||
bcc skip
|
||||
inc ptr+1
|
||||
skip
|
||||
dex
|
||||
bne do_line
|
||||
</pre>
|
||||
<p>And here is the same code rewritten in a xasm-specific way:</p>
|
||||
<pre>
|
||||
mwa #dest ptr
|
||||
ldx #192
|
||||
do_line
|
||||
ldy #39
|
||||
mva:rpl pattern,y (ptr),y-
|
||||
lda #40
|
||||
add:sta ptr
|
||||
scc:inc ptr+1
|
||||
dex:bne do_line
|
||||
</pre>
|
||||
<h3>Usage</h3>
|
||||
<p>Although <b>xasm</b> comes with no editor, the documentation
|
||||
describes integration (syntax highlighting and single-keystroke compilation)
|
||||
with a few general-purpose text editors. Here is a screenshot
|
||||
of the <a href="http://www.code-genie.com">Code-Genie</a> editor:</p>
|
||||
<p><img src="cgenie.gif" alt="6502 code in Code-Genie"/></p>
|
||||
<hr/>
|
||||
<p><i>Hosted by <a href="http://atariarea.histeria.pl">Atari Area</a></i></p>
|
||||
</body>
|
||||
</html>
|
||||
|
631
xboot.asm
631
xboot.asm
@ -1,631 +0,0 @@
|
||||
; ><-B00T V b. Fox
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
zero db 100h dup(?)
|
||||
|
||||
blen = 59*1024
|
||||
|
||||
m_pro = 1 ; /p switch
|
||||
m_errs = 2 ; error/warning occured while current file
|
||||
m_file = 4 ; single file (atr name for one file given)
|
||||
m_lfn = 8 ; LFN search
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
struc finddata16
|
||||
db 21 dup(?)
|
||||
attr db ?
|
||||
time dw ?
|
||||
date dw ?
|
||||
fsize dd ?
|
||||
fname db 13 dup(?)
|
||||
ends
|
||||
|
||||
struc filetime32
|
||||
dd ?,?
|
||||
ends
|
||||
|
||||
struc finddata32
|
||||
attr dd ?
|
||||
creat filetime32 ?
|
||||
acces filetime32 ?
|
||||
write filetime32 ?
|
||||
fsizeh dd ?
|
||||
fsizel dd ?
|
||||
dd ?,?
|
||||
fname db 260 dup(?)
|
||||
aname db 14 dup(?)
|
||||
ends
|
||||
|
||||
MACRO lda _rg ; shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ; shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO dos _func ; call DOS function
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
call xdisk
|
||||
ENDM
|
||||
|
||||
MACRO jfile _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
jmp xdisk
|
||||
ENDM
|
||||
|
||||
MACRO print _text ; print ascii$ text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
|
||||
start:
|
||||
db 1536 dup(0) ; COMpack sux
|
||||
mov [spt], sp
|
||||
print hello
|
||||
|
||||
; Get arguments: obxnam, atrnam & /p switch
|
||||
; Set onam & anam to end of filenames
|
||||
mov si, 81h
|
||||
mov bx, offset onam
|
||||
|
||||
arg1: lodsb
|
||||
cmp al, ' '
|
||||
je arg1 ; skip spaces
|
||||
cmp al, '-'
|
||||
je swit
|
||||
cmp al, '/'
|
||||
jne nswit
|
||||
; Switch
|
||||
swit: lodsb
|
||||
and al, 0dfh
|
||||
cmp al, 'P'
|
||||
jne usg
|
||||
or [flags], m_pro ; '/P'
|
||||
jmp arg1
|
||||
|
||||
nswit: cmp al, 0dh
|
||||
je argx
|
||||
; Filename
|
||||
cmp bx, offset enam
|
||||
jae usg ; two names already parsed
|
||||
mov di, [bx]
|
||||
mov ah, '"'
|
||||
cmp al, ah
|
||||
je qname ; "file name with spaces"
|
||||
mov ah, ' '
|
||||
gname: stosb ; copy name
|
||||
qname: lodsb
|
||||
cmp al, ah ; space/'"', eol and '/' terminate name
|
||||
je xname
|
||||
cmp al, 0dh
|
||||
je bname
|
||||
cmp al, '/'
|
||||
jne gname
|
||||
bname: dec si
|
||||
xname: mov [bx], di ; save end of name ptr
|
||||
inc bx
|
||||
inc bx
|
||||
mov [byte di], 0
|
||||
jmp arg1
|
||||
|
||||
; Usage
|
||||
usg: print usgtxt
|
||||
dos 4c03h
|
||||
|
||||
; End of arguments
|
||||
argx: cmp bx, offset anam
|
||||
jb usg ; no obxnam given
|
||||
|
||||
; Find where obx FILE name begins
|
||||
mov di, [onam]
|
||||
lea cx, [di+1+zero-obxnam]
|
||||
fofna1: dec di
|
||||
cmp [byte di], '\'
|
||||
je fofnax
|
||||
cmp [byte di], ':'
|
||||
loopne fofna1
|
||||
fofnax: inc di
|
||||
mov [ofna], di
|
||||
|
||||
; Is atr given?
|
||||
cmp bx, offset anam
|
||||
ja atrgvn ; atr given
|
||||
|
||||
; Only obx given
|
||||
; Move path of obx to atrnam
|
||||
mov si, offset obxnam
|
||||
mov di, offset atrnam
|
||||
mobat1: lodsb
|
||||
stosb
|
||||
cmp al, '\'
|
||||
je mobat2
|
||||
cmp al, ':'
|
||||
jne mobat3
|
||||
mobat2: mov [anam], di
|
||||
mobat3: test al, al
|
||||
jnz mobat1
|
||||
mov di, [anam]
|
||||
mov [byte di], 0
|
||||
jmp srvobx
|
||||
|
||||
; Atr given
|
||||
; Delete trailing '\' if not "\" or "C:\"
|
||||
atrgvn: mov di, [anam]
|
||||
dec di
|
||||
cmp [byte di], '\'
|
||||
jne atrg1
|
||||
mov [anam], di
|
||||
cmp di, offset atrnam
|
||||
jbe atrg1
|
||||
cmp [byte di-1], ':'
|
||||
je atrg1
|
||||
mov [byte di], 0
|
||||
atrg1:
|
||||
; Check if it is file or dir
|
||||
mov dx, offset atrnam
|
||||
xor bx, bx ; try LFN function
|
||||
stc
|
||||
dos 7143h
|
||||
jnc chkafd
|
||||
cmp ax, 7100h ; LFN not supported
|
||||
jne afile ; possibly file/dir doesn't exist -> file
|
||||
dos 43h ; call MS-DOS function 4300h
|
||||
jc afile ; failed -> file
|
||||
chkafd: test cl, 10h
|
||||
jnz adir
|
||||
; It is file
|
||||
; Add .atr extension, if none
|
||||
afile: or [flags], m_file
|
||||
mov di, [anam]
|
||||
lea cx, [di+zero-atrnam]
|
||||
mov eax, 'rta.'
|
||||
call adext
|
||||
jmp srvobx
|
||||
; It is dir
|
||||
; Add trailing '\'
|
||||
adir: mov di, [anam]
|
||||
mov [byte di], '\'
|
||||
inc [anam]
|
||||
|
||||
; Serve obx
|
||||
; Add .obx extension, if none
|
||||
srvobx: mov di, [onam]
|
||||
lea cx, [di+zero-obxnam]
|
||||
mov eax, 'xbo.'
|
||||
call adext
|
||||
|
||||
; Find first file
|
||||
mov dx, offset obxnam
|
||||
mov cx, 7 ; try LFN
|
||||
mov si, 1
|
||||
mov di, offset f32
|
||||
stc
|
||||
dos 714eh
|
||||
jnc flfn
|
||||
cmp ax, 7100h ; LFN not supported
|
||||
jne nofil
|
||||
xor cx, cx ; call MS-DOS function 4Eh
|
||||
dos 4eh
|
||||
jnc main1
|
||||
nofil: print e_nofil ; "No file found"
|
||||
dos 4c02h
|
||||
|
||||
flfn: or [flags], m_lfn ; LFN successfull
|
||||
mov [fhand], ax
|
||||
|
||||
; Main loop - convert found file
|
||||
main1: and [flags], not m_errs
|
||||
mov [ohand], 0
|
||||
mov [ahand], 0
|
||||
mov [len], lodlen+endlen
|
||||
|
||||
; Move name from finddata to obxnam
|
||||
mov si, offset (finddata16 80h).fname
|
||||
test [flags], m_lfn
|
||||
jz nolfn1
|
||||
mov si, offset f32.fname
|
||||
nolfn1: mov di, [ofna]
|
||||
mona1: lodsb
|
||||
stosb
|
||||
test al, al
|
||||
jnz mona1
|
||||
|
||||
; Print "file.obx"
|
||||
mov si, offset obxnam
|
||||
call printz
|
||||
|
||||
; Open obx for reading
|
||||
mov bp, offset e_open
|
||||
mov dx, offset obxnam ; MS-DOS
|
||||
mov ax, 3d00h
|
||||
test [flags], m_lfn
|
||||
jz nolfn2
|
||||
mov si, dx ; LFN
|
||||
xor bx, bx
|
||||
mov dx, 1
|
||||
mov ax, 716ch
|
||||
nolfn2: file
|
||||
mov [ohand], ax
|
||||
|
||||
; Check if Atari executable
|
||||
call xreadh
|
||||
jb enate
|
||||
cmp [head], -1
|
||||
jne enate
|
||||
|
||||
mov dx, offset head
|
||||
mov cx, 4
|
||||
call xread
|
||||
jnb nenate
|
||||
enate: mov dx, offset e_nota
|
||||
jmp error
|
||||
nenate:
|
||||
|
||||
; Set default run address at first block
|
||||
mov ax, [head]
|
||||
mov [l1runl], al
|
||||
mov [l2runl], al
|
||||
mov [l1runh], ah
|
||||
mov [l2runh], ah
|
||||
|
||||
; Print "->"
|
||||
print arrow
|
||||
|
||||
; Atr FILE name given?
|
||||
test [flags], m_file
|
||||
jnz sfile
|
||||
; No: move name from obx, replacing extension with ".atr"
|
||||
mov si, [ofna]
|
||||
mov di, [anam]
|
||||
mona2: lodsb
|
||||
stosb
|
||||
cmp al, '.'
|
||||
jne mona2
|
||||
mov eax, 'rta'
|
||||
stosd
|
||||
sfile:
|
||||
|
||||
; Print "file.atr"
|
||||
mov si, offset atrnam
|
||||
call printz ; file.atr
|
||||
|
||||
; Create atr file
|
||||
mov bp, offset e_creat
|
||||
mov dx, offset atrnam
|
||||
xor cx, cx
|
||||
mov ax, 3c00h
|
||||
test [flags], m_lfn
|
||||
jz nolfn3
|
||||
mov si, dx
|
||||
mov bx, 1
|
||||
mov dx, 12h ; create or truncate
|
||||
mov ax, 716ch
|
||||
nolfn3: file
|
||||
mov [ahand], ax
|
||||
|
||||
; Print "..."
|
||||
print kropki
|
||||
|
||||
; Write atr header
|
||||
mov cx, beglen
|
||||
mov dx, offset begin
|
||||
call xwrite
|
||||
; Write loader in boot sector
|
||||
mov cx, lodlen
|
||||
mov dx, offset stdlod
|
||||
test [flags], m_pro
|
||||
jz stlo
|
||||
mov dx, offset prolod
|
||||
stlo: call xwrite
|
||||
jmp firs
|
||||
|
||||
; Converting
|
||||
; Read obx header
|
||||
skff: call xreadh
|
||||
jb chtrun
|
||||
cmp [head], -1
|
||||
je skff
|
||||
mov dx, offset head+2
|
||||
call xread2
|
||||
jb trunca
|
||||
|
||||
; Read block
|
||||
firs: mov cx, [head+2]
|
||||
sub cx, [head]
|
||||
inc cx
|
||||
cmp cx, blen
|
||||
jbe okhead
|
||||
mov cx, blen
|
||||
okhead: mov dx, offset blok
|
||||
call xread
|
||||
jb trunc
|
||||
; Write
|
||||
call xwrihd
|
||||
jmp skff
|
||||
|
||||
; Check if block is truncated
|
||||
chtrun: test ax, ax
|
||||
jnz trunca
|
||||
jmp finfil
|
||||
|
||||
trunc: test ax, ax
|
||||
jz finfil
|
||||
dec ax
|
||||
push ax
|
||||
add ax, [head]
|
||||
mov [head+2], ax
|
||||
pop ax
|
||||
call xwrihd
|
||||
|
||||
trunca: mov dx, offset w_trunc
|
||||
; Warning
|
||||
warfin: call warni
|
||||
|
||||
; End of file
|
||||
; Write endsequence
|
||||
finfil: mov dx, offset endseq1
|
||||
test [flags], m_pro
|
||||
jz endst
|
||||
mov dx, offset endseq2
|
||||
endst: mov cx, endlen
|
||||
call xwrite
|
||||
mov cx, 40h
|
||||
xor ax, ax
|
||||
mov di, offset head
|
||||
rep stosw
|
||||
sta cx
|
||||
sub cl, [byte len]
|
||||
and ecx, 7fh
|
||||
jz fuls
|
||||
call xwrith
|
||||
fuls:
|
||||
|
||||
; Write number of paragraphs (para=16 bytes) to atr
|
||||
xor cx, cx ; seek back to para's atr header field
|
||||
mov dx, 2
|
||||
mov bp, offset e_write
|
||||
file 4200h
|
||||
shr [len], 4
|
||||
mov cx, 2
|
||||
mov dx, offset len
|
||||
call xwrite
|
||||
|
||||
; Close files
|
||||
shut: mov bx, [ahand]
|
||||
mov bp, offset e_write
|
||||
call xclose
|
||||
mov bx, [ohand]
|
||||
mov bp, offset e_read
|
||||
call xclose
|
||||
|
||||
test [flags], m_errs
|
||||
jnz nook
|
||||
print oktxt
|
||||
nook: print eoltxt
|
||||
|
||||
; Find next file
|
||||
test [flags], m_lfn
|
||||
jnz lfnnx
|
||||
|
||||
dos 4fh ; MS-DOS function
|
||||
jc fin
|
||||
nexfil: test [flags], m_file
|
||||
jnz singl
|
||||
jmp main1
|
||||
|
||||
lfnnx: mov bx, [fhand] ; LFN function
|
||||
mov si, 1
|
||||
mov di, offset f32
|
||||
dos 714fh
|
||||
jnc nexfil
|
||||
|
||||
dos 71a1h ; LFN search close
|
||||
|
||||
fin: mov ax, [exitcod]
|
||||
dos
|
||||
|
||||
singl: print e_singl
|
||||
dos 4c02h
|
||||
|
||||
; Add extension if none (di=end of name, cx=len, eax=ext)
|
||||
adext: mov bx, di
|
||||
adext1: dec bx
|
||||
cmp [byte bx], '.'
|
||||
je adextr
|
||||
cmp [byte bx], '\'
|
||||
loopne adext1
|
||||
stosd
|
||||
adextr: mov [byte di], 0
|
||||
ret
|
||||
|
||||
xdisk: push bp
|
||||
dos
|
||||
pop dx
|
||||
jnc rts
|
||||
error: mov sp, [spt]
|
||||
mov [byte exitcod], 2
|
||||
or [flags], m_errs
|
||||
print
|
||||
jmp shut
|
||||
|
||||
warni: cmp [byte exitcod], 1
|
||||
jae nwacod
|
||||
mov [byte exitcod], 1
|
||||
nwacod: or [flags], m_errs
|
||||
print
|
||||
ret
|
||||
|
||||
xreadh: mov dx, offset head
|
||||
xread2: mov cx, 2
|
||||
xread: mov bx, [ohand]
|
||||
mov bp, offset e_read
|
||||
file 3fh
|
||||
cmp ax, cx
|
||||
rts: ret
|
||||
|
||||
xwrihd: add ax, 4
|
||||
movzx ecx, ax
|
||||
mov ax, [head]
|
||||
mov dx, [head+2]
|
||||
test [flags], m_pro
|
||||
jnz chkpro
|
||||
cmp ah, 8
|
||||
jae chkst1
|
||||
cmp dh, 7
|
||||
jae ememc
|
||||
chkst1: cmp dh, 0c0h
|
||||
jb xwrith
|
||||
cmp dh, 0d0h
|
||||
jb eproc
|
||||
cmp ah, 0d8h
|
||||
jb xwrith
|
||||
eproc: mov dx, offset w_prof
|
||||
jmp xwwarn
|
||||
|
||||
chkpro: cmp ah, 5
|
||||
jae xwrith
|
||||
cmp dh, 4
|
||||
jb xwrith
|
||||
|
||||
ememc: mov dx, offset w_mem
|
||||
xwwarn: push ecx
|
||||
call warni
|
||||
pop ecx
|
||||
|
||||
xwrith: mov dx, offset head
|
||||
xwritl: add [len], ecx
|
||||
xwrite: mov bx, [ahand]
|
||||
mov bp, offset e_write
|
||||
jfile 40h
|
||||
|
||||
xclose: test bx, bx
|
||||
jz rts
|
||||
jfile 3eh
|
||||
|
||||
pnam1: sta dx
|
||||
dos 2
|
||||
printz: lodsb
|
||||
test al, al
|
||||
jnz pnam1
|
||||
ret
|
||||
|
||||
hello db 'X-BOOT 5.0 by Fox/Taquart',eot
|
||||
usgtxt db 'Converts Atari 8-bit executables to .ATR disk images.',eol
|
||||
db 'Syntax: XBOOT [/p] obxfiles [atrpath][atrfile]',eol
|
||||
db '/p Write professional loader rather than standard.'
|
||||
eoltxt db eot
|
||||
arrow db ' -> $'
|
||||
kropki db ' ... $'
|
||||
oktxt db 'OK$'
|
||||
w_mem db eol,' WARNING: Memory conflict$'
|
||||
w_prof db eol,' WARNING: Professional loader needed$'
|
||||
w_trunc db eol,' WARNING: File is truncated$'
|
||||
e_nofil db 'ERROR: File not found',eot
|
||||
e_singl db 'ERROR: Single target for many files',eot
|
||||
e_nota db eol,' ERROR: Not Atari executable$'
|
||||
e_open db eol,' ERROR: Can''t open file$'
|
||||
e_read db eol,' ERROR: Disk read error$'
|
||||
e_creat db eol,' ERROR: Can''t create file$'
|
||||
e_write db eol,' ERROR: Disk write error$'
|
||||
|
||||
; ATR Header
|
||||
begin dw 296h,0,80h,4 dup(0)
|
||||
db 0,1
|
||||
beglen = $-begin
|
||||
|
||||
; Loader #1 (std)
|
||||
stdlod db 0,1,128,7,119,228,160,215,185,27,7,145,88,200,192,226,144
|
||||
db 246,169
|
||||
l1runl db 168,141,224,2,169
|
||||
l1runh db 7,141,225,2,169,7,141,5,3,169,255
|
||||
db 141,1,211,173,56,96,169,7,141,227,2,72,169,168,141,226,2,72
|
||||
db 162,251,149,72,232,134,67,238,210,7,16,16,238,10,3,208,3,238
|
||||
db 11,3,32,83,228,48,217,14,210,7,173,127,7,166,67,208,223,129
|
||||
db 68,230,68,208,2,230,69,165,70,197,68,165,71,229,69,176,210,169
|
||||
db 3,141,15,210,108,226,2,44,111,97,100,105,110,103,14,14,14,0
|
||||
db 53,46,48
|
||||
lodlen = $-stdlod
|
||||
|
||||
; Ending Header for loader #1
|
||||
endseq1 db 240,7,240,7,224
|
||||
endlen = $-endseq1
|
||||
|
||||
; Loader #2 (rom)
|
||||
prolod db 0,1,128,4,119,228,169,0,141,47,2,169,82,141,200,2,165
|
||||
db 20,197,20,240,252,169
|
||||
l2runl db 162,141,224,2,169
|
||||
l2runh db 4,141,225,2,173,56,96
|
||||
db 169,4,141,227,2,72,169,162,141,226,2,72,162,251,149,72,232,134
|
||||
db 67,238,220,4,16,32,238,10,3,208,3,238,11,3,169,255,141,1
|
||||
db 211,78,14,212,88,32,83,228,48,208,120,238,14,212,206,1,211,14
|
||||
db 220,4,173,127,4,166,67,208,207,129,68,230,68,208,2,230,69,165
|
||||
db 70,197,68,165,71,229,69,176,194,169,3,141,15,210,108,226,2,53
|
||||
db 46,48,112
|
||||
|
||||
; Ending Header for loader #2
|
||||
endseq2 db 250,4,250,4,224
|
||||
|
||||
exitcod dw 4c00h
|
||||
flags db 0
|
||||
len dd lodlen+endlen
|
||||
onam dw obxnam
|
||||
anam dw atrnam
|
||||
enam:
|
||||
fhand dw ?
|
||||
ohand dw ?
|
||||
ahand dw ?
|
||||
ofna dw ?
|
||||
spt dw ?
|
||||
|
||||
obxnam db 100h dup(?)
|
||||
atrnam db 100h dup(?)
|
||||
|
||||
f32 finddata32 ?
|
||||
|
||||
head dw ?,?
|
||||
blok db blen dup(?)
|
||||
|
||||
ENDS
|
||||
END start
|
152
xhead.asm
152
xhead.asm
@ -1,152 +0,0 @@
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
ORG 100h
|
||||
include 'fox.mak'
|
||||
|
||||
smartio = 1
|
||||
|
||||
start: print hello
|
||||
mov di, 81h
|
||||
movzx cx, [di-1]
|
||||
jcxz usg
|
||||
mov al, ' '
|
||||
repe scasb
|
||||
je usg
|
||||
push cx di
|
||||
dec di
|
||||
inc cx
|
||||
mov al, '?'
|
||||
repne scasb
|
||||
pop di cx
|
||||
jne nousg
|
||||
|
||||
usg: mov dx, offset usgtxt
|
||||
panic: print
|
||||
int 20h
|
||||
|
||||
smartdisk
|
||||
|
||||
read: mov cx, 2
|
||||
fread addr
|
||||
cmp ax, 2
|
||||
mov ax, [addr]
|
||||
ret
|
||||
|
||||
nousg: lea dx, [di-1]
|
||||
mov al, ' '
|
||||
repne scasb
|
||||
jne okend
|
||||
dec di
|
||||
okend: mov si, di
|
||||
mov cx, di
|
||||
sub cx, dx
|
||||
adex1: dec si
|
||||
cmp [byte si], '.'
|
||||
je adexn
|
||||
cmp [byte si], '\'
|
||||
loopne adex1
|
||||
adex2: mov eax, 'XBO.'
|
||||
stosd
|
||||
adexn: mov [byte di], 0
|
||||
fopen
|
||||
|
||||
call read
|
||||
mov dx, offset notbin
|
||||
inc ax
|
||||
jnz panic
|
||||
|
||||
head1: inc [mods]
|
||||
call read
|
||||
jb eof
|
||||
cmp ax, 0ffffh
|
||||
je head1
|
||||
|
||||
inc [blox]
|
||||
dec [mods]
|
||||
mov [begn], ax
|
||||
mov dl, ' '
|
||||
dos 2
|
||||
mov ax, [begn]
|
||||
call prword
|
||||
mov dl, '-'
|
||||
dos 2
|
||||
|
||||
call read
|
||||
mov dx, ax
|
||||
sub dx, [begn]
|
||||
inc dx
|
||||
call prword
|
||||
cmp dx, 2
|
||||
jne skip
|
||||
cmp [begn], 2e0h
|
||||
je pexec
|
||||
cmp [begn], 2e2h
|
||||
jne skip
|
||||
inc [inits]
|
||||
pexec: mov dl, ' '
|
||||
dos 2
|
||||
call read
|
||||
call prword
|
||||
jmp heade
|
||||
|
||||
skip: xor cx, cx
|
||||
file 4201h
|
||||
heade: PEOL
|
||||
jmp head1
|
||||
|
||||
eof: xor cx, cx
|
||||
xor dx, dx
|
||||
file 4202h
|
||||
push ax
|
||||
mov al, dl
|
||||
call pbyte
|
||||
pop ax
|
||||
call prword
|
||||
print byttxt
|
||||
mov ax, [blox]
|
||||
call prword
|
||||
print blotxt
|
||||
mov ax, [inits]
|
||||
call prword
|
||||
print initxt
|
||||
mov ax, [mods]
|
||||
call prword
|
||||
print modtxt
|
||||
fclose
|
||||
ret
|
||||
|
||||
prword: push ax
|
||||
mov al, ah
|
||||
call pbyte
|
||||
pop ax
|
||||
pbyte: ror ax, 4
|
||||
and al, 0fh
|
||||
call pdig
|
||||
shr ax, 12
|
||||
pdig: d2a
|
||||
pusha
|
||||
sta dx
|
||||
dos 2
|
||||
popa
|
||||
ret
|
||||
|
||||
hello db 'X-HEAD 1.1 by Fox/Taquart',eot
|
||||
usgtxt db 'Syntax: XHEAD obxfile',eot
|
||||
notbin db 'File is not an Atari executable!',eot
|
||||
smarterr
|
||||
byttxt db ' bytes',eot
|
||||
blotxt db ' blocks',eot
|
||||
initxt db ' inits',eot
|
||||
modtxt db ' modules',eot
|
||||
|
||||
blox dw 0
|
||||
inits dw 0
|
||||
mods dw 0
|
||||
|
||||
addr dw ?
|
||||
begn dw ?
|
||||
|
||||
ENDS
|
||||
END start
|
452
xload.asm
452
xload.asm
@ -1,452 +0,0 @@
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
zero db 100h dup(?)
|
||||
|
||||
ratio equ 671/1000
|
||||
timeAnswer = 2500*ratio
|
||||
timeChecksum = 1500*ratio
|
||||
timeSending = 600*ratio
|
||||
timeNormal = 900*ratio
|
||||
timeBefore = 1500*ratio
|
||||
timeBetween = 600*ratio
|
||||
timeUltra = 310*ratio
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ;shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO dos _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
call xdisk
|
||||
ENDM
|
||||
|
||||
MACRO fread _fbufr
|
||||
mov dx, offset _fbufr
|
||||
call xread
|
||||
ENDM
|
||||
|
||||
MACRO print _text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
|
||||
start:
|
||||
db 1536 dup(0) ;compack
|
||||
print hello
|
||||
|
||||
mov si, 81h
|
||||
mov di, offset obxnam
|
||||
|
||||
arg1: lodsb
|
||||
cmp al, ' '
|
||||
je arg1
|
||||
cmp al, '/'
|
||||
jne nswit
|
||||
lodsb
|
||||
cmp al, '4'
|
||||
ja ndigt
|
||||
sub al, '1'
|
||||
jb usg
|
||||
mov [byte port], al
|
||||
jmp arg1
|
||||
ndigt: and al, 0dfh
|
||||
cmp al, 'P'
|
||||
jne usg
|
||||
mov [prof], al
|
||||
jmp arg1
|
||||
nswit: cmp al, 0dh
|
||||
je argx
|
||||
cmp di, offset obxnam
|
||||
ja usg
|
||||
mnam1: stosb
|
||||
lodsb
|
||||
cmp al, ' '
|
||||
je mnam2
|
||||
cmp al, '/'
|
||||
je mnam2
|
||||
cmp al, 0dh
|
||||
jne mnam1
|
||||
mnam2: dec si
|
||||
mov bx, di
|
||||
lea cx, [di+zero-obxnam]
|
||||
adex1: dec bx
|
||||
cmp [byte bx], '.'
|
||||
je adexn
|
||||
cmp [byte bx], '\'
|
||||
loopne adex1
|
||||
mov eax, 'XBO.'
|
||||
stosd
|
||||
adexn: mov [byte di], 0
|
||||
jmp arg1
|
||||
|
||||
usg: print usgtxt
|
||||
dos 4c03h
|
||||
|
||||
noport: mov dx, offset nocom
|
||||
jmp panic
|
||||
nobin: mov dx, offset e_nota
|
||||
jmp panic
|
||||
|
||||
xdisk: push bp
|
||||
dos
|
||||
pop dx
|
||||
jnc xdret
|
||||
panic: print
|
||||
dos 4c02h
|
||||
|
||||
xread: mov bp, offset e_read
|
||||
file 3fh
|
||||
cmp ax, cx
|
||||
xdret: ret
|
||||
|
||||
argx: cmp di, offset obxnam
|
||||
jbe usg
|
||||
mov bx, [port]
|
||||
add [comnum1], bl
|
||||
add [comnum2], bl
|
||||
add bx, bx
|
||||
push ds
|
||||
push 40h
|
||||
pop ds
|
||||
mov cx, [bx]
|
||||
pop ds
|
||||
jcxz noport
|
||||
mov [port], cx
|
||||
|
||||
mov dx, offset obxnam
|
||||
mov bp, offset e_open
|
||||
file 3d00h ; open for reading
|
||||
sta bx
|
||||
mov cx, 2
|
||||
fread dcb
|
||||
cmp [word dcb], 0ffffh
|
||||
jne nobin
|
||||
|
||||
mov dx, [port]
|
||||
mov al, 3
|
||||
add dl, al
|
||||
out dx, al
|
||||
and dl, 0feh
|
||||
xor al, al
|
||||
out dx, al
|
||||
|
||||
print rboot
|
||||
|
||||
mov dx, [port]
|
||||
mov cx, 6
|
||||
call speed
|
||||
and dl, 0f8h
|
||||
mov al, 5
|
||||
out dx, al
|
||||
in al, dx
|
||||
|
||||
mov di, offset dcb
|
||||
|
||||
main: mov dx, [port]
|
||||
in al, 60h
|
||||
cmp al, 1 ; ESC key
|
||||
je byebye
|
||||
|
||||
add dl, 5
|
||||
in al, dx
|
||||
test al, 1
|
||||
jz main
|
||||
|
||||
and dl, 0f8h
|
||||
in al, dx
|
||||
mov [di+5], al
|
||||
stosb
|
||||
cmp di, offset dcb+5
|
||||
jb sk1
|
||||
mov di, offset dcb
|
||||
sk1: cmp [byte di], 31h
|
||||
jne main
|
||||
|
||||
cmp [byte di+1], 'R'
|
||||
je xcom_r
|
||||
cmp [byte di+1], 'S'
|
||||
jne main
|
||||
|
||||
xcom_s: call ack
|
||||
mov si, offset statdat
|
||||
mov cx, 5
|
||||
call send
|
||||
print booting
|
||||
jmp main
|
||||
|
||||
xcom_r: cmp [word di+2], 1
|
||||
jne main
|
||||
call ack
|
||||
mov si, offset bootstd
|
||||
test [prof], 0ffh
|
||||
jz sk3
|
||||
mov si, offset bootpro
|
||||
sk3: mov cx, 129
|
||||
call send
|
||||
call wate
|
||||
|
||||
mov cx, 2
|
||||
call speed
|
||||
mov [trtime], timeUltra
|
||||
|
||||
test [prof], 0ffh
|
||||
jz nodrom
|
||||
call wtblok
|
||||
mov si, offset bankdat
|
||||
mov cx, 4
|
||||
call send
|
||||
nodrom:
|
||||
|
||||
call wtblok
|
||||
|
||||
ffff: mov cx, 2
|
||||
fread head
|
||||
jb kpliq
|
||||
cmp [head], 0ffffh
|
||||
je ffff
|
||||
mov cx, 2
|
||||
fread head+2
|
||||
jb kpliq
|
||||
shr [sdefrun], 1
|
||||
jnc nodefr
|
||||
mov si, offset defrun
|
||||
mov cx, 5
|
||||
call send
|
||||
call wtblok
|
||||
nodefr: mov di, offset hexnum
|
||||
mov ax, [head]
|
||||
call hexw
|
||||
inc di
|
||||
mov ax, [head+2]
|
||||
call hexw
|
||||
print loading
|
||||
mov ax, [head]
|
||||
dec ax
|
||||
sub [head+2], ax
|
||||
|
||||
dalej: mov ax, [head+2]
|
||||
cmp ax, 100h
|
||||
jbe sk2
|
||||
mov ax, 100h
|
||||
sk2: sub [head+2], ax
|
||||
sta cx
|
||||
fread buf+3
|
||||
mov cx, ax
|
||||
jcxz kpliq
|
||||
mov si, offset buf
|
||||
add ax, [head]
|
||||
dec ah
|
||||
xchg al, ah
|
||||
mov [si], ax
|
||||
mov al, cl
|
||||
neg al
|
||||
mov [si+2], al
|
||||
add cx, 3
|
||||
call send
|
||||
|
||||
inc [byte high head]
|
||||
call wtblok
|
||||
cmp [head+2], 0
|
||||
jnz dalej
|
||||
jmp ffff
|
||||
|
||||
kpliq:
|
||||
mov si, offset runstd
|
||||
test [prof], 0ffh
|
||||
jz sk4
|
||||
mov si, offset runpro
|
||||
sk4: mov cx, 4
|
||||
call send
|
||||
|
||||
mov bp, offset e_read
|
||||
file 3eh ; close file
|
||||
print done
|
||||
byebye: dos 4c00h
|
||||
|
||||
wtblok: in al, 60h
|
||||
cmp al, 1
|
||||
je byebye
|
||||
and dl, 0f8h
|
||||
add dl, 5
|
||||
in al, dx
|
||||
test al, 1
|
||||
jz wtblok
|
||||
and dl, 0f8h
|
||||
in al, dx
|
||||
mov si, offset bttime
|
||||
jmp wate
|
||||
|
||||
speed: and dl, 0f8h
|
||||
add dl, 3
|
||||
in al, dx
|
||||
push ax
|
||||
or al, 80h
|
||||
out dx, al
|
||||
and dl, 0f8h
|
||||
mov ax, cx
|
||||
out dx, ax
|
||||
add dl, 3
|
||||
pop ax
|
||||
out dx, al
|
||||
ret
|
||||
|
||||
send: push si
|
||||
mov si, offset trtime
|
||||
call wate
|
||||
pop si
|
||||
mov dx, [port]
|
||||
outsb
|
||||
loop send
|
||||
ret
|
||||
|
||||
ack: mov si, offset ackdat
|
||||
call wate
|
||||
outsb
|
||||
call wate
|
||||
outsb
|
||||
wate: in al, 61h
|
||||
and al, 0fch
|
||||
out 61h, al
|
||||
mov ah, al
|
||||
mov al, 0b0h
|
||||
out 43h, al
|
||||
lodsb
|
||||
out 42h, al
|
||||
lodsb
|
||||
out 42h, al
|
||||
mov al, 1
|
||||
or al, ah
|
||||
out 61h, al
|
||||
mov al, 080h
|
||||
out 43h, al
|
||||
wate1: in al, 42h
|
||||
in al, 42h
|
||||
cmp al, 255
|
||||
je wate1
|
||||
wate2: in al, 42h
|
||||
in al, 42h
|
||||
cmp al, 255
|
||||
jne wate2
|
||||
mov al, ah
|
||||
out 61h, al
|
||||
ret
|
||||
|
||||
hexw: push ax
|
||||
mov al, ah
|
||||
call hexb
|
||||
pop ax
|
||||
hexb: aam 10h
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
xchg al, ah
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
stosw
|
||||
ret
|
||||
|
||||
ackdat: dw timeAnswer
|
||||
db 'A'
|
||||
dw timeChecksum
|
||||
db 'A'
|
||||
dw timeSending
|
||||
|
||||
statdat db 098h,0FFh,001h,000h,099h
|
||||
|
||||
bankdat db 0D2h,002h,0FFh,0FEh
|
||||
runstd db 006h,060h,0FFh,0E0h
|
||||
runpro db 003h,05Fh,0FFh,0E0h
|
||||
|
||||
bootstd:
|
||||
db 000h,001h,000h,007h,007h,007h,0A9h,060h,078h,0EEh,00Eh,0D4h,0A9h,008h,08Dh,004h
|
||||
db 0D2h,0A9h,000h,08Dh,006h,0D2h,0A9h,028h,08Dh,008h,0D2h,08Dh,009h,0D2h,0A9h,023h
|
||||
db 08Dh,00Fh,0D2h,08Dh,00Dh,0D2h,08Dh,00Ah,0D4h,00Ah,090h,0FAh,0A9h,013h,08Dh,00Fh
|
||||
db 0D2h,0A0h,002h,020h,061h,007h,099h,04Ah,007h,0B9h,003h,007h,099h,0E1h,002h,048h
|
||||
db 088h,0D0h,0F0h,020h,061h,007h,0AAh,020h,061h,007h,09Dh,000h,000h,0E8h,0D0h,0F7h
|
||||
db 0A5h,010h,08Dh,00Eh,0D2h,0A9h,003h,08Dh,00Fh,0D2h,04Eh,00Eh,0D4h,058h,06Ch,0E2h
|
||||
db 002h,0A9h,020h,08Dh,00Eh,0D2h,02Ch,00Eh,0D2h,0D0h,0FBh,08Ch,00Eh,0D2h,0ADh,00Dh
|
||||
db 0D2h,060h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
|
||||
db 089h
|
||||
dw timeBefore
|
||||
|
||||
bootpro:
|
||||
db 000h,001h,000h,004h,007h,004h,0A9h,060h,078h,0EEh,00Eh,0D4h,0EEh,000h,0D4h,0A9h
|
||||
db 008h,08Dh,004h,0D2h,0A9h,000h,08Dh,006h,0D2h,0A9h,028h,08Dh,008h,0D2h,08Dh,009h
|
||||
db 0D2h,0A9h,023h,08Dh,00Fh,0D2h,08Dh,00Dh,0D2h,08Dh,00Ah,0D4h,00Ah,090h,0FAh,0A9h
|
||||
db 013h,08Dh,00Fh,0D2h,0A0h,002h,020h,060h,004h,099h,04Dh,004h,0B9h,003h,004h,099h
|
||||
db 0E1h,002h,048h,088h,0D0h,0F0h,020h,060h,004h,0AAh,020h,060h,004h,09Dh,000h,000h
|
||||
db 0E8h,0D0h,0F7h,0A5h,010h,08Dh,00Eh,0D2h,0A9h,003h,08Dh,00Fh,0D2h,06Ch,0E2h,002h
|
||||
db 0A9h,020h,08Dh,00Eh,0D2h,02Ch,00Eh,0D2h,0D0h,0FBh,08Ch,00Eh,0D2h,0ADh,00Dh,0D2h
|
||||
db 060h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
|
||||
db 0AEh
|
||||
dw timeBefore
|
||||
|
||||
hello db 'X-LOAD 1.1 by Fox/Taquart',eot
|
||||
usgtxt db 'Syntax: XLOAD obxfile [options]',eol
|
||||
db '/1 - /4 Specify COM port (default COM2)',eol
|
||||
db '/p Professional loader',eot
|
||||
nocom db 'COM'
|
||||
comnum1 db '1 not found!',eot
|
||||
rboot db 'Ready for booting Atari at COM'
|
||||
comnum2 db '1...',eot
|
||||
booting db 'Booting...',eot
|
||||
loading db 'Loading '
|
||||
hexnum db ' - ',eot
|
||||
done db 'Done.',eot
|
||||
e_nota db 'ERROR: Not Atari executable',eot
|
||||
e_open db 'ERROR: Can''t open file',eot
|
||||
e_read db 'ERROR: Disk read error',eot
|
||||
|
||||
prof db 0
|
||||
sdefrun db 1 ; send default run address
|
||||
port dw 1
|
||||
trtime dw timeNormal
|
||||
bttime dw timeBetween
|
||||
dcb db 5 dup(0),5 dup(?)
|
||||
defrun db 1,0e2h,0feh ; head is next !!!
|
||||
head dw ?,?
|
||||
buf db 103h dup(?)
|
||||
obxnam:
|
||||
|
||||
ENDS
|
||||
END start
|
92
xloadcnv.asm
92
xloadcnv.asm
@ -1,92 +0,0 @@
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
ORG 100h
|
||||
include 'fox.mak'
|
||||
|
||||
start: mov [csum], 0
|
||||
fopen inpfile
|
||||
mov [ihand], bx
|
||||
fcreate outfile
|
||||
mov [ohand], bx
|
||||
|
||||
mov cx, 8
|
||||
main: push cx
|
||||
mov bx, [ihand]
|
||||
mov cx, 16
|
||||
fread buf
|
||||
|
||||
mov si, offset buf
|
||||
mov di, offset data
|
||||
mov cx, 16
|
||||
jmp c0
|
||||
c1: mov al, ','
|
||||
stosb
|
||||
c0: mov al, '0'
|
||||
stosb
|
||||
mov al, [si]
|
||||
add [csum], al
|
||||
adc [csum], 0
|
||||
shr al, 4
|
||||
d2a
|
||||
stosb
|
||||
lodsb
|
||||
and al, 0fh
|
||||
d2a
|
||||
stosb
|
||||
mov al, 'h'
|
||||
stosb
|
||||
loop c1
|
||||
mov ax, 0a0dh
|
||||
stosw
|
||||
|
||||
mov bx, [ohand]
|
||||
mov cx, 85
|
||||
fwrite line
|
||||
|
||||
pop cx
|
||||
loop main
|
||||
|
||||
mov bx, [ihand]
|
||||
fclose
|
||||
mov bx, [ohand]
|
||||
mov di, offset data+1
|
||||
mov al, [csum]
|
||||
shr al, 4
|
||||
d2a
|
||||
stosb
|
||||
mov al, [csum]
|
||||
and al, 0fh
|
||||
d2a
|
||||
stosb
|
||||
mov al, 'h'
|
||||
stosb
|
||||
mov ax, 0a0dh
|
||||
stosw
|
||||
mov cx, 10
|
||||
fwrite line
|
||||
fclose
|
||||
|
||||
mov eax, '.orp'
|
||||
cmp eax, [dword typ1]
|
||||
je wroc
|
||||
mov [dword typ1], eax
|
||||
mov [dword typ2], eax
|
||||
jmp start
|
||||
wroc: ret
|
||||
|
||||
inpfile db '\atari\xasm\xload'
|
||||
typ1 db 'std.obx',0
|
||||
outfile db 'xload'
|
||||
typ2 db 'std.db',0
|
||||
|
||||
line db ' db '
|
||||
data db 81 dup(?)
|
||||
ihand dw ?
|
||||
ohand dw ?
|
||||
buf db 16 dup(?)
|
||||
csum db ?
|
||||
|
||||
ENDS
|
||||
END start
|
Loading…
Reference in New Issue
Block a user