summaryrefslogtreecommitdiff
path: root/Examples/Grabber.S
diff options
context:
space:
mode:
authorChristian A. Weber <chris@gna.ch>1992-06-02 16:44:18 +0000
committerChristian A. Weber <chris@gna.ch>1992-06-02 16:44:18 +0000
commitae24a0c6fabd13678c2def53b2074b0a8bf690ef (patch)
tree0b603aa550fe1d2cb86a2599b507249801b0ac15 /Examples/Grabber.S
parentca96c0bbd4aaa1d629de51a6b7a2ac118ed0105c (diff)
downloadiff-library-ae24a0c6fabd13678c2def53b2074b0a8bf690ef.tar.gz
iff-library-ae24a0c6fabd13678c2def53b2074b0a8bf690ef.tar.bz2
iff-library-ae24a0c6fabd13678c2def53b2074b0a8bf690ef.zip
Initial checkin
Diffstat (limited to 'Examples/Grabber.S')
-rw-r--r--Examples/Grabber.S66
1 files changed, 66 insertions, 0 deletions
diff --git a/Examples/Grabber.S b/Examples/Grabber.S
new file mode 100644
index 0000000..1a7faa1
--- /dev/null
+++ b/Examples/Grabber.S
@@ -0,0 +1,66 @@
+**
+** $Id: Grabber.S,v 21.1 92/05/28 17:09:27 chris Exp $
+** $Revision: 21.1 $
+**
+** $Filename: Examples/Grabber.S $
+** $Authors: Christian Haller, CHW $
+** $Release: 21.1 $
+** $Date: 92/05/28 17:09:27 $
+**
+** Example for low level Assembler hackers :-)
+**
+** This program saves the contents of the first screen as an IFF file
+** with filename 'RAM:grabber.pic'. The iff.library is required.
+** If you use the DevPac assembler, type 'Genim2 Grabber' to assemble.
+** For simplicity, this program uses hard coded constants. You may wish
+** to use the appropriate standard header files instead.
+**
+** THIS IS PD. NO WARRANTY. USE AT YOUR OWN RISK.
+**
+
+Main: move.l 4,a6 ; AbsExecBase
+ lea IFFName(PC),a1 ; Library Name
+ moveq #16,d0 ; Required library version
+ jsr -552(a6) ; OpenLibrary()
+ move.l d0,a4 ; A4 : IFF Library Base
+ tst.l d0 ; Did we get it ?
+ bne.s IFFOpen ; Yes --->
+ moveq #20,d0 ; Return-code RETURN_FAIL
+ rts ; Return to CLI
+IFFOpen:
+ lea IntuiName(PC),a1 ; Intuition Library Name
+ jsr -408(a6) ; OldOpenLibrary()
+ move.l d0,a5 ; A5 : IntuitionBase
+
+ move.l 60(a5),a0 ; IntuitionBase->FirstScreen
+ move.l 88(a0),d6 ; Screen.BitMap
+
+ move.l 48(a0),a1 ; struct Colormap
+ move.l 4(a1),d7 ; struct ColorTable
+ lea 44(a0),a1 ; sc_ViewPort
+ move.w 32(a1),d1 ; vp_Modes
+ moveq #1,d0 ; Set cruncher-flag
+ btst #11,d1 ; Hold And Modify ?
+ beq.s NoHam ; no --->
+ bset #7,d0 ; Set HAM-Flag for IFF.lib
+NoHam:
+ move.l a4,a6 ; IFFBase
+ lea FileName(PC),a0 ; Name of file to save
+ move.l d6,a1 ; Pointer to BitMap
+ move.l d7,a2 ; Pointer to ColorMap
+ jsr -66(a6) ; SaveBitMap()
+
+ move.l 4,a6 ; AbsExecBase
+ move.l a4,a1 ; IFFBase
+ jsr -414(a6) ; CloseLibrary() (IMPORTANT!)
+
+ move.l a5,a1 ; IntuitionBase
+ jsr -414(a6) ; CloseLibrary()
+
+ moveq #0,d0 ; DOS return code
+ rts
+
+IFFName: dc.b "iff.library",0
+IntuiName: dc.b "intuition.library",0
+FileName: dc.b "RAM:grabber.pic",0
+