Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions elkscmd/gui/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ int event_wait_timeout(struct event *e, int timeout)
posy += y;
if (posx < 0) posx = 0;
if (posy < 0) posy = 0;
if ((drawing || altdrawing)){
if (posx >= SCREEN_WIDTH) posx = SCREEN_WIDTH - 1;
if (posy >= SCREEN_HEIGHT) posy = SCREEN_HEIGHT - 1;
} else {
//if ((drawing || altdrawing)){
//if (posx >= SCREEN_WIDTH) posx = SCREEN_WIDTH - 1;
//if (posy >= SCREEN_HEIGHT) posy = SCREEN_HEIGHT - 1;
//} else {
if (posx >= SCREENWIDTH) posx = SCREENWIDTH - 1;
if (posy >= SCREENHEIGHT) posy = SCREENHEIGHT - 1;
}
//}
event->x = posx;
event->y = posy;
event->xrel = x;
Expand Down
7 changes: 0 additions & 7 deletions elkscmd/gui/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,6 @@ void graphics_close(void)
set_mode(TEXT_MODE);
}

// Draw a horizontal line from x1,1 to x2,y including final point
void drawhline(int x1, int x2, int y, int c)
{
while (x1 <= x2)
drawpixel(x1++, y, c);
}

#ifdef __WATCOMC__
void drawpixel(int x, int y, int color)
{
Expand Down
6 changes: 2 additions & 4 deletions elkscmd/gui/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ int save_bmp(char *pathname);
#define readpixel(x,y) pal_readpixel(x,y)
#elif defined(__C86__) || defined(__ia16__) /* use ASM vga_ routines */
#define drawpixel(x,y,c) vga_drawpixel(x,y,c)
// #define drawhline(x1,x2,y,c) vga_drawhline(x1,x2,y,c)
#define drawhline(x1,x2,y,c) vga_drawhline(x1,x2,y,c)
#define drawvline(x,y1,y2,c) vga_drawvline(x,y1,y2,c)
#define readpixel(x,y) vga_readpixel(x,y)

void drawhline(int x1, int x2, int y, int c);
#else
void drawpixel(int x,int y, int color);
void drawhline(int x1, int x2, int y, int c);
Expand All @@ -40,7 +38,7 @@ void fillrect(int x1, int y1, int x2, int y2, int c);
/* VGA 16 color, 4bpp routines implemented in ASM in vga-ia16.S and vga-c86.s */
void vga_init(void);
void vga_drawpixel(int x, int y, int c);
// void vga_drawhline(int x1, int x2, int y, int c);
void vga_drawhline(int x1, int x2, int y, int c);
void vga_drawvline(int x, int y1, int y2, int c);
int vga_readpixel(int x, int y);

Expand Down
2 changes: 1 addition & 1 deletion elkscmd/gui/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void R_DrawCurrentColor(void)
int startingPixelXOffset = SCREEN_WIDTH + 10 + 32 + 1;
int startingPixelYOffset = 10 + 128 + 10;

fillrect(startingPixelXOffset, startingPixelYOffset, startingPixelXOffset + 61, \
fillrect(startingPixelXOffset, startingPixelYOffset, startingPixelXOffset + 61,
startingPixelYOffset + 29, currentMainColor);

// Draw white frame if the main color matches the panel backgound
Expand Down
5 changes: 1 addition & 4 deletions elkscmd/gui/vga-c86.s
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ _vga_init:
; static unsigned char mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
; //set_op(0);
; set_color(c);
; select_mask();
; set_mask(mask[x&7]);
;
.global _vga_drawpixel
Expand Down Expand Up @@ -106,14 +105,13 @@ _vga_drawpixel:
ret

;
; Draw a horizontal line from x1,1 to x2,y including final point
; Draw a horizontal line from x1,y to x2,y including final point
; void vga_drawhine(int x1, int x2, int y, int color);
;
; C version:
; set_color(c);
; //set_op(0);
; char far *dst = SCREENBASE + x1 / 8 + y * BYTESPERLN;
; select_mask();
; if (x1 / 8 == x2 / 8) {
; set_mask((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))));
; *dst |= 1;
Expand Down Expand Up @@ -265,7 +263,6 @@ L44: mov ah, bl ; AH := bit mask for last byte
; C version:
; //set_op(0);
; set_color(c);
; select_mask();
; set_mask(mask[x&7]);
; char far *dst = SCREENBASE + x / 8 + y1 * BYTESPERLN;
; char far *last = SCREENBASE + x / 8 + y2 * BYTESPERLN;
Expand Down
9 changes: 3 additions & 6 deletions elkscmd/gui/vga-ia16.S
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ vga_init:
// static unsigned char mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
// //set_op(0);
// set_color(c);
// select_mask();
// set_mask(mask[x&7]);
//
.global vga_drawpixel
Expand Down Expand Up @@ -107,14 +106,13 @@ vga_drawpixel:
ret

//
// Draw a horizontal line from x1,1 to x2,y including final point
// Draw a horizontal line from x1,y to x2,y including final point
// void vga_drawhine(int x1, int x2, int y, int color)
//
// C version:
// set_color(c);
// //set_op(0);
// char far *dst = SCREENBASE + x1 / 8 + y * BYTESPERLN;
// select_mask();
// if (x1 / 8 == x2 / 8) {
// set_mask((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))));
// *dst |= 1;
Expand Down Expand Up @@ -208,7 +206,7 @@ vga_drawhline:
// get Graphics Controller port address into DX
mov %dx, %bx // BH := bit mask for first byte
// BL := bit mask for last byte
mov $0x3ce, %dx // DX := Graphics Controller port
mov $0x03ce, %dx // DX := Graphics Controller port
mov $8, %al // AL := Bit mask Register number

// make video buffer addressable through DS:SI
Expand All @@ -223,7 +221,7 @@ vga_drawhline:
or %cx, %cx
jnz L42 // jump if more than one byte in the line

and %bl, %bh // BL := bit mask for the line
and %bh, %bl // BL := bit mask for the line
jmp L44

L42: mov %bh, %ah // AH := bit mask for first byte
Expand Down Expand Up @@ -266,7 +264,6 @@ L44: mov %bl, %ah // AH := bit mask for last byte
// C version:
// //set_op(0);
// set_color(c);
// select_mask();
// set_mask(mask[x&7]);
// char far *dst = SCREENBASE + x / 8 + y1 * BYTESPERLN;
// char far *last = SCREENBASE + x / 8 + y2 * BYTESPERLN;
Expand Down