Commit Graph

2259 Commits

Author SHA1 Message Date
~d6 0f3b59d481 Fix file_init as well as some bugs.
After this change, file_init will correctly wrap around in memory
like the other operations.

This commit also fixes a few issues I observed:

 - Hexadecimal numbers were garbled
 - Directories lacked a trailing slash
 - The size calculation was too pessimistic
2024-09-20 20:24:22 -04:00
Erik Osheim 1998e6cccc clean up directory entries 2024-09-20 10:57:03 -04:00
~d6 7fcd7ad635 (wip) Safely wrap memory access from File.
Previously we had a lot of places where &uxn.ram[addr] was being used without
checking that addr+length < 65536. In cases where that value is exceeded, the
reads/writes should wrap back around to the beginning of memory.

After this change, most of the accesses have been made safe.

Two places that are not (yet) converted:

 1. file_init: We already truncate reads past the end of ram.
 While this does is technically incorrect it will avoid memory
 corruption or crashing.

 2. file_read_dir: The code here still uses snprintf formatting.
2024-09-19 23:08:00 -04:00
~d6 df51651789 Update file_stat to match the existing documentation.
Previously, writing to the stat port would produce a line of text
similar to the listing used when reading a directory. This did not
match the documentation around the stat port.

After the change, writing an address to the stat port will fill that
address with bytes equal to the length parameter. These will either be
a hexadecimal file size, or else the same character repeated N times
according to the following logic:

 - path is a directory
 ? file size of path does not fit in N hexadecimal characters
 ! path is not readable

Note that unlike when reading a directory, the string will not include
the requested path, a newline, or a null terminator.
2024-09-19 14:06:03 -07:00
Devine Lu Linvega 0da4c3335d Merge branch 'main' of git.sr.ht:~rabbits/uxn 2024-09-17 18:10:02 -07:00
~d6 e772d56936 Support creating directories
Previously Varvara did not have a way to create new directories.
This change adds that capability without adding or modifying any
device ports.

The changes are:

 (1) When a filename ends in the directory separator, writing
     any value to File/write will create a directory. Unlike
     with regular files, the value is ignored.

 (2) When writing any path (regular files or directories) if
     there are missing parent directories Varvara will attempt
     to create them first. This behavior is similar to mkdir -p.

