fix: correction couleurs vers 32 bits maximum, mise en place du deboguage pas a pas.
This commit is contained in:
parent
d0d125bbf8
commit
f4b3ea6c10
|
@ -2,7 +2,7 @@ target remote localhost:1234
|
||||||
set disassembly-flavor intel
|
set disassembly-flavor intel
|
||||||
set architecture i386
|
set architecture i386
|
||||||
symbol-file ./system/system.sys
|
symbol-file ./system/system.sys
|
||||||
break main
|
break system.c:50
|
||||||
cont
|
cont
|
||||||
clear main
|
clear system.c:50
|
||||||
display/20i $pc
|
display/20i $pc
|
||||||
|
|
11
include/2d.h
11
include/2d.h
|
@ -4,11 +4,10 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
typedef struct vertex2d{
|
typedef struct vertex2d{
|
||||||
u32 x;
|
u16 x;
|
||||||
u32 y;
|
u16 y;
|
||||||
} vertex2d __attribute__ ((packed));
|
} vertex2d __attribute__ ((packed));
|
||||||
|
|
||||||
void linev(vertex2d *A, vertex2d *B, u8 color);
|
void linev(vertex2d *A, vertex2d *B, u32 color);
|
||||||
void hline(u32 x1, u32 x2, u32 y, u8 color);
|
void trianglefilled(vertex2d *A, vertex2d *B, vertex2d *C, u32 color);
|
||||||
void trianglefilled(vertex2d *A, vertex2d *B, vertex2d *C, u8 color);
|
void triangle(vertex2d *A, vertex2d *B, vertex2d *C, u32 color);
|
||||||
void triangle(vertex2d *A, vertex2d *B, vertex2d *C, u8 color);
|
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
#define dumpcpu() asm("\
|
#define dumpcpu() asm("\
|
||||||
mov $0x6666666, %%eax \n \
|
|
||||||
mov $0x8888888, %%ebx \n \
|
|
||||||
pushal \n \
|
pushal \n \
|
||||||
pushf \n \
|
pushf \n \
|
||||||
pushl %%cs\n \
|
pushl %%cs\n \
|
||||||
|
|
|
@ -96,7 +96,8 @@ void showchar (u16 coordx, u16 coordy, u8 thechar, u8 attrib);
|
||||||
u8 getchar (u16 coordx, u16 coordy);
|
u8 getchar (u16 coordx, u16 coordy);
|
||||||
u8 getattrib (u16 coordx, u16 coordy);
|
u8 getattrib (u16 coordx, u16 coordy);
|
||||||
void writepxl (u16 x, u16 y, u32 color);
|
void writepxl (u16 x, u16 y, u32 color);
|
||||||
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color);
|
void line(u32 x1, u32 y1, u32 x2, u32 y2, u32 color);
|
||||||
|
void hline(u16 x1, u16 x2, u16 y, u32 color);
|
||||||
void changemode(u8 mode);
|
void changemode(u8 mode);
|
||||||
u32 egatorgb(u8 ega);
|
u32 egatorgb(u8 ega);
|
||||||
u8 egatovga(u8 ega);
|
u8 egatovga(u8 ega);
|
||||||
|
|
8
lib/2d.c
8
lib/2d.c
|
@ -10,12 +10,12 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Affiche une ligne entre les points spécifiés */
|
/* Affiche une ligne entre les points spécifiés */
|
||||||
|
|
||||||
void linev(vertex2d * A, vertex2d * B, u8 color)
|
void linev(vertex2d * A, vertex2d * B, u32 color)
|
||||||
{
|
{
|
||||||
line(A->x, A->y, B->x, B->y, color);
|
line(A->x, A->y, B->x, B->y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color)
|
void line(u32 x1, u32 y1, u32 x2, u32 y2, u32 color)
|
||||||
{
|
{
|
||||||
s32 dx, dy, sdx, sdy;
|
s32 dx, dy, sdx, sdy;
|
||||||
u32 i, dxabs, dyabs, x, y, px, py;
|
u32 i, dxabs, dyabs, x, y, px, py;
|
||||||
|
@ -60,7 +60,7 @@ void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Affiche un triangle rempli entre les points spécifiés */
|
/* Affiche un triangle rempli entre les points spécifiés */
|
||||||
|
|
||||||
void trianglefilled(vertex2d * AA, vertex2d * BB, vertex2d * CC, u8 color)
|
void trianglefilled(vertex2d * AA, vertex2d * BB, vertex2d * CC, u32 color)
|
||||||
{
|
{
|
||||||
vertex2d *A, *B, *C, *TEMP;
|
vertex2d *A, *B, *C, *TEMP;
|
||||||
u32 a, b, y, last;
|
u32 a, b, y, last;
|
||||||
|
@ -132,7 +132,7 @@ void swapvertex(vertex2d * A, vertex2d * B)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Affiche un triangle entre les points spécifiés */
|
/* Affiche un triangle entre les points spécifiés */
|
||||||
|
|
||||||
void triangle(vertex2d * AA, vertex2d * BB, vertex2d * CC, u8 color)
|
void triangle(vertex2d * AA, vertex2d * BB, vertex2d * CC, u32 color)
|
||||||
{
|
{
|
||||||
line(AA->x, AA->y, BB->x, BB->y, color);
|
line(AA->x, AA->y, BB->x, BB->y, color);
|
||||||
line(BB->x, BB->y, CC->x, CC->y, color);
|
line(BB->x, BB->y, CC->x, CC->y, color);
|
||||||
|
|
54
lib/debug.c
54
lib/debug.c
|
@ -25,10 +25,10 @@ void cleardebugreg(u8* address)
|
||||||
u8* getdebugreg(u8 number)
|
u8* getdebugreg(u8 number)
|
||||||
{
|
{
|
||||||
u8* address;
|
u8* address;
|
||||||
if (number==0) asm("mov %%eax,%%dr0; movl %%eax,%[address]":[address] "=m" (address)::);
|
if (number==0) asm("mov %%dr0,%%eax; mov %%eax,%[address]":[address] "=m" (address)::);
|
||||||
else if (number==1) asm("mov %%eax,%%dr1; movl %%eax,%[address]":[address] "=m" (address)::);
|
else if (number==1) asm("mov %%dr1,%%eax; movl %%eax,%[address]":[address] "=m" (address)::);
|
||||||
else if (number==2) asm("mov %%eax,%%dr2; movl %%eax,%[address]":[address] "=m" (address)::);
|
else if (number==2) asm("mov %%dr2,%%eax; movl %%eax,%[address]":[address] "=m" (address)::);
|
||||||
else if (number==3) asm("mov %%eax,%%dr3; movl %%eax,%[address]":[address] "=m" (address)::);
|
else if (number==3) asm("mov %%dr0,%%eax; movl %%eax,%[address]":[address] "=m" (address)::);
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ u16 decodeModSM(bool show, u8 *a, u8 *op, u16 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
switch(*b & 0xc7){
|
switch(*b & 0xc7){
|
||||||
|
@ -368,7 +368,7 @@ u16 decodeModSM(bool show, u8 *a, u8 *op, u16 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ u32 decodeModSM_float(bool show, u8 *a, u8 *op, u32 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
switch(*b & 0xc7){
|
switch(*b & 0xc7){
|
||||||
|
@ -694,7 +694,7 @@ u32 decodeModSM_float(bool show, u8 *a, u8 *op, u32 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ u32 decodeModSM_memonly(bool show, u8 *a, u8 *op, u32 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
switch(*b&0xc7){
|
switch(*b&0xc7){
|
||||||
|
@ -972,7 +972,7 @@ u32 decodeModSM_memonly(bool show, u8 *a, u8 *op, u32 order, u32 Gsz, u32 Esz){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
if(*b == 0x0f){
|
if(*b == 0x0f){
|
||||||
|
|
||||||
if (show) print("Extended opcodes not implimented.\r\n");
|
if (show) print("Extended opcodes not implimented.\r\n");
|
||||||
return;
|
return 1000;
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
|
|
||||||
|
@ -1606,7 +1606,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
||||||
|
@ -1640,7 +1640,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
if(flip_imm_sz){
|
if(flip_imm_sz){
|
||||||
|
@ -1680,7 +1680,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
||||||
|
@ -1714,7 +1714,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
||||||
|
@ -2056,7 +2056,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
||||||
|
@ -2090,7 +2090,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
snprintf(op1+len, sizeof(op1)-len, ", %x", *(u8 *)++b);
|
||||||
|
@ -2188,7 +2188,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", 1");
|
snprintf(op1+len, sizeof(op1)-len, ", 1");
|
||||||
|
@ -2222,7 +2222,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", 1");
|
snprintf(op1+len, sizeof(op1)-len, ", 1");
|
||||||
|
@ -2256,7 +2256,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", cl");
|
snprintf(op1+len, sizeof(op1)-len, ", cl");
|
||||||
|
@ -2290,7 +2290,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
len = strlen(op1);
|
len = strlen(op1);
|
||||||
snprintf(op1+len, sizeof(op1)-len, ", cl");
|
snprintf(op1+len, sizeof(op1)-len, ", cl");
|
||||||
|
@ -2352,7 +2352,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2485,7 +2485,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xf7:
|
case 0xf7:
|
||||||
|
@ -2533,7 +2533,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xf8:
|
case 0xf8:
|
||||||
|
@ -2562,7 +2562,7 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
s = "dec";
|
s = "dec";
|
||||||
} else{
|
} else{
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
|
@ -2597,12 +2597,12 @@ u32 disasm(u8 *a, u8 *string, bool show){
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("Invalid Mod R/M byte.");
|
if (show) print("Invalid Mod R/M byte.");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (show) print("invalid opcode\r\n");
|
if (show) print("invalid opcode\r\n");
|
||||||
return;
|
return 1000;
|
||||||
}
|
}
|
||||||
strcompressdelimiter(s,' ');
|
strcompressdelimiter(s,' ');
|
||||||
if (show)
|
if (show)
|
||||||
|
|
|
@ -185,20 +185,41 @@ void exception1()
|
||||||
cli();
|
cli();
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
save_stack *dump = getESP();
|
||||||
exception_stack_noerror *current = getESP()+36;
|
exception_stack_noerror *current;
|
||||||
|
dump->eip=getdebugreg(0);
|
||||||
|
for(u32 *addr=dump;addr<KERNEL_STACK_ADDR;addr++)
|
||||||
|
{
|
||||||
|
if (*addr==dump->eip && *(addr+1)==SEL_KERNEL_CODE)
|
||||||
|
{
|
||||||
|
current = addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
dump->cs=current->cs;
|
||||||
dump->oldesp=(current+1);
|
dump->oldesp=(current+1);
|
||||||
changevc(6);
|
changevc(6);
|
||||||
clearscreen();
|
clearscreen();
|
||||||
show_lightcpu(&dump);
|
show_lightcpu(dump);
|
||||||
setdebugreg(0,0, DBG_CLEAR);
|
printf("\r\n\033[7m[P]\033[0m PAS A PAS \033[7m D \033[0m PAS A PAS DETAILLE \033[7m C \033[0m CONTINUER \033[7m S \033[0m STOPPER \033[7m V \033[0m VOIR \033[7m S \033[0m SCINDER");
|
||||||
sti();
|
sti();
|
||||||
waitascii();
|
u8 ascii=waitascii();
|
||||||
cli();
|
cli();
|
||||||
|
if (ascii=='P' || ascii=='p')
|
||||||
|
setdebugreg(0,current->eip+disasm(current->eip, NULL, false), DBG_EXEC);
|
||||||
|
if (ascii=='D' || ascii=='d')
|
||||||
|
setdebugreg(0,0, DBG_CLEAR);
|
||||||
|
else if (ascii=='C' || ascii=='c')
|
||||||
|
setdebugreg(0,0, DBG_CLEAR);
|
||||||
|
else if (ascii=='S' || ascii=='s')
|
||||||
|
{
|
||||||
|
changevc(0);
|
||||||
|
sti();
|
||||||
|
initselectors(retry_address);
|
||||||
|
}
|
||||||
changevc(0);
|
changevc(0);
|
||||||
restcpu();
|
restcpu();
|
||||||
asm("addl $0x01C, %esp;");
|
asm("addl $0x028, %esp;popl %ebx;");
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
lib/mouse.c
13
lib/mouse.c
|
@ -113,8 +113,9 @@ void mouse(void)
|
||||||
if (mousey >= 65535) {
|
if (mousey >= 65535) {
|
||||||
mousey = 65535;
|
mousey = 65535;
|
||||||
}
|
}
|
||||||
u16 newx = (u32) mousex * getwidth() / 65536;
|
videoinfos *info=getvideo_info();
|
||||||
u16 newy = (u32) mousey * getheight() / 65536;
|
u16 newx = (u32) mousex * info->currentwidth / 65536;
|
||||||
|
u16 newy = (u32) mousey * info->currentheight / 65536;
|
||||||
|
|
||||||
// Retrieve mouse button status from packet
|
// Retrieve mouse button status from packet
|
||||||
mousebut1 = mpacket[0] & 1;
|
mousebut1 = mpacket[0] & 1;
|
||||||
|
@ -123,14 +124,8 @@ void mouse(void)
|
||||||
|
|
||||||
// printf("RX:%d\tRY:%d\tX:%d\tY:%d\tB1:%d\tB2:%d\tB3:%d\t\r\n",changex,changey,mousex,mousey,mousebut1,mousebut2,mousebut3);
|
// printf("RX:%d\tRY:%d\tX:%d\tY:%d\tB1:%d\tB2:%d\tB3:%d\t\r\n",changex,changey,mousex,mousey,mousebut1,mousebut2,mousebut3);
|
||||||
|
|
||||||
if ((newx != oldx) || (newy != oldy)) {
|
if (!info->isgraphic)
|
||||||
showchar(oldx, oldy, oldchar, oldattr);
|
|
||||||
oldx = newx;
|
|
||||||
oldy = newy;
|
|
||||||
oldchar = getchar(oldx, oldy);
|
|
||||||
oldattr = getattrib(oldx, oldy);
|
|
||||||
showchar(newx, newy, 0xDB, 0x0F);
|
showchar(newx, newy, 0xDB, 0x0F);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endofint:
|
endofint:
|
||||||
irqendmaster();
|
irqendmaster();
|
||||||
|
|
16
lib/shell.c
16
lib/shell.c
|
@ -420,10 +420,14 @@ int rebootnow()
|
||||||
|
|
||||||
int test2d()
|
int test2d()
|
||||||
{
|
{
|
||||||
changemode(0x83);
|
|
||||||
videoinfos *vinfo=getvideo_info();
|
videoinfos *vinfo=getvideo_info();
|
||||||
|
if (!vinfo->isgraphic) {
|
||||||
|
print("Mode graphique necessaire afin de lancer ce programme\r\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
struct vertex2d a, b, c;
|
struct vertex2d a, b, c;
|
||||||
randomize();
|
randomize();
|
||||||
|
u32 color;
|
||||||
for (int i = 0; i < 3000; i++) {
|
for (int i = 0; i < 3000; i++) {
|
||||||
a.x = random(0, vinfo->currentwidth);
|
a.x = random(0, vinfo->currentwidth);
|
||||||
a.y = random(0, vinfo->currentheight);
|
a.y = random(0, vinfo->currentheight);
|
||||||
|
@ -431,8 +435,14 @@ int test2d()
|
||||||
b.y = random(0, vinfo->currentheight);
|
b.y = random(0, vinfo->currentheight);
|
||||||
c.x = random(0, vinfo->currentwidth);
|
c.x = random(0, vinfo->currentwidth);
|
||||||
c.y = random(0, vinfo->currentheight);
|
c.y = random(0, vinfo->currentheight);
|
||||||
trianglefilled(&a, &b, &c, random(0, 16));
|
if (vinfo->currentdepth>24)
|
||||||
triangle(&a, &b, &c, 2);
|
color=egatorgb(random(0,16));
|
||||||
|
else if (vinfo->currentdepth==8)
|
||||||
|
color=random(0,256);
|
||||||
|
else
|
||||||
|
color=random(0,16);
|
||||||
|
trianglefilled(&a, &b, &c, color);
|
||||||
|
triangle(&a, &b, &c, color);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,7 @@ u32 VESA_mem_to_video (void *src,u32 dst, u32 size, bool increment_src) {
|
||||||
case 32:
|
case 32:
|
||||||
if (!increment_src)
|
if (!increment_src)
|
||||||
{
|
{
|
||||||
u32 pattern = (u32) src;
|
stosd(src,realdst,size);
|
||||||
stosd(pattern,realdst,size);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1133,7 +1133,7 @@ u8 getattrib (u16 coordx, u16 coordy)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Affiche une ligne horizontale entre les points spécifiés */
|
/* Affiche une ligne horizontale entre les points spécifiés */
|
||||||
|
|
||||||
void hline(u32 x1, u32 x2, u32 y, u8 color)
|
void hline(u16 x1, u16 x2, u16 y, u32 color)
|
||||||
{
|
{
|
||||||
if (vinfo->isgraphic)
|
if (vinfo->isgraphic)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,5 +103,6 @@ int main(u32 magic, u32 addr)
|
||||||
ok();
|
ok();
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
sti();
|
||||||
shell();
|
shell();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue