From 78b30c249191c51597f16985bfb4005af4acccc1 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 29 Apr 2024 11:46:37 -0400 Subject: [PATCH 1/4] Add new solution for programming language QB64 --- QB64/README.md | 3983 ++++++++++++++++++++++++++++++++++++++++++ QB64/dataconvert.bas | 41 + QB64/quine2.bas | 61 + QB64/quine2raw.bas | 34 + 4 files changed, 4119 insertions(+) create mode 100644 QB64/README.md create mode 100644 QB64/dataconvert.bas create mode 100644 QB64/quine2.bas create mode 100644 QB64/quine2raw.bas diff --git a/QB64/README.md b/QB64/README.md new file mode 100644 index 0000000..e5db0ae --- /dev/null +++ b/QB64/README.md @@ -0,0 +1,3983 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HugoDecompiler/README.md at main · electric-socket/HugoDecompiler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ Skip to content + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + + + electric-socket  /   + HugoDecompiler  /   + +
+
+ + + +
+ + +
+
+ Clear Command Palette +
+
+ + + +
+
+ Tip: + Type # to search pull requests +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type # to search issues +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type # to search discussions +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type ! to search projects +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type @ to search teams +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type @ to search people and organizations +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type > to activate command mode +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Go to your accessibility settings to change your keyboard shortcuts +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type author:@me to search your content +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:pr to filter to pull requests +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:issue to filter to issues +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:project to filter to projects +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:open to filter to open content +
+
+ Type ? for help and tips +
+
+
+ +
+ +
+
+ We’ve encountered an error and some results aren't available at this time. Type a new search or try again later. +
+
+ + No results matched your search + + + + + + + + + + +
+ + + + + Search for issues and pull requests + + # + + + + Search for issues, pull requests, discussions, and projects + + # + + + + Search for organizations, repositories, and users + + @ + + + + Search for projects + + ! + + + + Search for files + + / + + + + Activate command mode + + > + + + + Search your issues, pull requests, and discussions + + # author:@me + + + + Search your issues, pull requests, and discussions + + # author:@me + + + + Filter to pull requests + + # is:pr + + + + Filter to issues + + # is:issue + + + + Filter to discussions + + # is:discussion + + + + Filter to projects + + # is:project + + + + Filter to open issues, pull requests, and discussions + + # is:open + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + + + + +
+ + +
+
+
+ + + + + + + + + + + + + + + +
+ Open in github.dev + Open in a new github.dev tab + Open in codespace + + + + + + + + + + + + + + + + + +

Files

t

Latest commit

 

History

History
34 lines (25 loc) · 2.75 KB

README.md

File metadata and controls

34 lines (25 loc) · 2.75 KB

I wanted to learn how the Hugo compiler creates binaries for use of its run-time system. Hugo is a domain-specific programming language designed for creating interactive fiction.

+

Hugp "programs" are created by specifying a set of values: +First, the command sequences, the list of verbs and "syntactic sugar" or additional words to allow more natural language. +The following may come in any order:

+
    +
  • Specification of attributes, a set of flags used to describe certain conditions in the game.
  • +
  • Specification of properties, specic values held by an object used to change gameplay.
  • +
  • Specification of objects, the entities that are manipulated as part of the game.
  • +
  • Global varables such as the player's score, how many moves they've made, and other information.
  • +
  • Routines, pieces of code that are activated when the player types in a command.
  • +
+

Objects in the game include the player, NPCs, if any, items that can be moved, picked up, looked at, or used. They also include the various locations in the game.

+

All this information is then translated into tokens which can be interpreted by the game engine.

+

The program that this repo holds reads a compiled game into memory, and using the information from the reference book, displays the information about the game in a readable format.

+

To compile the source, you need the QB64 Phoenix Edition, which can be found here.

+

A compiled executable is in this repo; for version 0.1.16, the checksums are:

+

Algorithm Hash Path

+
+

