Skip to content
Permalink
Browse files

Adds display pixel wrappers

  • Loading branch information...
Max Leiter
Max Leiter committed Mar 1, 2016
1 parent 7681d5b commit d50ffc682fdf2f44bdffb45f64270f16dfbfdfd9
Showing with 78 additions and 1 deletion.
  1. +15 −0 include/knightos/display.h
  2. +63 −1 src/knightos/display.c
@@ -91,4 +91,19 @@ void draw_long(SCREEN *screen, unsigned char x, unsigned char y, unsigned long v
* Set the left-margin for draw_string
**/
void set_left_margin(unsigned char margin);

/**
* Inverts a pixel on the screen buffer
**/
void invert_pixel(SCREEN *screen, char x, char y);

/**
* Resets a pixel on the screen buffer
**/
void reset_pixel(SCREEN *screen, char x, char y);

/**
* Sets a pixel on the screen buffer
**/
void set_pixel(SCREEN *screen, char x, char y);
#endif
@@ -264,4 +264,66 @@ void draw_short(SCREEN *screen, unsigned char x, unsigned char y, unsigned short
PUSH BC
__endasm;
screen; x; y; value;
}
}

void invert_pixel(SCREEN *screen, char x, char y) {
__asm
POP BC ; return
POP IY ; screen
DEC SP
POP AF ; x
DEC SP
POP HL ; y
; Swap H and L
ld l, h
PCALL(INVERTPIXEL)
PUSH HL
INC SP
PUSH AF
INC SP
PUSH IY
PUSH BC
__endasm;
screen; x; y;
}
void reset_pixel(SCREEN *screen, char x, char y) {
__asm
POP BC ; return
POP IY ; screen
DEC SP
POP AF ; x
DEC SP
POP HL ; y
; Swap H and L
ld l, h
PCALL(RESETPIXEL)
PUSH HL
INC SP
PUSH AF
INC SP
PUSH IY
PUSH BC
__endasm;
screen; x; y;
}

void set_pixel(SCREEN *screen, char x, char y) {
__asm
POP BC ; return
POP IY ; screen
DEC SP
POP AF ; x
DEC SP
POP HL ; y
; Swap H and L
ld l, h
PCALL(SETPIXEL)
PUSH HL
INC SP
PUSH AF
INC SP
PUSH IY
PUSH BC
__endasm;
screen; x; y;
}

0 comments on commit d50ffc6

Please sign in to comment.
You can’t perform that action at this time.