www.ClassicTW.com
http://www.classictw.com/

TWX Technical Discussion (and decompiling info)
http://www.classictw.com/viewtopic.php?f=15&t=35604
Page 2 of 2

Author:  Micro [ Tue Oct 08, 2019 2:40 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Shadow wrote:
Isn't possible today, you mean. Anything is possible. :)

There is no current concept of returning a value, that is absolutely correct, but it is not very different from how scripts work today. They are processed in a linear order, yes, but there are gotos and gosubs and branches. Think of what he's asking for as a branch that goes to one place if the "return value" is x or another if it is y. It wouldn't be that hard.

Poor choice of words. I meant it is beyond my understanding for TWX in Delphi.

If I understand what you are saying, the compiler would just create the same byte code. i.e.

Code:
$Param1 = Command $Param2


would still compile the same as:

Code:
Command $Param1 $Param2


Giving TWX a concept of a return value, and then:

Code:
if (Command $Param1 = True)


just becomes shorthand for:

Code:
Command $Result1 $Param1
if $Result1 = True


Using an incriminating name for the $Result in the same way a label is created for waitOn.
It sounds a lot simpler now, but I still don't think I would want to attempt it in Delphi.

Author:  Hammer_2 [ Tue Oct 08, 2019 7:52 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Micro wrote:


Code:
if (Command $Param1 = True)


just becomes shorthand for:

Code:
Command $Result1 $Param1
if $Result1 = True


Using an incriminating name for the $Result in the same way a label is created for waitOn.
It sounds a lot simpler now, but I still don't think I would want to attempt it in Delphi.


yeah, the point of my suggestion is for us programmers ease of programming/readability. So if a function call with return values at compile time = the long hand, that's fine. It's just to make code more concise/easier to use.

Author:  Micro [ Tue Oct 08, 2019 11:00 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Hammer_2 wrote:
yeah, the point of my suggestion is for us programmers ease of programming/readability. So if a function call with return values at compile time = the long hand, that's fine. It's just to make code more concise/easier to use.

Ultimately it all ends up being assembler code:

Code:
; ----------------------------------------------------------------------------------------
; Writes "Hello, World" to the console using only system calls. Runs on 64-bit Linux only.
; To assemble and run:
;
;     nasm -felf64 hello.asm && ld hello.o && ./a.out
; ----------------------------------------------------------------------------------------

          global    _start

          section   .text
_start:   mov       rax, 1                  ; system call for write
          mov       rdi, 1                  ; file handle 1 is stdout
          mov       rsi, message            ; address of string to output
          mov       rdx, 13                 ; number of bytes
          syscall                           ; invoke operating system to do the write
          mov       rax, 60                 ; system call for exit
          xor       rdi, rdi                ; exit code 0
          syscall                           ; invoke operating system to exit

          section   .data
message:  db        "Hello, World", 10      ; note the newline at the end


Assembler code, or machine language is processor and operating system specific. It is in fact all a processor understands, so everything ends up as simple ones and zeros (I thought I saw a TWO - Bender), memory locations, registers, and a handful of mathematical commands. The processor doesn't even know it is displaying data, as it can only move data from one memory location to another (i.e. the memory of your video card). It was the first language I learned, but I wouldn't want to code in it now :)

Author:  LoneStar [ Wed Oct 09, 2019 9:59 am ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Micro wrote:
Assembler code, or machine language is processor and operating system specific. It is in fact all a processor understands, so everything ends up as simple ones and zeros (I thought I saw a TWO - Bender), memory locations, registers, and a handful of mathematical commands. The processor doesn't even know it is displaying data, as it can only move data from one memory location to another (i.e. the memory of your video card). It was the first language I learned, but I wouldn't want to code in it now :)


Ahh. I miss Assembler. Coolest thing I’ve ever done, during an endeavour to create my own OS, was switch my x86 into Protected Mode, and display: “Hello World” (sans INT calls.) ....Microsoft is lucky I got distracted by something shiny. Lol.

Author:  Micro [ Wed Oct 09, 2019 3:00 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

LoneStar wrote:
Ahh. I miss Assembler. Coolest thing I’ve ever done, during an endeavour to create my own OS, was switch my x86 into Protected Mode, and display: “Hello World” (sans INT calls.) ....Microsoft is lucky I got distracted by something shiny. Lol.

I feel sorry for the guy who wrote MS-DOS, Bill Gates launched an empire off his work, and he got next to nothing for it.

Author:  LoneStar [ Thu Oct 10, 2019 9:43 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Micro wrote:
LoneStar wrote:
Ahh. I miss Assembler. Coolest thing I’ve ever done, during an endeavour to create my own OS, was switch my x86 into Protected Mode, and display: “Hello World” (sans INT calls.) ....Microsoft is lucky I got distracted by something shiny. Lol.

I feel sorry for the guy who wrote MS-DOS, Bill Gates launched an empire off his work, and he got next to nothing for it.

Bills only Claim to fame is that he wrote the FAT, which ironically foreshadowed MS’s entire business model: make it work now, fix it over a decade of updates, by gradually incorporating other people’s ideas.

Author:  Grey Gamer [ Thu Jan 12, 2023 12:57 pm ]
Post subject:  Re: TWX Technical Discussion (and decompiling info)

Hey Shadow! Are you still working on TW? :)

Page 2 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/