' **   3-24-2000
 
' ** this WAS  ' Absolute Assembly 2.1 by Petter Holmberg, -97.
'** I JAD modified it, trying to work a large asm program
 '**  it works for me, tho its a little tricky
 '** Petter writes above my head, he is a great writer . i changed some of it
 ' ** trying to get it to work    on a larger  program
 '** _Petter I hope you didn't mind
 
    ' *** use at your own risk this can wipe old files ***
 
' ** I am James Davis : email   jad@iswt.com
'** USE  qb45/L
 
 
  '** not responsible  **  use at your own risk ****
 
' ** if your asm program doesn't have jmps, banches, or labels  where
'** some thing is stored use the call absolute Petter has at end
'** other wise make an array and read the asm into it at offset &h100
'** like below
' ****  I make an array at start of program
'*** REDIM storage%(1 TO 1000)     'this * 2  =     2000 bytes
'*** dump% = VARSEG(storage%(1))
'** after I put the asm$  program  on the program I then read the asm$ and
'** poke it back into my array at offset &h100
'** if more than 1 asm$ i make more  what ever it takes
'** I call like this    CALL ABSOLUTE(who$, buff%, &H100):
'** I don't declare the call absolute
'** debug doesn't like this     mov ax,es:word ptr{121}
'**  use this    es:
'**            mov ax,word ptr[121]
'** I don't delete the files "tempfila.txt (a tho g), used to make the asm
'** the errors are general found in tempfilc.txt  which you can look at with
'** edit or what ever
 
'**  good luck
 
' Absolute Assembly takes use of DEBUG, the program shipped with MS-DOS.     '
' DEBUG only supports 8088/8086 instructions, but it's still a good tool for '
' getting machine language out of Assembly instructions. And since QBASIC    '
'                                                                            '
' Absolute Assembly 2.1 features:                                            '
' * Support for blank lines and lines with just comments or lables.          '
' * Support for double Assembly commands, like REP STOSB.                    '
' * Option to automatically add CALL ABSOLUTE lines to output file.          '
' * All Assembly source lines printed to BASIC file in the same column.      '
' * Option to merge lines directly into a BASIC file.                        '
' * Auto-detection of QuickBASIC binary files to ensure safe merging.        '
' * Handling of errors and bugs in the sourcefile.                           '
'                                                                            '
' Notes:                                                                     '
' * Comments must start with a semicolon, (;).                               '
' * The maximum number of labels are 256. You shouldn't need half as much.   '
' * The maximum number of letters for a label are 16. It's easy to change    '
' * the program to accept a larger number, but it's probably not necessary.  '
' * A line label must be immediately followed by a colon, (:). Do NOT use a  '
'   colon after the label name in jump-instructions.                         '
' * Never use Assembly opcodes, numbers or single letters as labels.         '
' * Do not name labels so that the name includes the letters REP, REPE or    '
' * REPZ after each other, for example RepeatLoop:                           '
'   "Label:" and "label:" are processed as the same label.                   '
' * If no code string name is specified, it will be asm$ as default.         '
' * This program was made in QB45, but you should be able to run it in       '
'   QBASIC, PDS, VBDOS and PB as well.                                       '
' * If the program locks up, it's probably while running DEBUG. If this      '
'   happens, reboot your computer and check your source code for lines with  '
'   other things than Assembly instrucions, comments, labels or spaces.      '
' * You may use this program freely; distribute it, modify it, learn from it '
'   or erase it from your hard drive. ;) Just be sure to credit me in the    '
'   programs where you have used Absolute Assembly for some of the code.     '
' * If your computer gets damaged while using this program, don't blame me.  '
' * If you use Absolute Assembly in a program, please mail me and tell me    '
'   about it!                                                                '
' * Any comments/suggestions/bug reports etc. can be sent to:                '
'   petter.holmberg@usa.net                                                  '
' * Enjoy the program and have fun! Petter Holmberg, Sweden.                 '
"C:\DOS\DEBUG.EXE" ' Change this if you have DEBUG
'** some where else
"TEMPFILA.TXT"    ' Change this if the filename already
"TEMPFILB.TXT"    ' Change this if the filename already
"TEMPFILC.TXT"    ' Change this if the filename already
"TEMPFILD.TXT"    ' Change this if the filename already
"TEMPFILE.TXT""TEMPFILf.TXT""TEMPFILg.TXT"' Usertype for storing of labels.
' Change this if you want longer labels.
' Array for storing of labels.
'**   256 here would not work
"Assembly source text file:""BASIC destination file         : ""Name of code string            : """"asm$""$""$""Append to destfile? (y/n)      : ""n""y""n""y""Add CALL ABSOLUTE lines? (y/n) : ""n""y""n""y"'"satload.asm" ' w"clear.asm" '"eg2save.asm"  '2draw.asm " '"browse.asm "' "SAT.ASM "' "2a.ASM "    '"
"File Not Found""File Not Found"""'***    IF d$ = " " AND DD$ = " " THEN GOTO 2190
'** masm 6 put this at start of each line
":""CS"":""ES"":""DS"";"" "'** this removes most
":""": d$ = ""'**making f$
d$ = """"'** removing blanks
""
     f$ = ""'60 ' 150   '100
"a"'**  putting a dummy number in our [  ] places
         '** debug won't use letter here :used 100 but if it a long program
         '** debug thinks its to far from its location e, we  are allowed abt 125 +
         '** I think in  jz and others branches:so increase it by 6 on each loop you
          '** will have play with this:in your case it could be different:a short
          '** program, no sweat
"]"""'was  0100
     '** now its lc$ which is changed if i get errors
