diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-08-13 08:37:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-08-13 08:37:46 -0700 |
commit | 388ad74cf16f59a5d97bb398737fa3a499a774ce (patch) | |
tree | 3a738ae5876da5343ea6ccecf6ce10cd4b288d73 /browse-slack | |
parent | c9e9b5612382ddcec5ed185125b6d4212d0509d0 (diff) | |
download | mu-388ad74cf16f59a5d97bb398737fa3a499a774ce.tar.gz |
.
Clean up offset calculations to bear out the name 'first-free'.
Diffstat (limited to 'browse-slack')
-rw-r--r-- | browse-slack/environment.mu | 12 | ||||
-rw-r--r-- | browse-slack/main.mu | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu index 0a638a75..6a05afaf 100644 --- a/browse-slack/environment.mu +++ b/browse-slack/environment.mu @@ -21,6 +21,7 @@ fn initialize-environment _self: (addr environment), _items: (addr item-list) { var items/eax: (addr item-list) <- copy _items var items-data-first-free-a/eax: (addr int) <- get items, data-first-free var final-item/eax: int <- copy *items-data-first-free-a + final-item <- decrement var dest/edi: (addr int) <- get self, item-index copy-to *dest, final-item } @@ -436,9 +437,10 @@ fn previous-item _env: (addr environment), _items: (addr item-list) { var env/edi: (addr environment) <- copy _env var items/esi: (addr item-list) <- copy _items var items-data-first-free-a/ecx: (addr int) <- get items, data-first-free - var items-data-first-free/ecx: int <- copy *items-data-first-free-a + var final-item-index/ecx: int <- copy *items-data-first-free-a + final-item-index <- decrement var dest/eax: (addr int) <- get env, item-index - compare *dest, items-data-first-free + compare *dest, final-item-index break-if->= increment *dest } @@ -491,12 +493,14 @@ fn page-up _env: (addr environment), _items: (addr item-list) { var items-data-ah/eax: (addr handle array item) <- get items, data var _items-data/eax: (addr array item) <- lookup *items-data-ah var items-data/ebx: (addr array item) <- copy _items-data - var items-data-first-free-a/esi: (addr int) <- get items, data-first-free + var items-data-first-free-a/eax: (addr int) <- get items, data-first-free + var final-item-index/esi: int <- copy *items-data-first-free-a + final-item-index <- decrement var src/eax: (addr int) <- get env, item-index var new-item-index/ecx: int <- copy *src var y/edx: int <- copy 2 { - compare new-item-index, *items-data-first-free-a + compare new-item-index, final-item-index break-if-> compare y, 0x28/screen-height-minus-menu break-if->= diff --git a/browse-slack/main.mu b/browse-slack/main.mu index 7ce8d36c..20087524 100644 --- a/browse-slack/main.mu +++ b/browse-slack/main.mu @@ -137,7 +137,6 @@ fn parse in: (addr stream byte), users: (addr array user), channels: (addr array } var dest/eax: (addr int) <- get items, data-first-free copy-to *dest, item-idx - decrement *dest } fn parse-record in: (addr stream byte), out: (addr stream byte) { |