SHA256 A73D372F523333C8C704E58C1DD7DCFC7EC7AFA09AA5614679231CDBC3308AD3 colors.bas
+SHA256 F581F1207CDF52A22ED8EAC956593E80E7B8AF7BFED3982BC0373CE912C8464A Common Dialog.bi
+SHA256 EBD5A3E879629C605DDD5D1A89F3D54CDFF77BD65FE1D7C5372C3BFC84306D42 Common_Dialog_Prefix.bi +SHA256 B32F0631FAD7B87D42247EB4E54C894EBD773565C3C890E097B24C1E30FC15EA Common_Dialog_Suffix.bi +SHA256 0BAE2C588C748F86036BD92B696C2622B92521C3685EB362850F300077F38D2C hugoconstants.bas
+SHA256 D3E8DD7619AF7A86E62A982952696F5FFA73263F373E106500AF273425078CB3 hugodecomp.bas
+SHA256 7944BF94D0859C7D626F612CBDCC0DBD74935B2C1068467F129E726E0FAEA6EA hugodecomp.exe
+SHA256 8177F97513213526DF2CF6184D8FF986C675AFB514D4E68A404010521B880643 LICENSE
+SHA256 649F09F6F8EE61BBA92DADF348A4F7EA65AD0E2AFEA9A97F73ECDBC5703940F8 PrintW.bas

+
+
+ + + + +
+ +
+ +
+
+ +
+ +
+

Footer

