Skip to content

Commit

Permalink
Use EXITAPP instead of FLOAT to leave Ladybug
Browse files Browse the repository at this point in the history
Now that the shell mechanism allows for multiple applications it makes
sense to change the way we exit Ladybug. Previously there was a FLOAT
function to disable the Ladybug application, but it is now changed to
EXITAPP which simply drops the topmost application.

It is a good idea to have a consistent way of exiting an application
and then the only logical choice is to use a key that is not normally
used. The shifted USER key is a good choice as it normally has no
function bound to it and USER is about keyboard layouts.

Some minor rearrangements are needed for this as MASKL was on that key
previously. Move MASKL and MASKR right (PRGM and ALPHA), drop ALDI
would make more sense to have on a slightly change alpha keyboard that
currently is not defined.

This frees up the PI key position, so WSIZE? is put there, as it can
be useful in calculations and as a way to check the current
settings. Setting the word size is nearby, making it a sensible
location.
  • Loading branch information
hth313 committed Apr 22, 2020
1 parent d1725dd commit 7d5bfaa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
Binary file modified doc/calculator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/calculator.xcf
Binary file not shown.
9 changes: 5 additions & 4 deletions doc/implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ keyboard, so that also makes some sense.
The logical operations are held together in the usual order you say
them, AND, OR, XOR, which also is the alphabetical order.

When you feel that you need to work with floating point numbers, you
probably want to use that PI constant, so the ``FLOAT`` operation to
switch to floating point mode is on the PI key.

Sign extension is on the ``EEX`` key, which is almost spelled the
same.

The shifted ``USER`` key performs the ``EXITAPP`` function which
exists the Ladybug shell and takes you back to the previous shell.
This key was chosen as it is always free and the ``USER`` key is
related to affecting the keyboard layout.
6 changes: 3 additions & 3 deletions doc/keyboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Deactivation
============

Once activated, the HP-41 stays in integer mode until you execute the
``FLOAT`` instruction. This can be done by pressing the shift key
followed by the PI (0 key). It is also possible to execute the
``FLOAT`` instruction using the ``XEQ`` key and spell it out as
``EXITAPP`` instruction. This can be done by pressing the shift key
followed by the USER key. It is also possible to execute the
``EXITAPP`` instruction using the ``XEQ`` key and spell it out as
usual.

Another way to disable Ladybug is to turn the calculator off and
Expand Down
16 changes: 11 additions & 5 deletions doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ well.

.. index:: float mode, mode; float

.. object:: FLOAT
.. object:: EXITAPP

Switch to floating point mode, leaving integer mode. This restores
the keyboard and display to its normal floating point behavior.
Leave integer mode by exiting Ladybug and switching back to
floating point mode. This restores the keyboard and display to its
normal floating point behavior.

Integer instructions in floating point mode still works, but will
not display or use the dedicated keyboard.
Technically it leaves the current active application shell and goes
back to the shell that was active before it. The very last such
shell is the standard calculator behavior.

Integer instructions still work when the Ladybug application is
inactive. What happens is that the Ladybug display and keyboard
overrides are no longer active.


.. index:: binary base, base; binary
Expand Down
23 changes: 10 additions & 13 deletions src/ladybug.s
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ XROMno: .equ 16
FatStart:
.fat LadyHeader ; ROM header
FAT Literal
FAT FLOAT ; mode change
FAT EXITAPP ; drop to previous App
.fat Integer
FAT Binary ; base related instructions
FAT Octal
Expand Down Expand Up @@ -1013,19 +1013,16 @@ exitNoUserSTR1:

;;; **********************************************************************
;;;
;;; FLOAT - restore float mode operation
;;; EXITAPP - restore float mode operation
;;;
;;; Essentially we just disable our own shell (if it exists).
;;; In reality we exit the top application shell.
;;;
;;; **********************************************************************

.section Code, reorder
.name "FLOAT"
FLOAT: nop ; non-programmable
; (allow mode switch in program mode)
ldi .low12 ladybugShell
gosub exitShell ; must be a gosub to provide page address
golong NFRPU ; must golong as exitShell uses +3 levels
.name "EXITAPP"
EXITAPP: gosub exitApp
golong NFRC

.section Code, reorder
noBuf: gosub errorMessage
Expand Down Expand Up @@ -5298,7 +5295,7 @@ keyTable:
.con BuiltinKey(0xa8) ; SF
KeyEntry SB ; 4
KeyEntry AND ; 1 (FIX key)
KeyEntry FLOAT ; 0
KeyEntry WSIZE? ; 0

;; Logical column 2
.con 0x10c ; SQRT (C digit)
Expand Down Expand Up @@ -5355,9 +5352,9 @@ keyTable:
KeyEntry RRC ; TAN
.con 0 ; BST
KeyEntry CLXI ; BACKARROW
KeyEntry ALDI ; MODE ALPHA
KeyEntry MASKR ; MODE PRGM
KeyEntry MASKL ; MODE USER
KeyEntry MASKR ; MODE ALPHA
KeyEntry MASKL ; MODE PRGM
KeyEntry EXITAPP ; MODE USER
.con 0 ; OFF key special

;;; ----------------------------------------------------------------------
Expand Down

0 comments on commit 7d5bfaa

Please sign in to comment.