]> git.sur5r.net Git - cc65/commitdiff
Learned the hard way that even meant-to-be-simple sample programs should contain...
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 22 Feb 2012 23:29:52 +0000 (23:29 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 22 Feb 2012 23:29:52 +0000 (23:29 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5546 b7a2c559-68d2-44c3-8de9-860c34a00d81

samples/geos/overlay-demo.c

index 622c064424516709f89926311744e51df684a130..cc751ea37ae7581f7bc73eac083b719c287eff37 100644 (file)
@@ -65,18 +65,27 @@ void foobar (void)
 
 void main(int /*argc*/, char *argv[])
 {
-    OpenRecordFile(argv[0]);
+    if (OpenRecordFile(argv[0])) {
+        _poserror("OpenRecordFile");
+        return;
+    }
 
     DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
              "Click OK to call Overlay One.");
 
-    PointRecord(1);
+    if (PointRecord(1)) {
+        _poserror("PointRecord.1");
+        return;
+    }
 
     /* The macro definitions OVERLAY_ADDR and OVERLAY_SIZE were generated in
      * overlay-demores.h by grc65. They contain the overlay area address and
      * size specific to a certain program.
      */
-    ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE);
+    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
+        _poserror("ReadRecord.1");
+        return;
+    }
 
     /* The linker makes sure that the call to foo() ends up at the right mem
      * addr. However it's up to user to make sure that the - right - overlay
@@ -87,23 +96,38 @@ void main(int /*argc*/, char *argv[])
     DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
              "Click OK to call Overlay Two.");
 
-    PointRecord(2);
+    if (PointRecord(2)) {
+        _poserror("PointRecord.2");
+        return;
+    }
 
     /* Replacing one overlay with another one can only happen from the main
      * program. This implies that an overlay can never load another overlay.
      */
-    ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE);
+    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
+        _poserror("ReadRecord.2");
+        return;
+    }
 
     bar();
 
     DlgBoxOk(CBOLDON "Overlay Demo - Main" CPLAINTEXT,
              "Click OK to call Overlay Three.");
 
-    PointRecord(3);
+    if (PointRecord(3)) {
+        _poserror("PointRecord.3");
+        return;
+    }
 
-    ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE);
+    if (ReadRecord(OVERLAY_ADDR, OVERLAY_SIZE)) {
+        _poserror("ReadRecord.3");
+        return;
+    }
 
     foobar();
 
-    CloseRecordFile();
+    if (CloseRecordFile()) {
+        _poserror("CloseRecordFile");
+        return;
+    }
 }