+ + + + +
+
+ + + + + © 2024 GitHub, Inc. + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + diff --git a/QB64/dataconvert.bas b/QB64/dataconvert.bas new file mode 100644 index 0000000..529b09f --- /dev/null +++ b/QB64/dataconvert.bas @@ -0,0 +1,41 @@ +$Console:Only +'$Include:'Common_Dialog_Prefix.bi' +ReDim As _Unsigned _Byte Prg(1), L +Dim As Long I, J, K, Size + + +' Invoke Open Read File dialog +Filter$ = "Basic Programs (*.bas,bi.bm)|*.bas,*.bi,*.bm|All files (*.*)|*.*" +Flags& = OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY ' add flag constants here +F$ = GetOpenFileName$("Select name of Basic/QB64/qb64pe source code file", ".\", Filter$, 1, Flags&, Hwnd&) + +If F$ = "" Then + Print "Operation cancelled." + End +End If + +Open F$ For Binary Access Read As #1 +I = LOF(1) +ReDim Prg(1 To I) +Get #1, , Prg() +Close #1 + +For J = 1 To I + If L = 0 Then Print "Data "; + Print LTrim$(Str$(Prg(J))); + If J < I Then + L = L + 1 + If L = 20 Then + Print + L = 0 + Else + Print ","; + End If + Else + Print + End If +Next + +End + +'$Include:'Common_Dialog_Suffix.bi' diff --git a/QB64/quine2.bas b/QB64/quine2.bas new file mode 100644 index 0000000..855e71b --- /dev/null +++ b/QB64/quine2.bas @@ -0,0 +1,61 @@ +$Console:Only +Option _Explicit +Dim As _Unsigned _Byte Prg(1 To 100000), L +Dim As Long I, J, K + +Do + I = I + 1 + Read Prg(I) + If Prg(I) = 0 Then Exit Do +Loop + + +For J = 1 To I + Print Chr$(Prg(J)); +Next + +For J = 1 To I + If L = 0 Then Print "Data "; + Print LTrim$(Str$(Prg(J))); + If J < I Then + L = L + 1 + If L = 20 Then + Print + L = 0 + Else + Print ","; + End If + Else + Print + End If +Next + +End + +Data 36,67,111,110,115,111,108,101,58,79,110,108,121,13,10,79,112,116,105,111 +Data 110,32,95,69,120,112,108,105,99,105,116,13,10,68,105,109,32,65,115,32 +Data 95,85,110,115,105,103,110,101,100,32,95,66,121,116,101,32,80,114,103,40 +Data 49,32,84,111,32,49,48,48,48,48,48,41,44,32,76,13,10,68,105,109 +Data 32,65,115,32,76,111,110,103,32,73,44,32,74,44,32,75,13,10,13,10 +Data 68,111,13,10,32,32,32,32,73,32,61,32,73,32,43,32,49,13,10,32 +Data 32,32,32,82,101,97,100,32,80,114,103,40,73,41,13,10,32,32,32,32 +Data 73,102,32,80,114,103,40,73,41,32,61,32,48,32,84,104,101,110,32,69 +Data 120,105,116,32,68,111,13,10,76,111,111,112,13,10,13,10,13,10,70,111 +Data 114,32,74,32,61,32,49,32,84,111,32,73,13,10,32,32,32,32,80,114 +Data 105,110,116,32,67,104,114,36,40,80,114,103,40,74,41,41,59,13,10,78 +Data 101,120,116,13,10,13,10,70,111,114,32,74,32,61,32,49,32,84,111,32 +Data 73,13,10,32,32,32,32,73,102,32,76,32,61,32,48,32,84,104,101,110 +Data 32,80,114,105,110,116,32,34,68,97,116,97,32,34,59,13,10,32,32,32 +Data 32,80,114,105,110,116,32,76,84,114,105,109,36,40,83,116,114,36,40,80 +Data 114,103,40,74,41,41,41,59,13,10,32,32,32,32,73,102,32,74,32,60 +Data 32,73,32,84,104,101,110,13,10,32,32,32,32,32,32,32,32,76,32,61 +Data 32,76,32,43,32,49,13,10,32,32,32,32,32,32,32,32,73,102,32,76 +Data 32,61,32,50,48,32,84,104,101,110,13,10,32,32,32,32,32,32,32,32 +Data 32,32,32,32,80,114,105,110,116,13,10,32,32,32,32,32,32,32,32,32 +Data 32,32,32,76,32,61,32,48,13,10,32,32,32,32,32,32,32,32,69,108 +Data 115,101,13,10,32,32,32,32,32,32,32,32,32,32,32,32,80,114,105,110 +Data 116,32,34,44,34,59,13,10,32,32,32,32,32,32,32,32,69,110,100,32 +Data 73,102,13,10,32,32,32,32,69,108,115,101,13,10,32,32,32,32,32,32 +Data 32,32,80,114,105,110,116,13,10,32,32,32,32,69,110,100,32,73,102,13 +Data 10,78,101,120,116,13,10,13,10,69,110,100,13,10,13,10,0 + diff --git a/QB64/quine2raw.bas b/QB64/quine2raw.bas new file mode 100644 index 0000000..d14354d --- /dev/null +++ b/QB64/quine2raw.bas @@ -0,0 +1,34 @@ +$Console:Only +Option _Explicit +Dim As _Unsigned _Byte Prg(1 To 100000), L +Dim As Long I, J, K + +Do + I = I + 1 + Read Prg(I) + If Prg(I) = 0 Then Exit Do +Loop + + +For J = 1 To I + Print Chr$(Prg(J)); +Next + +For J = 1 To I + If L = 0 Then Print "Data "; + Print LTrim$(Str$(Prg(J))); + If J < I Then + L = L + 1 + If L = 20 Then + Print + L = 0 + Else + Print ","; + End If + Else + Print + End If +Next + +End + From a2a847b612fc9249e303f54b1b95424e52d4dd88 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 29 Apr 2024 12:35:46 -0400 Subject: [PATCH 2/4] Update README.md Explain how to use and how to recreate. --- QB64/README.md | 4009 +----------------------------------------------- 1 file changed, 26 insertions(+), 3983 deletions(-) diff --git a/QB64/README.md b/QB64/README.md index e5db0ae..ecece5c 100644 --- a/QB64/README.md +++ b/QB64/README.md @@ -1,3983 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HugoDecompiler/README.md at main · electric-socket/HugoDecompiler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- Skip to content - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- -
- - - - electric-socket  /   - HugoDecompiler  /   - -
-
- - - -
- - -
-
- Clear Command Palette -
-
- - - -
-
- Tip: - Type # to search pull requests -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type # to search issues -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type # to search discussions -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type ! to search projects -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type @ to search teams -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type @ to search people and organizations -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type > to activate command mode -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Go to your accessibility settings to change your keyboard shortcuts -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type author:@me to search your content -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type is:pr to filter to pull requests -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type is:issue to filter to issues -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type is:project to filter to projects -
-
- Type ? for help and tips -
-
-
- -
-
- Tip: - Type is:open to filter to open content -
-
- Type ? for help and tips -
-
-
- -
- -
-
- We’ve encountered an error and some results aren't available at this time. Type a new search or try again later. -
-
- - No results matched your search - - - - - - - - - - -
- - - - - Search for issues and pull requests - - # - - - - Search for issues, pull requests, discussions, and projects - - # - - - - Search for organizations, repositories, and users - - @ - - - - Search for projects - - ! - - - - Search for files - - / - - - - Activate command mode - - > - - - - Search your issues, pull requests, and discussions - - # author:@me - - - - Search your issues, pull requests, and discussions - - # author:@me - - - - Filter to pull requests - - # is:pr - - - - Filter to issues - - # is:issue - - - - Filter to discussions - - # is:discussion - - - - Filter to projects - - # is:project - - - - Filter to open issues, pull requests, and discussions - - # is:open - - - - - - - - - - - - - - - - -
-
-
- -
- - - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - -
- Open in github.dev - Open in a new github.dev tab - Open in codespace - - - - - - - - - - - - - - - - - -

