Promille - blood alcohol estimator for the Nokia 9500 / 9300 (Series 80 v2.0)
Version 1.0, 2026-10-31. Package UID 0x01000A22.

Sami Vuori, written together with Claude (Anthropic).

Only an estimate. Never decide whether to drive based on it.

Log what you drink and when. The main view shows the estimated per mille
now in big seven-segment digits (orange from 0.5, red from 1.2), the peak,
when it should drop under 0.5, when it's all gone, the number of drinks and
standard drinks (12 g) in this session, and a curve of the whole session:
filled darker up to now, 0.5 (orange) and 1.2 (red) lines, a tick for each
drink, hours along the bottom.

  Lisaa juoma   drink list (Enter also opens it). Arrows move, left/right
                sets when it was drunk (5 min steps, up to 24 h back), Enter
                or Lisaa adds it. Presets: beer 0.33/0.5 l 4.7 %, lonkero
                0.33/0.5 l 5.5 %, cider, wine 12/16 cl 12.5 %, sparkling
                12 cl 11 %, spirits 4 cl 40 %, plus "Oma juoma" with your
                own cl and %.
  Juomat        logged drinks. Left/right moves the highlighted drink's time
                by 5 min, Del/Backspace or Poista deletes it, Tyhjenna twice
                deletes all.
  Asetukset     sex, weight, elimination rate (default 0.15 per mille an
                hour), stomach (empty/normal/full = absorbed over 30/60/90
                min). Opens by itself on the first run.
  Sulje         exit (Esc too).

Number fields: left/right steps, or type the value with digits (and a comma).

MODEL (bac.c)
  Widmark: BAC = alcohol (g) / (r * weight kg), r = 0.68 men, 0.55 women.
  Each drink is absorbed at a steady rate over the stomach time; elimination
  is the set rate while there's alcohol left. Simulated minute by minute in
  integers (micrograms), up to 7 days, so redraws are cheap. A new session
  starts with a drink taken when the estimate was back at 0. Drinks older
  than 6 days are dropped.
  Only an estimate - it can be well off in either direction.

DATA
  C:\System\Data\Promille.dat, written after every change.

FILES
  bac.h/.c          the model, plain C89
  Promille.cpp      views, app UI, data file
  PromilleAif.rss   Desk caption + icon (AIF line in Promille.mmp)
  make_icon.py      draws the beer-mug icon_64x50/25x20 BMPs + masks (Pillow)
  tests\bac_test.c  PC test of the model:
                    gcc -std=gnu89 -Wall -I.. bac_test.c ..\bac.c -o bac_test

BUILD (on the Win2000 VM, with the Series 80 v2.0 SDK)
  bldmake bldfiles
  abld build armi urel
  makesis Promille.pkg

INSTALL
  Install Promille.sis (to the phone or the memory card) and start Promille
  from the Desk. Or copy Promille.app, Promille.rsc and Promille.aif to
  C:\System\Apps\Promille\.

RELEASE
  py tools\make_release.py [version]   writes release\Promille-<version>-src.zip,
  and release\Promille-<version>.zip (SIS + readme + COPYING) once
  release\Promille.sis exists.

LICENCE
  Promille is free software under the GNU General Public License, version 2 or later
  (see COPYING). If you pass the SIS on, pass the source on with it. It comes with no
  warranty, and its estimates least of all.

UNVERIFIED
  - The per mille sign (U+2030) in the phone's fonts. If it shows as a box,
    replace "\x2030" in Promille.cpp.
  - Typing digits: on the 9500 they may need Chr/Shift; left/right always works.
  - Empty CBA buttons (KNullDesC labels).