The directory separator is / on most platforms, and \ on Windows.
On POSIX platforms the directories will be created with permission
0755 (modified by the user's umask value).

This change has been tested and works in both uxnemu and uxncli.
2024-09-17 18:09:14 -07:00
Sigrid Solveig Haflínudóttir ea4aaca2a6 fix a clang warning 2024-08-29 19:43:00 +02:00
Sigrid Solveig Haflínudóttir 1e9795e179 fix all the warnings 2024-08-29 17:21:18 +02:00
Sigrid Solveig Haflínudóttir f3bc19a3e7 uxn core: enum -> const int; kencc does not like the same idents 2024-08-29 17:18:13 +02:00
Sigrid Solveig Haflínudóttir 5dcf31beec fix Plan 9 build 2024-08-29 17:08:10 +02:00
Devine Lu Linvega 6d5e3848bd (uxnasm) Check against label/macro overlaps 2024-08-25 10:19:19 -07:00
Devine Lu Linvega af59c09627 (uxnasm) Fixed issue where some unused labels did not throw a warning 2024-08-25 10:05:47 -07:00
Devine Lu Linvega 58d6594790 Silenced a few warnings 2024-08-25 09:26:18 -07:00
Devine Lu Linvega 14ff615b8d (pond.tal) Added a little demo that draws circles 2024-08-24 16:31:37 -07:00
Devine Lu Linvega 2d851369ec (pond.tal) Progress 2024-08-24 10:03:38 -07:00
Devine Lu Linvega d6c14dd24d (pond.tal) Starting new demo 2024-08-24 09:49:55 -07:00
Devine Lu Linvega 3a901ed0be (uxn.c) Removed need for stack pointer 2024-08-12 13:11:42 -07:00
Devine Lu Linvega 7d077eb2c6 Print 8 items on the stack 2024-08-11 13:30:23 -07:00
Devine Lu Linvega a9d7ff23a5 Tiny changes to the uxn core macros 2024-08-05 15:13:08 -07:00
Devine Lu Linvega bf10311d5a Force a redraw on screen change 2024-07-26 10:09:03 -07:00
Devine Lu Linvega 2f73bae07e Trying to tackle issue with undrawn region on screen 2024-07-26 08:54:22 -07:00
Devine Lu Linvega c1c9487057 Use global uxn instance for the audio thread 2024-07-26 07:57:08 -07:00
Devine Lu Linvega 21ce072e9d Fixed stack debugger 2024-07-15 13:41:02 -07:00
Devine Lu Linvega 215dc9db52 Updated devices 2024-07-15 12:12:10 -07:00
Devine Lu Linvega 1c74aa1731 (bifurcan) Improved responsiveness 2024-06-15 19:25:15 -08:00
Devine Lu Linvega 31b282d5de (bifurcan) Housekeeping 2024-06-15 18:27:58 -08:00
Devine Lu Linvega 07112d8f26 (neralie) Moved to uxn-utils 2024-06-14 10:46:12 -08:00
Devine Lu Linvega 598846a1b8 (dvd.tal) Change opcode not value 2024-06-05 08:09:40 -08:00
Devine Lu Linvega 987a3348a6 Fixed issue with invalid hexadecimal values 2024-05-30 18:37:49 -07:00
Devine Lu Linvega bb57b85f57 Fixed issue with comments in macros, fixed by jjbliss 2024-05-10 08:15:27 -07:00
Devine Lu Linvega 3a696f8fa9 Removed old tests 2024-05-06 08:23:27 -07:00
Devine Lu Linvega b0bfb38dcc Fixed typo in system expansion test 2024-04-15 17:12:24 -07:00
Devine Lu Linvega b7d80643e8 Fix non-ASCII bytes being detected as whitespace 2024-04-13 19:31:09 -07:00
Devine Lu Linvega 41567558bc (mandelbrot) Improvements from d6 2024-04-05 09:14:03 -07:00
Devine Lu Linvega 11d32db150 (uxnasm) Print token during nested macro error 2024-04-03 21:08:17 -07:00
Devine Lu Linvega fc7ae4301c (uxnasm) Only find hex glyph once 2024-04-03 20:58:55 -07:00
Devine Lu Linvega 182c727680 (uxnasm) Report the correct line number in references 2024-04-03 20:35:24 -07:00
Devine Lu Linvega aae4446dfb (uxnasm) References print file and line number 2024-04-03 20:21:13 -07:00
Devine Lu Linvega ab2dd4082a (uxnasm) No context for findopcode 2024-04-03 19:46:50 -07:00
Devine Lu Linvega 4331025178 (uxnasm) Report unknown mode 2024-04-03 19:37:16 -07:00
Devine Lu Linvega a74df86d06 (uxnasm) Fixed issue with skipped last token in include 2024-04-03 19:20:10 -07:00
Devine Lu Linvega 9564868464 (uxnasm) Fixed issue with long hex values 2024-04-03 09:08:28 -07:00
Devine Lu Linvega 01135b0bb4 (uxnasm) Allow lambdas in macros 2024-04-02 15:13:26 -07:00
Devine Lu Linvega fde8305d65 (uxnasm) Start line number at 1 2024-04-02 08:38:19 -07:00
Devine Lu Linvega fc6ec0b387 (uxnasm) Improved errors 2024-03-30 20:05:52 -07:00
Lobo Torres f6cda36187 (uxnasm) Explicit error for empty rom 2024-03-29 11:36:57 -07:00
Devine Lu Linvega e47a14f673 (uxnasm) Catch missized #hex 2024-03-29 10:43:22 -07:00
Devine Lu Linvega 68d6a5f604 (uxnasm) More explicit resolve errors 2024-03-29 10:26:25 -07:00
Devine Lu Linvega cdd6008b7a (uxnasm) Larger dict buffer 2024-03-28 20:33:28 -07:00
Devine Lu Linvega 80d01b7113 (uxnasm) Optimization 2024-03-28 20:25:16 -07:00