commit 3eb3ea81a70cef9e18e53599863d217b1afadcea
parent aefa988430da4467c181188ef9bf2f3b51186a19
Author: neauoire <aliceffekt@gmail.com>
Date: Tue, 16 Mar 2021 09:01:47 -0700
Fixes from Sigrid for plan9
Diffstat:
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/assembler.c b/assembler.c
@@ -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]);
diff --git a/emulator.c b/emulator.c
@@ -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;
diff --git a/uxn.c b/uxn.c
@@ -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;
}