' PRINT "2f$  "; f$: SLEEP               '*+1
     lc = lc + 8' 6 '30 '25  '66  *** lc$ increases as you go along:try to keep
     '* with in  125 of where you are else a error in debug:look at tempfilc.txt
"""u 100, 100""q""<" + tempb$ + ">"' OK
 
333              '**  b looks ok
                      '*** how long ****
'**    getting how long:  looking at tempc a line at a time
              '** it has line numbers so when we get to the -u 100, 100
              '** which is the end: the length is the line before -u,100, 100 end
"-u 100, 100"":""""a""""""u 100, ""q""<" + tempd$ + ">""-u 100, "'* WH(LBC) ARE THE LABELS
   '** wh(lbc) are the line numbers of the labels:if wh(lbc)number equals
   '** the line number then lcl$(lbc) equals mid$(f$,6,4):this is used later
   '** unrem the print statements and look
"-q"
 
 
'***************************************************************************
"a"'rem  PRINT "f$  "; f$; "  "; LTRIM$(RTRIM$(ll$(lbs))): SLEEP
        '** putting back the addresses in the lines
        '**it takes a line of f$ and checks it to see if any of the labels in
       '** ll$(lbs) matches   if it matches it then inserts it in f$
       '** it checks w times this is number of labels
      '** run the print  above and below  that are rem out
"]""]"'PRINT f$
'SLEEP
"""u 100, ""q""<" + tempF$ + ">""-u 100,""0""-q"' -------------------------------------------------------------------------- '
' Transform the source code to BASIC string declaration lines:               '
' -------------------------------------------------------------------------- '
"-u 100,""' ------ Created with Absolute Assembly 2.1 by Petter Holmberg, -97. ------- '""' -------modified by jad 3-24-00------------ "" = """"-q"" = ""0"" + CHR$(&H"")"" + CHR$(&H"")"" ' "": "" "":"'** asm
"-q""&h""' length ""'""""offset% = SADD("")""DEF SEG = VARSEG("")""CALL ABSOLUTE(offset%)""DEF SEG""""' ------ Created with Absolute Assembly 2.1 by Petter Holmberg, -97. ------- '""' ------ modified by jad 3-24-00 -------------  ""Source code successfully moved to BASIC destination file.""Time of conversion:""seconds.""Convert another file? (y/n)    : ""n""y""end    Press any key"'*******************************************************************.
     '*******************************************
">"""  '** getting rid of <title>, <center>,and <what> ever between <   >
" """  '** getting rid of <title>, <center>,and <what> ever between <   >
      '       PRINT "2510"
       '      SLEEP