home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / doc / library.txt < prev    next >
Text File  |  1993-01-19  |  3KB  |  95 lines

  1.    ----------------------------------------------------------------------
  2.                   Copyright (C) 1990 by Natürlich!
  3.                      This file is copyrighted!
  4.                Refer to the documentation for details.
  5.    ----------------------------------------------------------------------
  6.  
  7.    NASM65 --- a Atari 8-Bit Crossassembler for the Atari ST (et al.)
  8.  
  9.  
  10.                         Preliminary manual for NASM65 libraries
  11.  
  12.          Copyright © 1990 by Natürlich!
  13.             on sources, binaries and manuals
  14.  
  15.  
  16.                   »» Bang that Bit that doesn't Bang ««
  17.  
  18.  
  19.    I n t r o d u c t i o n
  20.  
  21.    The NASM65 system contains an at best rudimentary library of code, to
  22.    be linked to your programs. The style in which these libraries are
  23.    accessed is uniform and will be explained in this document. Refer also
  24.    to the NLIB65, NLINK65 and STDIO documentation.
  25.  
  26.  
  27.    A c c e s s i n g   N A S M 6 5   l i b r a r i e s
  28.  
  29.    Libraries are accessed by the user in a uniform way, very much akin to
  30.    C. The user includes a header file, like for example STDIO.H65. This
  31.    files contains setup/call macros for functions that reside in libraries.
  32.  
  33.    The macros should be written in a generic sort of way, as exemplified
  34.    in STDIO.H65. The point being that you can use the .MACROs in two ways
  35.  
  36.    Case 1:
  37.          .include #system
  38.          .include #stddef
  39.          .include #macros
  40.          .include #stdio
  41.  
  42.          ...
  43.  
  44.          OPEN     2,8,0,file
  45.          PRINT    2,text,textend-text
  46.          CLOSE    2
  47.  
  48.          ...
  49.  
  50.     file:
  51.          .byte "D:FOOBLE.BAR",0
  52.     text:
  53.          .byte "Hello World",155,0
  54.     textend:
  55.  
  56.     Case 2:
  57.          .include #system
  58.          .include #stddef
  59.          .include #macros
  60.          .include #stdio
  61.  
  62.          ...
  63.  
  64.          OPEN     channel,mode,0,filename,@p3
  65.          PRINT    channel,text,textlen,0
  66.          CLOSE    channel,@special
  67.  
  68.          ...
  69.  
  70.    channel: .ds      1
  71.    mode:    .byte    8
  72.    text:    .ds      128
  73.    textlen: .byte    128
  74.  
  75.    In the first case, the macro is given values, whereas in the second
  76.    case the macro is given addresses. With the help of an auxiliary
  77.    parameter the user selects, which of the parameters are to be treated
  78.    as adresses and which as values. (Default: No parameter -> all values,
  79.    Parameter=0 -> all adresses)
  80.  
  81.    (Convention : parameter does not exist, all values are poked,
  82.    parameter does exist : 0 = all values are addresses
  83.    
  84.    Libraries should always be called with a JSR from the outside not
  85.    with a branch or JMP!!
  86.    
  87.    
  88.    *** NOTE ***
  89.    
  90.    The setup macros are just for quick and dirty hacks, where you don't
  91.    care about wasting some bytes for the sake of coding the stuff in
  92.    maybe 10% of the time it would normally take you. If your writing
  93.    something "for real" I'd suggest skipping the MACROS and calling
  94.    the library directly.
  95.