1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-06 01:29:31 +00:00

Add issues from pull request #307.

This commit is contained in:
Christian Groessler 2016-06-07 12:05:28 +02:00
parent c7874b9f60
commit 346d88a6a7
8 changed files with 31 additions and 18 deletions

View File

@ -2552,8 +2552,8 @@ used in presence of a prototype.
<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
@ -2574,8 +2574,8 @@ ldiv
<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
@ -2583,12 +2583,12 @@ the last messages printed by the program prior to its exit. This function can be
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");

View File

@ -177,9 +177,6 @@ unsigned char get_ostype (void);
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.

View File

@ -167,7 +167,6 @@ extern void _save_vecs(void); /* save system vectors */
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 */

View File

@ -85,6 +85,11 @@ int __fastcall__ cc65_cos (unsigned x);
** 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 */

View File

@ -14,6 +14,7 @@
#include <errno.h>
#include <6502.h>
#include <atari.h>
#include <cc65.h>
#include <conio.h>
static int verbose = 1;
@ -32,13 +33,6 @@ static struct __iocb *findfreeiocb(void)
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;
@ -50,7 +44,9 @@ int main(int argc, char **argv)
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");

View File

@ -0,0 +1,14 @@
;
; 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

View File

@ -7,6 +7,7 @@
#include <stdio.h>
#include <conio.h>
#include <atari.h>
#include <cc65.h>
extern char _defdev[];

View File

@ -8,6 +8,7 @@
#include <stdlib.h>
#include <conio.h>
#include <atari.h>
#include <cc65.h>
extern int getsp(void); /* comes from ../getsp.s */