mirror of
https://github.com/cc65/cc65.git
synced 2024-06-01 13:41:34 +00:00
Fixed some line endings.
My Git and repositories are configured for POSIX; but sometimes, Windows line endings "sneak" into new files.
This commit is contained in:
parent
3b544613d2
commit
17333e4732
|
@ -1,23 +1,23 @@
|
||||||
;
|
;
|
||||||
; Pointer for library references by device drivers.
|
; Pointer for library references by device drivers.
|
||||||
;
|
;
|
||||||
; 2013-07-25, Greg King
|
; 2013-07-25, Greg King
|
||||||
;
|
;
|
||||||
|
|
||||||
.export mouse_libref, _pen_adjuster
|
.export mouse_libref, _pen_adjuster
|
||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
mouse_libref: ; generic label for mouse-kernel
|
mouse_libref: ; generic label for mouse-kernel
|
||||||
|
|
||||||
; A program optionally can set this pointer to a function that gives
|
; A program optionally can set this pointer to a function that gives
|
||||||
; a calibration value to a driver. If this pointer isn't NULL,
|
; a calibration value to a driver. If this pointer isn't NULL,
|
||||||
; then a driver that wants a value can call that function.
|
; then a driver that wants a value can call that function.
|
||||||
;
|
;
|
||||||
; The function might read a value from a file; or, it might ask the user
|
; The function might read a value from a file; or, it might ask the user
|
||||||
; to help calibrate the driver.
|
; to help calibrate the driver.
|
||||||
;
|
;
|
||||||
; void __fastcall__ (*pen_adjuster)(unsigned char *) = NULL;
|
; void __fastcall__ (*pen_adjuster)(unsigned char *) = NULL;
|
||||||
;
|
;
|
||||||
_pen_adjuster:
|
_pen_adjuster:
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
|
@ -1,93 +1,93 @@
|
||||||
/*
|
/*
|
||||||
** Calibrate lightpen drivers to the current video hardware.
|
** Calibrate lightpen drivers to the current video hardware.
|
||||||
**
|
**
|
||||||
** 2013-07-25, Greg King
|
** 2013-07-25, Greg King
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <pen.h>
|
#include <pen.h>
|
||||||
|
|
||||||
|
|
||||||
#define COMMAND1 "Adjust by clicking on line."
|
#define COMMAND1 "Adjust by clicking on line."
|
||||||
#define COMMAND2 "Finish by clicking off bar."
|
#define COMMAND2 "Finish by clicking off bar."
|
||||||
|
|
||||||
|
|
||||||
/* There is a delay between when the VIC sends its signal, and when the display
|
/* There is a delay between when the VIC sends its signal, and when the display
|
||||||
** shows that signal. There is another delay between the display and when the
|
** shows that signal. There is another delay between the display and when the
|
||||||
** lightpen says that it saw that signal. Each display and pen is different.
|
** lightpen says that it saw that signal. Each display and pen is different.
|
||||||
** Therefore, the driver must be calibrated to them. A white bar is painted on
|
** Therefore, the driver must be calibrated to them. A white bar is painted on
|
||||||
** the screen; and, a line is drawn down the middle of it. When the user
|
** the screen; and, a line is drawn down the middle of it. When the user
|
||||||
** clicks on that line, the difference between its position and where the VIC
|
** clicks on that line, the difference between its position and where the VIC
|
||||||
** thinks that the pen is pointing becomes an offset that is subtracted from
|
** thinks that the pen is pointing becomes an offset that is subtracted from
|
||||||
** what the VIC sees.
|
** what the VIC sees.
|
||||||
*/
|
*/
|
||||||
void __fastcall__ pen_calibrate (unsigned char *XOffset)
|
void __fastcall__ pen_calibrate (unsigned char *XOffset)
|
||||||
{
|
{
|
||||||
unsigned char oldBg = bgcolor (COLOR_BLUE);
|
unsigned char oldBg = bgcolor (COLOR_BLUE);
|
||||||
unsigned char oldText = textcolor (COLOR_GRAY3);
|
unsigned char oldText = textcolor (COLOR_GRAY3);
|
||||||
unsigned char oldRev = revers (1);
|
unsigned char oldRev = revers (1);
|
||||||
unsigned char sprite0Color = VIC.spr_color[0];
|
unsigned char sprite0Color = VIC.spr_color[0];
|
||||||
unsigned char width, width2, height, height4, height8;
|
unsigned char width, width2, height, height4, height8;
|
||||||
struct mouse_info info;
|
struct mouse_info info;
|
||||||
|
|
||||||
screensize (&width, &height);
|
screensize (&width, &height);
|
||||||
width2 = width / 2;
|
width2 = width / 2;
|
||||||
height4 = height / 4;
|
height4 = height / 4;
|
||||||
height8 = height4 * 8;
|
height8 = height4 * 8;
|
||||||
|
|
||||||
/* Draw a bar and line. */
|
/* Draw a bar and line. */
|
||||||
|
|
||||||
clrscr ();
|
clrscr ();
|
||||||
cclearxy (0, height4, height4 * width);
|
cclearxy (0, height4, height4 * width);
|
||||||
cvlinexy (width2, height4 + 1, height4 - 2);
|
cvlinexy (width2, height4 + 1, height4 - 2);
|
||||||
|
|
||||||
/* Print instructions. */
|
/* Print instructions. */
|
||||||
|
|
||||||
revers (0);
|
revers (0);
|
||||||
cputsxy (width2 - (sizeof COMMAND1) / 2, height / 2 + 1, COMMAND1);
|
cputsxy (width2 - (sizeof COMMAND1) / 2, height / 2 + 1, COMMAND1);
|
||||||
cputsxy (width2 - (sizeof COMMAND2) / 2, height / 2 + 3, COMMAND2);
|
cputsxy (width2 - (sizeof COMMAND2) / 2, height / 2 + 3, COMMAND2);
|
||||||
|
|
||||||
VIC.spr_color[0] = COLOR_GRAY2;
|
VIC.spr_color[0] = COLOR_GRAY2;
|
||||||
mouse_show ();
|
mouse_show ();
|
||||||
mouse_move (width2 * 8, height8 / 2);
|
mouse_move (width2 * 8, height8 / 2);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Wait for the main button to be released. */
|
/* Wait for the main button to be released. */
|
||||||
|
|
||||||
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
/* Wait for the main button to be pressed. */
|
/* Wait for the main button to be pressed. */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
mouse_info (&info);
|
mouse_info (&info);
|
||||||
} while (!(info.buttons & MOUSE_BTN_LEFT));
|
} while (!(info.buttons & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
/* Find out if the pen is on or off the bar. */
|
/* Find out if the pen is on or off the bar. */
|
||||||
|
|
||||||
if (info.pos.y < height8 || info.pos.y >= height8 * 2) {
|
if (info.pos.y < height8 || info.pos.y >= height8 * 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On the bar; adjust the offset. */
|
/* On the bar; adjust the offset. */
|
||||||
/* Characters are eight pixels wide.
|
/* Characters are eight pixels wide.
|
||||||
** The VIC-II sees every other pixel;
|
** The VIC-II sees every other pixel;
|
||||||
** so, we use half of the difference.
|
** so, we use half of the difference.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*XOffset += (info.pos.x - (width2 * 8 + 8/2)) / 2;
|
*XOffset += (info.pos.x - (width2 * 8 + 8/2)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Off the bar; wait for the main button to be released. */
|
/* Off the bar; wait for the main button to be released. */
|
||||||
|
|
||||||
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
mouse_hide ();
|
mouse_hide ();
|
||||||
VIC.spr_color[0] = sprite0Color;
|
VIC.spr_color[0] = sprite0Color;
|
||||||
revers (oldRev);
|
revers (oldRev);
|
||||||
textcolor (oldText);
|
textcolor (oldText);
|
||||||
bgcolor (oldBg);
|
bgcolor (oldBg);
|
||||||
clrscr ();
|
clrscr ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
;
|
;
|
||||||
; Pointer for library references by device drivers.
|
; Pointer for library references by device drivers.
|
||||||
;
|
;
|
||||||
; 2013-07-25, Greg King
|
; 2013-07-25, Greg King
|
||||||
;
|
;
|
||||||
|
|
||||||
.export mouse_libref, _pen_adjuster
|
.export mouse_libref, _pen_adjuster
|
||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
mouse_libref: ; generic label for mouse-kernel
|
mouse_libref: ; generic label for mouse-kernel
|
||||||
|
|
||||||
; A program optionally can set this pointer to a function that gives
|
; A program optionally can set this pointer to a function that gives
|
||||||
; a calibration value to a driver. If this pointer isn't NULL,
|
; a calibration value to a driver. If this pointer isn't NULL,
|
||||||
; then a driver that wants a value can call that function.
|
; then a driver that wants a value can call that function.
|
||||||
;
|
;
|
||||||
; The function might read a value from a file; or, it might ask the user
|
; The function might read a value from a file; or, it might ask the user
|
||||||
; to help calibrate the driver.
|
; to help calibrate the driver.
|
||||||
;
|
;
|
||||||
; void __fastcall__ (*pen_adjuster)(unsigned char *) = NULL;
|
; void __fastcall__ (*pen_adjuster)(unsigned char *) = NULL;
|
||||||
;
|
;
|
||||||
_pen_adjuster:
|
_pen_adjuster:
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
|
@ -1,94 +1,94 @@
|
||||||
/*
|
/*
|
||||||
** Calibrate lightpen drivers to the current video hardware.
|
** Calibrate lightpen drivers to the current video hardware.
|
||||||
**
|
**
|
||||||
** 2013-07-25, Greg King
|
** 2013-07-25, Greg King
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <mouse.h>
|
#include <mouse.h>
|
||||||
#include <pen.h>
|
#include <pen.h>
|
||||||
|
|
||||||
|
|
||||||
#define COMMAND1 "Adjust by clicking on line."
|
#define COMMAND1 "Adjust by clicking on line."
|
||||||
#define COMMAND2 "Finish by clicking off bar."
|
#define COMMAND2 "Finish by clicking off bar."
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** There is a delay between when the VIC sends its signal, and when the display
|
** There is a delay between when the VIC sends its signal, and when the display
|
||||||
** shows that signal. There is another delay between the display and when
|
** shows that signal. There is another delay between the display and when
|
||||||
** the lightpen says that it saw that signal. Each display and pen is different.
|
** the lightpen says that it saw that signal. Each display and pen is different.
|
||||||
** Therefore, the driver must be calibrated to them. A white bar is painted on
|
** Therefore, the driver must be calibrated to them. A white bar is painted on
|
||||||
** the screen; and, a line is drawn down the middle of it. When the user clicks
|
** the screen; and, a line is drawn down the middle of it. When the user clicks
|
||||||
** on that line, the difference between its position and where the VIC thinks
|
** on that line, the difference between its position and where the VIC thinks
|
||||||
** that the pen is pointing becomes an offset that is subtracted from what the
|
** that the pen is pointing becomes an offset that is subtracted from what the
|
||||||
** VIC sees.
|
** VIC sees.
|
||||||
*/
|
*/
|
||||||
void __fastcall__ pen_calibrate (unsigned char *XOffset)
|
void __fastcall__ pen_calibrate (unsigned char *XOffset)
|
||||||
{
|
{
|
||||||
unsigned char oldBg = bgcolor (COLOR_BLUE);
|
unsigned char oldBg = bgcolor (COLOR_BLUE);
|
||||||
unsigned char oldText = textcolor (COLOR_GRAY3);
|
unsigned char oldText = textcolor (COLOR_GRAY3);
|
||||||
unsigned char oldRev = revers (1);
|
unsigned char oldRev = revers (1);
|
||||||
unsigned char sprite0Color = VIC.spr_color[0];
|
unsigned char sprite0Color = VIC.spr_color[0];
|
||||||
unsigned char width, width2, height, height4, height8;
|
unsigned char width, width2, height, height4, height8;
|
||||||
struct mouse_info info;
|
struct mouse_info info;
|
||||||
|
|
||||||
screensize (&width, &height);
|
screensize (&width, &height);
|
||||||
width2 = width / 2;
|
width2 = width / 2;
|
||||||
height4 = height / 4;
|
height4 = height / 4;
|
||||||
height8 = height4 * 8;
|
height8 = height4 * 8;
|
||||||
|
|
||||||
/* Draw a bar and line. */
|
/* Draw a bar and line. */
|
||||||
|
|
||||||
clrscr ();
|
clrscr ();
|
||||||
cclearxy (0, height4, height4 * width);
|
cclearxy (0, height4, height4 * width);
|
||||||
cvlinexy (width2, height4 + 1, height4 - 2);
|
cvlinexy (width2, height4 + 1, height4 - 2);
|
||||||
revers (0);
|
revers (0);
|
||||||
|
|
||||||
/* Print instructions. */
|
/* Print instructions. */
|
||||||
|
|
||||||
cputsxy (width2 - (sizeof COMMAND1) / 2, height / 2 + 1, COMMAND1);
|
cputsxy (width2 - (sizeof COMMAND1) / 2, height / 2 + 1, COMMAND1);
|
||||||
cputsxy (width2 - (sizeof COMMAND2) / 2, height / 2 + 3, COMMAND2);
|
cputsxy (width2 - (sizeof COMMAND2) / 2, height / 2 + 3, COMMAND2);
|
||||||
|
|
||||||
VIC.spr_color[0] = COLOR_GRAY2;
|
VIC.spr_color[0] = COLOR_GRAY2;
|
||||||
mouse_show ();
|
mouse_show ();
|
||||||
mouse_move (width2 * 8, height8 / 2);
|
mouse_move (width2 * 8, height8 / 2);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Wait for the main button to be released. */
|
/* Wait for the main button to be released. */
|
||||||
|
|
||||||
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
/* Wait for the main button to be pressed. */
|
/* Wait for the main button to be pressed. */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
mouse_info (&info);
|
mouse_info (&info);
|
||||||
} while (!(info.buttons & MOUSE_BTN_LEFT));
|
} while (!(info.buttons & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
/* Find out if the pen is on or off the bar. */
|
/* Find out if the pen is on or off the bar. */
|
||||||
|
|
||||||
if (info.pos.y < height8 || info.pos.y >= height8 * 2) {
|
if (info.pos.y < height8 || info.pos.y >= height8 * 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On the bar; adjust the offset. */
|
/* On the bar; adjust the offset. */
|
||||||
/* Characters are eight pixels wide.
|
/* Characters are eight pixels wide.
|
||||||
** The VIC-II sees every other pixel;
|
** The VIC-II sees every other pixel;
|
||||||
** so, we use half of the difference.
|
** so, we use half of the difference.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*XOffset += (info.pos.x - (width2 * 8 + 8/2)) / 2;
|
*XOffset += (info.pos.x - (width2 * 8 + 8/2)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Off the bar; wait for the main button to be released. */
|
/* Off the bar; wait for the main button to be released. */
|
||||||
|
|
||||||
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
do ; while ((mouse_buttons () & MOUSE_BTN_LEFT));
|
||||||
|
|
||||||
mouse_hide ();
|
mouse_hide ();
|
||||||
VIC.spr_color[0] = sprite0Color;
|
VIC.spr_color[0] = sprite0Color;
|
||||||
revers (oldRev);
|
revers (oldRev);
|
||||||
textcolor (oldText);
|
textcolor (oldText);
|
||||||
bgcolor (oldBg);
|
bgcolor (oldBg);
|
||||||
clrscr ();
|
clrscr ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
/*
|
/*
|
||||||
** Main lightpen driver calibration functions.
|
** Main lightpen driver calibration functions.
|
||||||
**
|
**
|
||||||
** 2013-07-25, Greg King
|
** 2013-07-25, Greg King
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pen.h>
|
#include <pen.h>
|
||||||
|
|
||||||
|
|
||||||
static const char *name;
|
static const char *name;
|
||||||
|
|
||||||
|
|
||||||
/* Get a lightpen calibration value from a file if it exists. Otherwise, call
|
/* Get a lightpen calibration value from a file if it exists. Otherwise, call
|
||||||
** pen_calibrate() to create a value; then, write it into a file, so that it
|
** pen_calibrate() to create a value; then, write it into a file, so that it
|
||||||
** will be available at the next time that the lightpen is used.
|
** will be available at the next time that the lightpen is used.
|
||||||
** Might change the screen.
|
** Might change the screen.
|
||||||
*/
|
*/
|
||||||
static void __fastcall__ adjuster (unsigned char *XOffset)
|
static void __fastcall__ adjuster (unsigned char *XOffset)
|
||||||
{
|
{
|
||||||
int fd = open (name, O_RDONLY);
|
int fd = open (name, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
pen_calibrate (XOffset);
|
pen_calibrate (XOffset);
|
||||||
fd = open (name, O_WRONLY | O_CREAT | O_EXCL);
|
fd = open (name, O_WRONLY | O_CREAT | O_EXCL);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
(void) write (fd, XOffset, 1);
|
(void) write (fd, XOffset, 1);
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void) read (fd, XOffset, 1);
|
(void) read (fd, XOffset, 1);
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* pen_adjust() is optional; if you want to use its feature,
|
/* pen_adjust() is optional; if you want to use its feature,
|
||||||
** then it must be called before a driver is installed.
|
** then it must be called before a driver is installed.
|
||||||
** Note: This function merely saves the file-name pointer, and sets
|
** Note: This function merely saves the file-name pointer, and sets
|
||||||
** the pen_adjuster pointer. The file will be read only when a driver
|
** the pen_adjuster pointer. The file will be read only when a driver
|
||||||
** is installed, and only if that driver wants to be calibrated.
|
** is installed, and only if that driver wants to be calibrated.
|
||||||
*/
|
*/
|
||||||
void __fastcall__ pen_adjust (const char *filename)
|
void __fastcall__ pen_adjust (const char *filename)
|
||||||
{
|
{
|
||||||
if (filename != NULL && filename[0] != '\0') {
|
if (filename != NULL && filename[0] != '\0') {
|
||||||
name = filename;
|
name = filename;
|
||||||
pen_adjuster = adjuster;
|
pen_adjuster = adjuster;
|
||||||
} else {
|
} else {
|
||||||
pen_adjuster = pen_calibrate;
|
pen_adjuster = pen_calibrate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user