Files

t

Latest commit

 

History

History
34 lines (25 loc) · 2.75 KB

README.md

File metadata and controls

34 lines (25 loc) · 2.75 KB

I wanted to learn how the Hugo compiler creates binaries for use of its run-time system. Hugo is a domain-specific programming language designed for creating interactive fiction.

-

Hugp "programs" are created by specifying a set of values: -First, the command sequences, the list of verbs and "syntactic sugar" or additional words to allow more natural language. -The following may come in any order:

-
    -
  • Specification of attributes, a set of flags used to describe certain conditions in the game.
  • -
  • Specification of properties, specic values held by an object used to change gameplay.
  • -
  • Specification of objects, the entities that are manipulated as part of the game.
  • -
  • Global varables such as the player's score, how many moves they've made, and other information.
  • -
  • Routines, pieces of code that are activated when the player types in a command.
  • -
-

Objects in the game include the player, NPCs, if any, items that can be moved, picked up, looked at, or used. They also include the various locations in the game.

-

All this information is then translated into tokens which can be interpreted by the game engine.

-

The program that this repo holds reads a compiled game into memory, and using the information from the reference book, displays the information about the game in a readable format.

-

To compile the source, you need the QB64 Phoenix Edition, which can be found here.

-

A compiled executable is in this repo; for version 0.1.16, the checksums are:

-

Algorithm Hash Path

-
-

SHA256 A73D372F523333C8C704E58C1DD7DCFC7EC7AFA09AA5614679231CDBC3308AD3 colors.bas
-SHA256 F581F1207CDF52A22ED8EAC956593E80E7B8AF7BFED3982BC0373CE912C8464A Common Dialog.bi
-SHA256 EBD5A3E879629C605DDD5D1A89F3D54CDFF77BD65FE1D7C5372C3BFC84306D42 Common_Dialog_Prefix.bi -SHA256 B32F0631FAD7B87D42247EB4E54C894EBD773565C3C890E097B24C1E30FC15EA Common_Dialog_Suffix.bi -SHA256 0BAE2C588C748F86036BD92B696C2622B92521C3685EB362850F300077F38D2C hugoconstants.bas
-SHA256 D3E8DD7619AF7A86E62A982952696F5FFA73263F373E106500AF273425078CB3 hugodecomp.bas
-SHA256 7944BF94D0859C7D626F612CBDCC0DBD74935B2C1068467F129E726E0FAEA6EA hugodecomp.exe
-SHA256 8177F97513213526DF2CF6184D8FF986C675AFB514D4E68A404010521B880643 LICENSE
-SHA256 649F09F6F8EE61BBA92DADF348A4F7EA65AD0E2AFEA9A97F73ECDBC5703940F8 PrintW.bas

