Merge pull request #307 from groessler/something_to_pull2
Add Atari version of of doesclrscrafterexit().
This commit is contained in:
19
libsrc/atari/doesclrscr.s
Normal file
19
libsrc/atari/doesclrscr.s
Normal file
@@ -0,0 +1,19 @@
|
||||
;
|
||||
; Christian Groessler, June-2016
|
||||
;
|
||||
; unsigned char doesclrscr(void);
|
||||
;
|
||||
; returns 0/1 if after program termination the screen isn't/is cleared
|
||||
;
|
||||
|
||||
.export _doesclrscrafterexit
|
||||
.import __dos_type
|
||||
.include "atari.inc"
|
||||
|
||||
_doesclrscrafterexit:
|
||||
ldx #0
|
||||
lda __dos_type
|
||||
cmp #MAX_DOS_WITH_CMDLINE + 1
|
||||
txa
|
||||
rol a
|
||||
rts
|
||||
@@ -7,14 +7,9 @@
|
||||
;
|
||||
|
||||
.export __is_cmdline_dos
|
||||
.import __dos_type
|
||||
.include "atari.inc"
|
||||
.import _doesclrscrafterexit
|
||||
|
||||
__is_cmdline_dos:
|
||||
ldx #0
|
||||
lda __dos_type
|
||||
cmp #MAX_DOS_WITH_CMDLINE + 1
|
||||
txa
|
||||
rol a
|
||||
eor #$01
|
||||
jsr _doesclrscrafterexit ; currently (unless a DOS behaving differently is popping up)
|
||||
eor #$01 ; we can get by with the inverse of _doesclrscrafterexit
|
||||
rts
|
||||
|
||||
@@ -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 (! _is_cmdline_dos())
|
||||
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");
|
||||
|
||||
12
libsrc/common/doesclrscr.s
Normal file
12
libsrc/common/doesclrscr.s
Normal file
@@ -0,0 +1,12 @@
|
||||
;
|
||||
; Christian Groessler, June-2016
|
||||
;
|
||||
; unsigned char doesclrscr(void);
|
||||
;
|
||||
; returns 0/1 if after program termination the screen isn't/is cleared
|
||||
;
|
||||
|
||||
.export _doesclrscrafterexit
|
||||
.import return0
|
||||
|
||||
_doesclrscrafterexit = return0
|
||||
Reference in New Issue
Block a user