[fasm-help] nice macro when no ram!
Brought to you by:
privalov
From: Anthony <an...@do...> - 2002-11-25 20:49:22
|
Hi, Anyone writing a bios using fasm may find this macro helpful, it allowed me to get rid of a lot of wasteful repetitive code. The problem normally being that until you setup a stack, you cannot use subroutines. And until you set up dram, you can't set up a stack! With the macro below, you just use "spcall routinename", you must however make sure that the you copy cs to ss at the start of your bios. Calls can only be one level deep. ; this macro does a call when there is no stack macro spcall addr { local deststack,destaddr mov sp,((deststack)and $ffff) ; point stack to data after jmp instruction jmp addr ; do the routine deststack: dw ((destaddr)and $ffff) ; when a retn is executed... destaddr: ; ... it will return to this address - pulled off the stack! } -Anthony mailto:an...@do... For more information about Double Dutch Designs Limited, visit http://www.doubledutchdesigns.com This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify of...@do..., and delete it from your systems. You should not copy, disclose, or distribute its contents to anyone without our written permission. Double Dutch Designs emails are scanned for viruses but cannot be guaranteed to be virus-free. We accept no liability for viruses which may inadvertently be transmitted, nor for any loss occasioned by them. This e-mail and any files enclosed remain the property of Double Dutch Designs Limited. |