-
-
- - - - -
- -
- -
-
- -
- -
-

Footer

- - - - -
-
- - - - - © 2024 GitHub, Inc. - -
- - -
-
- - - - - - - - - - - - - - - - - - - - -
- -
-
- - - +## Files +To compile the source, you need the QB64 Phoenix Edition, which can be found [here](https://github.com/QB64-Phoenix-Edition/QB64pe). + +There are 6 files in this directory +* quine2.bas - The complete quine, which reproduces itself. +* quine2aw.bas - This is the original program without itself attached as data statements. +* dataconvert.bas - The program that reads another program and trranslates it to decimal data. +* Common_Dialog_Prefix.bi - Support values for dataconvert to use the Windows File Open dialog window. +* Common_Dialog_Suffix.bi - Support SUBroutines for dataconvert to use the Windows File Open dialog window. +* README.md - You're reading it now. + +## How to use +* Start QB64 Phoenix Edition. The IDE will appear. +* Open **quine2.bas**. +* Run the program. It will generate an on-screen listing of itself which looks exactly like the copy you have in the ide. + +## How this is created +To recreate the quine, +* Start QB64 Phoenix Edition. The IDE will appear. +* Open **dataconvert.bas** using QB64 Phoenix Edition IDE. +* Run the **dataconvert** program. +* For input to the Windows Open Dialog Box, give it the name of the original file, **quine2raw.bas**. +* In the console output window, a series of **data** statements will be generated. Copy them by using the mouse to select all the text, then press enter to copy. (Note: right-clicking on the hightlighted area with the mouse will not work.) +* Now, open **quine2raw.bas** in the IDE, at the end, paste the data statements. +* Save As a different name, e.g. **quine2new.bas**. +* Run this program, and it produces a copy of itself. This is the same behavior as **quine2.bas**. From 8dd594379f7a3269e348247bff510a2db4da7e2a Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 29 Apr 2024 15:39:58 -0400 Subject: [PATCH 3/4] Update README.md Small correction --- QB64/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QB64/README.md b/QB64/README.md index ecece5c..55cd885 100644 --- a/QB64/README.md +++ b/QB64/README.md @@ -18,9 +18,9 @@ There are 6 files in this directory To recreate the quine, * Start QB64 Phoenix Edition. The IDE will appear. * Open **dataconvert.bas** using QB64 Phoenix Edition IDE. -* Run the **dataconvert** program. +* Run the **dataconvert** program.* * For input to the Windows Open Dialog Box, give it the name of the original file, **quine2raw.bas**. * In the console output window, a series of **data** statements will be generated. Copy them by using the mouse to select all the text, then press enter to copy. (Note: right-clicking on the hightlighted area with the mouse will not work.) -* Now, open **quine2raw.bas** in the IDE, at the end, paste the data statements. +* Now, open **quine2raw.bas** in the IDE, at the end, paste the data statements. Add **,0** to the end of the last line to indicate end of file. * Save As a different name, e.g. **quine2new.bas**. * Run this program, and it produces a copy of itself. This is the same behavior as **quine2.bas**. From 82b92fd8ff173d290beffdcfdd6415979b08a8e2 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 29 Apr 2024 15:41:45 -0400 Subject: [PATCH 4/4] Update README.md --- QB64/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QB64/README.md b/QB64/README.md index 55cd885..26ddcd7 100644 --- a/QB64/README.md +++ b/QB64/README.md @@ -3,7 +3,7 @@ To compile the source, you need the QB64 Phoenix Edition, which can be found [he There are 6 files in this directory * quine2.bas - The complete quine, which reproduces itself. -* quine2aw.bas - This is the original program without itself attached as data statements. +* quine2raw.bas - This is the original program without itself attached as data statements. * dataconvert.bas - The program that reads another program and trranslates it to decimal data. * Common_Dialog_Prefix.bi - Support values for dataconvert to use the Windows File Open dialog window. * Common_Dialog_Suffix.bi - Support SUBroutines for dataconvert to use the Windows File Open dialog window.