AminetAminet
Search:
85244 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/lang/micropython.lha

Mirror:Random
Showing: generic icon
No screenshot available
Short:MicroPython interpreter for Amiga68k
Author:Fabrice LABATUT
Uploader:fabrice labatut club-internet fr
Type:dev/lang
Version:1.27.0-build227
Architecture:m68k-amigaos >= 3.0
Date:2026-04-09
Requires:2 MB RAM (4 MB recommended for networking/TLS)
Replaces:dev/lang/micropython.lha
Distribution:Aminet
URL:https://github.com/OoZe1911/micropython-amiga-port
Download:dev/lang/micropython.lha - View contents
Readme:dev/lang/micropython.readme
Downloads:475

MicroPython for AmigaOS (m68k)
==============================

A port of MicroPython v1.27 (compatible Python 3.4) to AmigaOS,
targeting Motorola 68020+ processors. Runs on classic Amiga hardware
(A1200, A3000, A4000) and emulators (WinUAE, FS-UAE).

This port was developed by Fabrice with coding assistance from Claude
(Anthropic's AI), under Fabrice's direct supervision: architecture
decisions, implementation strategy, testing on real hardware/emulator,
and bug reports are all driven by Fabrice. Every change is reviewed
and validated before being committed.


Requirements
------------

  - AmigaOS 3.0 or higher
  - Motorola 68020 CPU or higher
  - 2 MB RAM minimum for simple scripts
  - 4 MB RAM recommended for networking and TLS
  - AmiSSL (optional, required for HTTPS/TLS support)


Usage
-----

  micropython                        ; interactive REPL
  micropython script.py              ; run a Python script
  micropython script.mpy             ; run precompiled bytecode
  micropython -c "print(2**32)"      ; run inline code
  micropython -m 512 script.py       ; run with 512 KB heap

The default heap size is 128 KB. Use -m to allocate more memory
(in KB). For example, downloading a web page may require 4 MB
of heap: micropython -m 4096 script.py

Press Ctrl-C at any time to interrupt a running script or a
time.sleep() call.


Features
--------

  - Full Python 3.4 compatibility (ROM_LEVEL_EVERYTHING):
    f-strings, set operations, OrderedDict, advanced slicing,
    descriptors, async/await, and more
  - Interactive REPL with readline support (cursor keys, history)
  - Script execution and inline code (-c option)
  - Configurable heap size (-m option)
  - Precompiled bytecode: import and execute .mpy files compiled
    with mpy-cross, either via import or directly from the command
    line (micropython script.mpy)
  - Ctrl-C (KeyboardInterrupt) support during script execution,
    loops, and time.sleep()
  - input() builtin for interactive user prompts
  - sys.stdin / sys.stdout / sys.stderr standard streams

  Modules included:
    re, json, math, struct, binascii, base64, time, datetime,
    random, hashlib (sha256), errno, platform, socket, ssl,
    urequests, deflate, gzip, zlib, zipfile, arexx, gc, sys, io

  File system support:
    Full open/read/write/close via VFS_POSIX. os.listdir,
    os.getcwd, os.chdir, os.mkdir, os.rmdir, os.remove,
    os.rename, os.stat, os.chmod, os.getprotect, os.setprotect,
    os.makedirs, os.walk, os.getenv, os.putenv, os.unsetenv,
    os.path with AmigaOS volume:path conventions.

  Networking:
    TCP/UDP sockets, DNS resolution via bsdsocket.library.
    HTTP client (urequests) with HTTP/1.1, chunked transfer
    encoding, gzip decompression.

  TLS/SSL (requires AmiSSL):
    HTTPS support via AmiSSL. The amissl.library must be
    installed on the Amiga. 4 MB RAM minimum is recommended
    when using TLS.

  ARexx IPC:
    Inter-process communication with AmigaOS applications via
    ARexx message ports. arexx.send() for one-shot commands,
    arexx.exists() to check port availability, arexx.ports()
    to list active ports, and arexx.Port() persistent client
    with context manager for efficient multi-command sessions.

  Platform detection:
    platform.amiga_info() shows CPU, FPU, chipset, Kickstart
    version, and available memory.


AmigaOS Path Conventions
------------------------

AmigaOS uses ":" to separate volumes from paths and "/" for
subdirectories:

  >>> import os
  >>> os.getcwd()
  'DH0:Work'
  >>> os.path.join("DH0:", "work", "scripts")
  'DH0:work/scripts'
  >>> os.path.isabs("DH0:file.py")
  True


Release history
---------------

Build 227
---------

  - Full Latin-1 <-> UTF-8 round-trip for filenames and terminal
    output. AmigaOS filesystems store filenames in Latin-1
    (ISO-8859-1), while MicroPython internally validates strings
    as UTF-8. Without conversion, any filename containing accented
    characters (e, e, n, c, ...) caused UnicodeError in os.listdir(),
    open(), and friends, and accented characters from print() were
    rendered as garbage in the AmigaOS terminal.
  - Latin-1 -> UTF-8 conversion in os.listdir() and os.getcwd(): a
    new mp_obj_new_str_from_latin1() helper bypasses UTF-8 validation
    and properly maps codepoints 0x80-0xFF to 2-byte UTF-8 sequences,
    so listdir() now returns clean Python strings for any AmigaOS
    filename.
  - UTF-8 -> Latin-1 conversion in all path-taking os functions
    (open, stat, rename, remove, chmod, etc.) via a shared
    amiga_utf8_to_latin1() helper. The conversion is transparent
    to the user: you can write open("Pequeno.txt") in your script
    and the underlying AmigaOS call receives the correct Latin-1
    bytes.
  - Terminal output: mp_hal_stdout_tx_strn() now converts UTF-8
    to Latin-1 before writing to the console, so print("Pequeno")
    or repr() of a Latin-1 filename displays correctly on the
    AmigaOS shell instead of showing multi-byte garbage.
  - VFS POSIX integration: added a new MICROPY_VFS_POSIX_CONVERT_PATH
    hook in vfs_posix.c and vfs_posix_file.c so that open() calls
    going through the VFS layer also benefit from the conversion.
    Patches to the shared extmod files are kept as .patch files in
    ports/amiga/patches/, consistent with the existing
    mpstate_alignment.patch approach.
  - Enabled MICROPY_PY_OS_DUPTERM to redirect VFS POSIX stdout/stderr
    through mphal, which is necessary because print() goes through
    the VFS write path rather than mp_hal_stdout_tx_strn() directly.
  - Round-trip validated end to end: a file created from Python with
    an accented name can be listed, stat'd, opened, renamed, and
    removed without any encoding errors, and its name displays
    correctly on the Amiga terminal.

Build 219
---------

  - Critical fix: force heap allocation for iterators on m68k.
    The mp_obj_iter_buf_t struct on the C stack was misaligned on
    68k, causing "object isn't an iterator" crashes on for loops,
    the 'in' operator, list comprehensions, unpacking, and builtins
    like sum(), min(), max(), sorted(), etc. Fixed in 13 locations
    across 7 core MicroPython files.
  - Fix: ARexx WaitPort is now interruptible by Ctrl-C. Previously,
    arexx.send() would hang indefinitely if the target application
    did not reply. Now waits with SIGBREAKF_CTRL_C and raises
    KeyboardInterrupt after the reply is safely received.
  - Fix: avoid double close(fd) in SSLSocket.__del__. The fd is
    owned by the underlying Python socket; closing it twice could
    corrupt the libnix fd table.
  - Fix: avoid double inet_ntoa() call in same expression. The
    static buffer was overwritten between calls, causing incorrect
    addresses in socket_accept(), socket_recvfrom(), and
    mod_getaddrinfo().
  - Fix: cache timezone offset from locale.library instead of
    opening/closing the library on every localtime()/strftime() call.
  - Fix: close ARexx library in crash handlers (nlr_jump_fail,
    __assert_func) to prevent resource leaks on fatal errors.
  - Use _exit() consistently in all exit/crash paths.

Build 209
---------

  - os.getenv(), os.putenv(), os.unsetenv(): environment variable
    management via AmigaOS GetVar/SetVar/DeleteVar
  - zlib module: CPython-compatible compress, decompress, crc32
  - zipfile module: read/write ZIP archives (stored + deflated),
    CRC32 verification, extractall support
  - Timezone support: time.localtime() now returns local time
    using the timezone offset from AmigaOS locale.library
    (loc_GMTOffset). time.gmtime() returns UTC.
  - datetime.strftime(): format datetime objects with standard
    format codes (%Y, %m, %d, %H, %M, %S, %A, %a, %B, %b,
    %I, %p, %j, %f, %y, %%)
  - time.strftime(): format time tuples with the same codes,
    implemented in C via MICROPY_PY_TIME_INCLUDEFILE
  - datetime.now() returns microseconds (1/50s resolution)
  - input() builtin: interactive user input with proper raw/cooked
    console mode switching
  - sys.stdin, sys.stdout, sys.stderr: standard I/O streams
  - os.chmod() now accepts Unix-style permission modes (0o755,
    0o666, etc.) and converts them to AmigaOS protection bits
    automatically. os.setprotect()/os.getprotect() remain
    available for direct access to AmigaOS native bits.
  - os.stat() st_mode now reflects real file permissions
    (converted from AmigaOS fib_Protection)
  - sys.path[0] is set to the script's directory when running
    a script, matching CPython behavior for relative imports

Build 186
---------

  - ARexx IPC module: send commands to and communicate with any
    ARexx-aware application (IBrowse, Directory Opus, etc.)
  - os.chmod(): set AmigaOS file protection flags
  - os.getprotect(): read AmigaOS file protection flags
  - Ctrl-C support: KeyboardInterrupt now works during script
    execution, loops, and time.sleep() calls
  - Direct .mpy execution: run precompiled bytecode files from
    the command line (micropython script.mpy)
  - Import .mpy files: precompiled bytecode modules can be
    imported alongside regular .py modules

Build 169
---------

  - Initial release of this port


Known Limitations
-----------------

  - time.ticks_ms() returns 0 (no high-res timer yet)
  - hashlib only supports SHA256
  - Sockets are always blocking
  - No multithreading
  - re module: {n} quantifiers are not supported (use explicit
    repeated characters instead, e.g. "..." instead of ".{3}")


Source Code
-----------

The full source code is available on GitHub:
https://github.com/OoZe1911/micropython-amiga-port

Latest build can be downloadded here :
https://github.com/OoZe1911/micropython-amiga-port/blob/main/ports/amiga/build/micropython


License
-------

MicroPython is licensed under the MIT License.


Contents of dev/lang/micropython.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[Amiga]                   1171    1484  78.9% -lh5- 78b3 Apr  7 10:06 micropython.info
[Amiga]                 220448  411876  53.5% -lh5- d75f Apr  2 13:01 micropython/micropython
[Amiga]                   4618   10220  45.2% -lh5- 09fc Apr  9 15:06 micropython/micropython.readme
[Amiga]                   1171    1484  78.9% -lh5- 7b3b Apr  7 10:06 micropython/samples.info
[Amiga]                   4606   14847  31.0% -lh5- 5d0f Apr  9 11:18 micropython/samples/chat_claude.py
[Amiga]                   3339   10612  31.5% -lh5- 77eb Apr  7 17:07 micropython/samples/diff_view.py
[Amiga]                    937    2268  41.3% -lh5- de1b Apr  7 15:54 micropython/samples/launch_ibrowse.py
[Amiga]                   2619    5944  44.1% -lh5- 1ce9 Apr  9 15:13 micropython/samples/samples.readme
[Amiga]                   5952   20166  29.5% -lh5- ce21 Apr  7 15:22 micropython/samples/webserver.py
[Amiga]                   3295    9972  33.0% -lh5- 009c Apr  7 10:14 micropython/samples/wget.py
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        10 files  248156  488873  50.8%            Apr  9 20:14
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>