Tasm Or Masm?

 BBS: Inland Empire Archive
Date: 06-19-92 (21:28)             Number: 962
From: MATT HART                    Refer#: NONE
  To: JEFF FREEMAN                  Recvd: NO  
Subj: Tasm Or Masm?                  Conf: (2) Quik_Bas
 JF> techinical -- just this.  Can TASM be called from QB - or do I need to
 JF> go with MASM?

MASM is easier.  It includes scripts for BASIC that include
conventions for using variable names to pass parameters
rather than having to set them up manually as in TASM.
Like this:

     CALL MyRoutine(Variable%)
In MASM, Variable% could be received with:

     .MODEL MEDIUM, BASIC
     .CODE

     MyRoutine PROC Variable:Word
          MOV  BX,Variable         ; Address of Variable in BX
          MOV  AX,[BX]             ; AX now has the value of Variable

Alternately, you can use:
     CALL MyRoutine(BYVAL Variable%)
if you don't need to pass anything back.  It's faster.

     MyRoutine PROC Variable:Word
          MOV  AX,Variable         ; AX has value of Var directly

With most any other assembler, you must get parameters from
the stack.  This may not be good code, but you'll get the
idea.  I did this at first with MASM, till I learned better!

     MyRoutine PROC
          PUSH  BP
          PUSH  SP
          MOV   BX,[BP+4]     ; Address of Variable
          MOV   AX,[BX]
          POP   SP
          POP   BP

Also, when you return from TASM, you must pop the variables
off the stack manually:

          RET   2

With MASM, you always just use
          RET

It knows how many parameters there were based on the
parameter list at the top of the program.  You can pass
BYVAL to the TASM routine too, and save the MOV AX,[BX]
step.

I'd definitely recommend MASM.  I code using Brief and have
set up macros to load the hypertext quickhelp program (the
one in the QuickBASIC IDE) based on a keyword or without
one.  So even though I don't code in the environment, I
still have access to the same help stuff - but it combines
all the QB help, BC and LINK, MASM, memory areas, system
interrupts, you name it!
---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET