* Vax-11 Macro
@ 1996-04-16 4:00 John Olavesen
1996-04-16 4:00 ` David Bratton
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: John Olavesen @ 1996-04-16 4:00 UTC (permalink / raw)
Is it possible to dynamically allocate memory in using VAX-11 Macro
assembly language? If so, how would you go about doing it?
Thanks.. John
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Vax-11 Macro 1996-04-16 4:00 Vax-11 Macro John Olavesen @ 1996-04-16 4:00 ` David Bratton 1996-04-17 4:00 ` John Aldridge 1996-04-17 4:00 ` David F. Wall 1996-04-17 4:00 ` Rodney Iwashina 2 siblings, 1 reply; 6+ messages in thread From: David Bratton @ 1996-04-16 4:00 UTC (permalink / raw) To: John Olavesen John Olavesen wrote: > > Is it possible to dynamically allocate memory in using VAX-11 Macro > assembly language? If so, how would you go about doing it? > > Thanks.. John Call the RTL routine LIB$GET_VM. David Bratton University of Houston System DBratton@uh.edu ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Vax-11 Macro 1996-04-16 4:00 ` David Bratton @ 1996-04-17 4:00 ` John Aldridge 0 siblings, 0 replies; 6+ messages in thread From: John Aldridge @ 1996-04-17 4:00 UTC (permalink / raw) In article <3173D7A6.2EA@uh.edu>, David Bratton <DBratton@uh.edu> writes: > John Olavesen wrote: >> >> Is it possible to dynamically allocate memory in using VAX-11 Macro >> assembly language? If so, how would you go about doing it? > > Call the RTL routine LIB$GET_VM. Or: SUBL2 #some,SP Cheers, John ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Vax-11 Macro 1996-04-16 4:00 Vax-11 Macro John Olavesen 1996-04-16 4:00 ` David Bratton @ 1996-04-17 4:00 ` David F. Wall 1996-04-17 4:00 ` Rodney Iwashina 2 siblings, 0 replies; 6+ messages in thread From: David F. Wall @ 1996-04-17 4:00 UTC (permalink / raw) In article <00001be4+00001892@msn.com>, JohnnyO@msn.com (John Olavesen) writes: >Is it possible to dynamically allocate memory in using VAX-11 Macro >assembly language? If so, how would you go about doing it? Sure it is. The assembler on OpenVMS Vax and compiler on OpenVMS Alpha do it all the time. Here's a simple user-mode, IPL 0, OpenVMS case: pushab my$memory_block ; Address of the allocated block to here pushl #512 ; How much I want (in bytes) calls #2,lib$get_vm ; Ask the system for it blbs r0,okay ; Go off and use it not_ok: ; Deal with maybe not getting it... And when you're done with it... pushab my$memory_block ; Address of address of block pushl #512 ; Size of block (in bytes) calls #2,lib$free_vm ; Fly, be free! It occurs to me that you may not be working on an OpenVMS system, but any other operating system that supports an VAX-11 MACRO assembler will also have in it someplace primitives for memory allocation and deallocation. Call them in the approved fashion and away you go. -- Me, not Digital David F. Wall (Digital Equipment Corp., Nashua, NH) UUCP ...!decwrl!rndhse.enet!wall Internet wall@rndhse.enet.dec.com - or - wall%rndhse.enet@decwrl.dec.com --- ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Vax-11 Macro 1996-04-16 4:00 Vax-11 Macro John Olavesen 1996-04-16 4:00 ` David Bratton 1996-04-17 4:00 ` David F. Wall @ 1996-04-17 4:00 ` Rodney Iwashina 1996-04-19 4:00 ` Sam Samalsson 2 siblings, 1 reply; 6+ messages in thread From: Rodney Iwashina @ 1996-04-17 4:00 UTC (permalink / raw) John Olavesen wrote: > > Is it possible to dynamically allocate memory in using VAX-11 Macro > assembly language? If so, how would you go about doing it? Yes. Use lib$get_vm unless you are writting privileged code. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Vax-11 Macro 1996-04-17 4:00 ` Rodney Iwashina @ 1996-04-19 4:00 ` Sam Samalsson 0 siblings, 0 replies; 6+ messages in thread From: Sam Samalsson @ 1996-04-19 4:00 UTC (permalink / raw) > John Olavesen wrote: > > > > Is it possible to dynamically allocate memory in using VAX-11 Macro > > assembly language? If so, how would you go about doing it? > > Yes. Use lib$get_vm unless you are writting privileged code. Maybe this can be used as something to start from, I use this method myself in a few programs Sam ;---------------------------------------------------------------------------- .title get_free_vm ; ; Allocating memory using LIB$GET_VM. ; Releasing it again using LIB$FREE_VM. ; ; Author Sam Samalsson ; Dato 24. september 1988 ;____________________________________________________________________________ .psect data long,noexe ;Argument list for the lib$create_vm_zone call ;--------------------------------------------- zone_arg: .long 4 ;number of arguments following .address zone_id ;the new zone gets an id .address algorithm ;allocation algorithm .address alg_argument ;argument for algoritth .address flags ;fill or not zone_id: .long 0 ;address of the zone_id algorithm: .long 1 ;first fit alg_argument: .long 0 ;first fit dont need argument flags: .long 1 ;allocated vm to be filled with 0's ;1's could be chosen ;Argument list for the lib$get_vm call ;------------------------------------- tab_arg: .long 3 ;number of arguments .address tab_len ;longword containing the number of bytes .address tab_start ;longword containing the start add of table .address zone_id ;zonen that we allocate from tab_len: .long 0 ;table length in bytes ;we will allocate 20.000 bytes tab_start: .long 1 ;Argument list for the lib$delete_vm_zone call ;--------------------------------------------- del_zone: .long 1 ;number of argumentes .address zone_id ;id of the zonen to be released ;------------------------------------------------------------------------------ .psect code exe,wrt,long,shr,pic .entry get_free_vm,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> ;Here we create the VM-zone from where we will allocate our VM ;------------------------------------------------------------- create_vm_zone: callg zone_arg,g^lib$create_vm_zone blbc r0,error ;if we did not get out ;zone, then branch to error ;Here we allocate our VM ;----------------------- allocate_vm: movl #20000,tab_len ;the number of bytes we want callg tab_arg,g^lib$get_vm blbc r0,error ;if we did not get our ;memory, then branch to error ;Tabels will be released to VMS, funk_kode 1 ;---------------------------------------- release_tab: callg del_zone,g^lib$delete_vm_zone blbc r0,error ;if we did not get released the ;zone, then branch to error brb success ;Here we can build in an exeption handler ;---------------------------------------- error: brb finido ;Here can be build in a succes handler ;------------------------------------- success: finido: movl #1,r0 ret .end get_free_vm ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1996-04-19 4:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1996-04-16 4:00 Vax-11 Macro John Olavesen 1996-04-16 4:00 ` David Bratton 1996-04-17 4:00 ` John Aldridge 1996-04-17 4:00 ` David F. Wall 1996-04-17 4:00 ` Rodney Iwashina 1996-04-19 4:00 ` Sam Samalsson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox