<descrip>
<tag/Function/Divide two ints and return quotient and remainder.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
-<tag/Declaration/<tt/div_t __fastcall__ div (int number, int denom);/
-<tag/Description/<tt/div/ divides <tt/number/ by <tt/denom/ and returns the
+<tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
+<tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
quotient and remainder in a <tt/div_t/ structure.
<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
<tag/Function/Determines whether the screen is going to be cleared after program exit.
<tag/Header/<tt/<ref id="atari.h" name="atari.h">, <ref id="apple2.h" name="apple2.h">/
<tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
-<tag/Description/The function returns 0 if the screen won't be cleared immediately after
-program termination. It returns 1 if it will.
+<tag/Description/The function returns zero if the screen won't be cleared immediately after
+program termination. It returns a non-zero value if it will.
<tag/Notes/<itemize>
<item>Some systems, maybe depending on configuration, immediately clear the screen
after a program exits. Therefore it might be difficult to read
to decide if a delay or wait for a key press should be executed when then program
exits.
</itemize>
-<tag/Availability/cc65 (<tt/atari/, <tt/atarixl/, <tt/apple2/, and <tt/apple2enh/ platforms)
+<tag/Availability/cc65
<tag/Example/<verb>
/* Hello World */
#include <stdio.h>
#include <unistd.h>
-#include <atari.h>
+#include <cc65.h>
int main(void)
{
printf("Hello World\n");
void rebootafterexit (void);
/* Reboot machine after program termination has completed. */
-unsigned char doesclrscrafterexit (void);
-/* Will the screen automatically be cleared after program termination. */
-
#define ser_apple2_slot(num) ser_ioctl (0, (void*) (num))
/* Select a slot number from 1 to 7 prior to ser_open.
** The default slot number is 2.
extern void _rest_vecs(void); /* restore system vectors */
extern char *_getdefdev(void); /* get default floppy device */
extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
-extern unsigned char doesclrscrafterexit (void); /* will DOS clear the screen after program termination */
/* global variables */
extern unsigned char _dos_type; /* the DOS flavour */
** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
*/
+unsigned char doesclrscrafterexit (void);
+/* Indicates whether the screen automatically be cleared after program
+** termination.
+*/
+
/* End of cc65.h */
#include <errno.h>
#include <6502.h>
#include <atari.h>
+#include <cc65.h>
#include <conio.h>
static int verbose = 1;
return NULL;
}
-static void exitfn(void)
-{
- /* if DOS will automatically clear the screen, after the program exits, wait for a keypress... */
- if (doesclrscrafterexit())
- cgetc();
-}
-
int main(int argc, char **argv)
{
char *filename, *x;
struct __iocb *iocb = findfreeiocb();
int iocb_num;
- atexit(exitfn);
+ /* if DOS will automatically clear the screen after the program exits, wait for a keypress... */
+ if (doesclrscrafterexit())
+ atexit((void (*)(void))cgetc);
if (! iocb) {
fprintf(stderr, "couldn't find a free iocb\n");
--- /dev/null
+;
+; Christian Groessler, June-2016
+;
+; unsigned char doesclrscr(void);
+;
+; returns 0/1 if after program termination the screen isn't/is cleared
+;
+
+ .export _doesclrscrafterexit
+
+_doesclrscrafterexit:
+ ldx #$00
+ txa
+ rts
#include <stdio.h>
#include <conio.h>
#include <atari.h>
+#include <cc65.h>
extern char _defdev[];
#include <stdlib.h>
#include <conio.h>
#include <atari.h>
+#include <cc65.h>
extern int getsp(void); /* comes from ../getsp.s */