Skip to content

heilingbrunner/vscode-hp42s-free42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HP42S-free42

hp42s-free42-extension-logo

GitHub license Installs Downloads

Language support for HP42S/free42 programming language.

What's new in HP42S-free42:

  • more new commands for free42
  • package updates
  • bug fix

Features

  • syntax highlighting
  • snipptes with description
  • comments
  • document formatter
  • encoding code to raw
  • decoding raw to code

Supported filetypes

  • *.hp42s for the original operation set of the HP-42S
  • *.free42 for the extended operation set of the free42

The endless chain of encoding and decoding:

*.hp42s -> *.hp42s.hex42 -> *.hp42s.raw -> *.hp42s.raw.hex42 -> *.hp42s.raw.hp42s -> ...

Depending on the file type, snippets, syntax highlighting with the additional commands of free42 are supported or not.

Useful for Hewlett Packard HP-42S calculators, SwissMicros-DM42 calculators and FREE42 applications.

Demo

Features

Instruction sets

Syntax Highligthing

Syntax Highligthing

Snippets with description

Every keystroke command and its variations with a description.

Snippets with description

  • Normal snippets appear when writing the command
  • Snippets for commands with leading special character appear when writing the command name (eg: use DEC for →DEC, use REG for ΣREG)
  • Use e, or E for in 1.2ᴇ-23
  • Use OP for ×,÷,+/-,Σ+,Σ-,←,↑,↓,→,%,⊢,%CH
  • Use FLAG for all flags 01 to 99
  • Use FOC for √,∫,░,Σ,▶,π,¿,␊,≤,≥,≠,↵,↓,→,←,µ,£,°,Å,Ñ,Ä,∡,ᴇ,Æ,…,␛,Ö,Ü,▒,■
  • Use [LF] or for a line feed in a string. Formatter will replace [LF] to .

Comments

Comments are possible in several variants.

Comments

Document Formatter

The formatter prepares the code for encoding. It will replace all abbreviations, which are used for ascii text editing. When using Visual Studio Code, the code is displayed in UTF8, though all original characters of the HP42S/free42 can be displayed correct.

However when I enter a program manually into a real calculator it helps to have line numbers. If I miss a command it helps to find the error.

Right-click in the editor to get the context menu, then select menu Format Document or press keyboard-shortcut Win: SHIFT+ALT+F/ Linux: SHIFT+ALT+F/ Mac-OSX: ⇧⌥F.

Document Formatter

The formatter has several settings:

  • Use Line Numbers: This will insert/refresh the leading line numbers.
  • Remove Too Long Spaces: This will reduce whitespaces in the code.
  • Replace Abbreviations: Abbreviations for special characters will be replaced by the correct intended character.
  • Trim Line: This removes whitespaces at the beginnning and at the end of a code line.

Encode Code - Comand

Before encoding, please format the code. This avoids further special cases that would otherwise have to be taken into account.

Press Win/Linux: Ctrl+Shift+P, Mac-OSX: ⇧⌘P, then write HP42S to get the command hp42s/free42: Encode Code in the drop down list.

The hp42s/free42: Encode Code command generates a *.hp42s.raw or *.free42.raw file. These files can be loaded by free42 or DM42.

Depending on the setting HP42S/free42.encoderGenerateHexFile setting, the command will generate a readable hex42 file.

Although the program size will be calculated and shown in the first line ({ n-Byte Prgm }). For some reason, the last ending END command is ignored. Real program size will be 3 bytes more.

That's what the real HP-42S does. It is strange, since the END is, in fact, a part of the program... but that's the way it is.

Encode Code

Encoding Success

Encoding with no errors: The raw program size is reported in the first line.

Encode Success

The command generates two output files:

  • a file in raw42 format
  • a file in hex42 format, when setting HP42S/free42.encoderGenerateHexFile is checked

Encoding Errors

Encoding with errors: The first line line contains the first error.

Encode Error

Encoding with errors: All errors are logged to the *.log file.

Encode Log

Decode Code - Comand

From a *.raw file the decoder generates the following files

  • *.hex42: The sequence of the command bytes, when setting HP42S/free42.decoderGenerateHexFile is checked.
  • *.hp42s: The code file with only pure HP42S commands.
  • *.free42: The decode has detected free42 commands. The code will only run on free42 applications.

To decode a raw file, please select hp42s/free42: Show Raw in the context menu of the file listed in the right explorer pane.

Explorer context menu

This will show the formatted bytes of the file.

Raw view

In the editor open the context menu again an select hp42s/free42: Decode Raw.

Raw view context menu

The decoder will generate the output files.

Decoded files

Used References

Documents

Requirements

None.

Extension Settings

Encoding Settings:

  • HP42S/free42.encodergenerateHexFile: This will although generate a *.hex42 file, to see the correct hex encoding.

Decoding Settings:

  • HP42S/free42.decodergenerateHexFile: This will although generate a *.hex42 file, to see the correct hex encoding.

Document Formatter Settings:

  • HP42S/free42.formatterUseLineNumbers: see above Document Formatter
  • HP42S/free42.formatterReplaceAbreviations: see above Document Formatter
  • HP42S/free42.formatterRemoveTooLongSpaces: see above Document Formatter
  • HP42S/free42.formatterTrimLines: see above Document Formatter
  • HP42S/free42.formatterUseWhitespaceBetweenHex: see generated hex files

Recommendations

Visual Studio Extensions: