BBS: Inland Empire Archive Date: 05-12-92 (23:57) Number: 3 From: MATT HART Refer#: NONE To: RICHARD VANNOY Recvd: NO Subj: ASM Routines Conf: (2) Quik_Bas
>RV> Let's say you have a PROC XYZ declared as
>RV> DECLARE SUB XYZ(a%, b$)
>RV> How does your assembly sub know where to find a% and b$?
Here's a MASM 5.0 or 6.0 example - assuming Near Strings
.model medium,basic
.code
PROC XYZ Aaddr:Word, Bdesc:Word
; Aaddr is the near address to a%
; Bdesc is the near pointer to the string descriptor for b$
MOV BX,Aaddr ; BX has address to a%
MOV [BX],1000 ; Move 1000 into the address pointed to by BX
; PRINT a% will show 1000
MOV SI,Bdesc ; SI has address of descriptor for b$
MOV DS:[SI],AX ; Move first 2 bytes at SI (string desc) into
; AX - AX now has the string length
MOV DS:[SI+2],CL ; Next 1 into CL - CL has first byte of the
; string
RET
XYZ EndP
END
---
* Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)

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