home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d01xx / d0155.lha / AsmExamples / Examples.doc < prev    next >
Text File  |  1988-10-02  |  3KB  |  61 lines

  1.               Assembler program examples.
  2.  
  3.    These are two examples for aspiring assembler programmers. They came
  4. into being in frustration over the lack of examples and documentation for
  5. assembly language programmers. A couple of pages in the AmigaDOS Manual and
  6. in the Exec Manual was about all I could find, and none of these included
  7. examples.
  8.    The Commodore include files are heavily commented, thank God, but the
  9. structures confused me. After a while, I figured they might provide offsets
  10. to acces the structures defined in C language, and sure enough this is
  11. right.
  12.    So these examples show how to OpenLibrary, OpenWindow, access to
  13. UserPort of a window, waiting for a close gadget, Delay, interface to
  14. graphics, writing numbers and a bit more. The calls to the system routines
  15. are easy once you know how, and you have no trouble with return values
  16. being truncated to 16 bits and the like.
  17.    Interface with WorkBench is not quite right. These programs do not care
  18. about the startup message provided, and they will lose some ram when run
  19. from WorkBench. From the CLI, they behave nicely returning every byte with
  20. no trouble. I call these CLI-mostly programs.
  21.    The CPU itself is very nice to programmers. It provides you with an
  22. elegant instruction set, many 32 bit registers, and an appealing straight
  23. design. This at least compared with other I've seen, like Z80 and 8086 (Did
  24. you get this, IBM users?)
  25.  
  26.    The examples are:
  27.  
  28.    Screen.a opens Intuition, opens a LORES screen, a window, and waits for
  29. you to press the close gadget. A very basic example of how to get to the
  30. system routines and the user port of a window.
  31.  
  32.    MemTool.a is actually useful. It opens a little window on WorkBench with
  33. display of remaining Fast and Chip memory, updating every two seconds. If
  34. it finds that we're running out of ram, it will flash EVERY screen and
  35. exit, leaving it's ram for other users. Try running ten of these and then
  36. fill your ram disk! Note that it only checks the ram counts every two
  37. seconds, and the close gadget at the same time. When you press the close
  38. gadget, it may take up to two seconds for it to close. It will not display
  39. correct figures on Amigas with more than 99 Megabytes of free ram, so
  40. beware, superusers! When it states that assembly language is fun, I mean
  41. it, but to be sure, the major programs I do are written with Manx C.
  42. Assembly language is to me mostly for fun and for those special lowlevel
  43. hacks where C is too slow or troublesome.
  44.  
  45.    These examples are assembled with Asm68k Version 1.1.0, and linked with
  46. BLink V6.5 and small.lib, all high quality PD software.
  47.    The commands to make the MemTool are:
  48.  
  49.    Asm68k MemTool.a -NS -RM -Idf0:include
  50.    BLink MemTool.o df0:lib/Small.lib NODEBUG TO MemTool
  51.  
  52.    These programs are yours for free to hack every way you want.
  53. Enjoy, have fun Guru'ing your way into this fine CPU. Actually, these did
  54. not create many red flashes for me.
  55.  
  56.                                             Henrik Clausen
  57.                                             Spobjergvej 125
  58.                                             DK 8220 Brabrand
  59.                                             Denmark
  60.  
  61.