Fixes from Sigrid for plan9

This commit is contained in:
neauoire 2021-03-16 09:01:47 -07:00
parent aefa988430
commit 3eb3ea81a7
3 changed files with 22 additions and 15 deletions

View File

@ -448,12 +448,18 @@ int
main(int argc, char *argv[])
{
FILE *f;
if(argc < 3)
return error("Input", "Missing");
if(!(f = fopen(argv[1], "r")))
return error("Open", "Failed");
if(!pass1(f) || !pass2(f))
return error("Assembly", "Failed");
if(argc < 3) {
error("Input", "Missing");
return 1;
}
if(!(f = fopen(argv[1], "r"))) {
error("Open", "Failed");
return 1;
}
if(!pass1(f) || !pass2(f)) {
error("Assembly", "Failed");
return 1;
}
fwrite(p.data, sizeof(p.data), 1, fopen(argv[2], "wb"));
fclose(f);
cleanup(argv[2]);

View File

@ -58,13 +58,13 @@ Uint8 icons[][8] = {
{0x00, 0x7e, 0x40, 0x7c, 0x40, 0x40, 0x7e, 0x00},
{0x00, 0x7e, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x00}};
SDL_Window *gWindow;
SDL_Renderer *gRenderer;
SDL_Texture *gTexture;
Uint32 *pixels;
static SDL_Window *gWindow;
static SDL_Renderer *gRenderer;
static SDL_Texture *gTexture;
static Uint32 *pixels;
Screen screen;
Device *devscreen, *devmouse, *devkey, *devctrl;
static Screen screen;
static Device *devscreen, *devmouse, *devkey, *devctrl;
#pragma mark - Helpers
@ -252,6 +252,7 @@ init(void)
if(!(pixels = (Uint32 *)malloc(WIDTH * HEIGHT * sizeof(Uint32))))
return error("Pixels", "Failed to allocate memory");
clear(pixels);
SDL_StartTextInput();
SDL_ShowCursor(SDL_DISABLE);
screen.bounds.x1 = PAD * 8;
screen.bounds.x2 = WIDTH - PAD * 8 - 1;
@ -385,7 +386,7 @@ sprite_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
Uint8
file_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
{
char *name = &m[(m[ptr + 8] << 8) + m[ptr + 8 + 1]];
char *name = (char *)&m[(m[ptr + 8] << 8) + m[ptr + 8 + 1]];
Uint16 length = (m[ptr + 8 + 2] << 8) + m[ptr + 8 + 3];
if(b0 == 0x0d) {
Uint16 addr = (m[ptr + 8 + 4] << 8) + b1;

4
uxn.c
View File

@ -196,8 +196,8 @@ int
bootuxn(Uxn *u)
{
size_t i;
char *cptr = (char *)&u;
for(i = 0; i < sizeof u; i++)
char *cptr = (char *)u;
for(i = 0; i < sizeof(*u); i++)
cptr[i] = 0;
return 1;
}