Author Topic: QBASIC POKE IN REXX is possible?  (Read 1275 times)

roberto

  • Hero Member
  • *****
  • Posts: 649
  • Karma: +2/-0
    • View Profile
QBASIC POKE IN REXX is possible?
« on: November 05, 2021, 08:22:23 pm »
I wanted to know if there is an instruction similar to QBASIC Poke in Rexx

POKE &H00006281, 238 in rexx =   ...

Saludos

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 783
  • Karma: +13/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #1 on: November 05, 2021, 10:20:54 pm »
Probably not. I don't really know that about Basic, but no REXX functions to write directly to memory (poke) or read from it (peek) come to my mind. Because I'm just at it: The E macro language for EPM, similar to REXX, has them.

Without creating a REXX DLL that provides them and if you limit it to common scripting languages, I would rather look at PERL etc. (without knowing if they exist there).
« Last Edit: November 05, 2021, 11:16:56 pm by Andreas Schnellbacher »

roberto

  • Hero Member
  • *****
  • Posts: 649
  • Karma: +2/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #2 on: November 07, 2021, 12:05:39 am »
The E macro language for EPM, similar to REXX, has them.
I am trying to use the language E.
But I'm stuck when executing the Test.e example
Fail the link

(C:\PROGRAMS\NEPMD\EPMBBS\SAMPLES\REXX)C:\PROGRAMS\NEPMD\EPMBBS\BIN\ETPM.EXE TES
T.E
The 'E' Language Translator for OS/2.  Version 6.03b
(C) Copyright IBM Corporation 1986-1989, 1990, 1991
 compiling ...

(C:\PROGRAMS\NEPMD\EPMBBS\SAMPLES\REXX)C:\OS2\LINK.EXE TEST.EX

Microsoft (R) Segmented-Executable Linker  Version 5.10.005
Copyright (C) Microsoft Corp 1984-1989.  All rights reserved.

Run File [TEST.EXE]:
List File [NUL.MAP]:
Libraries [.LIB]:
Definitions File [NUL.DEF]:
TEST.EX : fatal error L1101: invalid object module
 pos: 1 Record type: 00

saludos

Dave Yeo

  • Hero Member
  • *****
  • Posts: 3633
  • Karma: +77/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #3 on: November 07, 2021, 12:20:52 am »
You're using an ancient 16 bit linker, try link386 or ilink

Lars

  • Hero Member
  • *****
  • Posts: 956
  • Karma: +45/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #4 on: November 07, 2021, 07:39:04 pm »
There can never be a POKE that can touch any arbitrary memory address. That would completely ruin the OS memory protection.
And then, it is unclear from the question, if we are talking about physical addresses or linear addresses.
If you really want to ruin your system, you would need to write a device driver which can be called via IOCTL and then call that from a REXX DLL.
Of course I would never,ever install such a driver or DLL.

Mentore

  • Jr. Member
  • **
  • Posts: 91
  • Karma: +3/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #5 on: November 08, 2021, 08:06:28 am »
I wanted to know if there is an instruction similar to QBASIC Poke in Rexx

POKE &H00006281, 238 in rexx =   ...

Saludos

Hi Roberto,
as others answered, a direct POKE in a memory protected system is forbidden. It would most probably ruin everything and break the system.
Question arises then: why do you need to use POKE? I'm guessing you're trying to port some old QBASIC software...

Mentore

Lars

  • Hero Member
  • *****
  • Posts: 956
  • Karma: +45/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #6 on: November 08, 2021, 10:09:23 am »
Judging from what Roberto tried in the past, it looks like he wants to overwrite code of DLLs that are loaded into memory (for example by overwriting instructions that load the flat selector value into a register).

That by itself is already a problem because DLLs are NOT guaranteed to load at a specific memory address, at least not in general (if he wants to poke at linear addresses).

Then, there is the issue that any code already cached in the instruction cache will know nothing about the changes in code that have been done in memory (I seem to remember and I also seem to remember that this is DIFFERENT from data access as that will lead to cache update of the data cache on modifying memory). That is why it has become so difficult if not impossible to write self-modifying code: you would need to invalidate the cache lines in the instruction cache that hold that modified code and therefore force a reload of the instruction cache when again accessing that code (and potentially enforce cache coherency amongst multiple cores if that does not happen automatically !). This is nothing for the faint hearted.
« Last Edit: November 08, 2021, 10:15:32 am by Lars »

Lars

  • Hero Member
  • *****
  • Posts: 956
  • Karma: +45/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #7 on: November 08, 2021, 12:57:02 pm »
As to self and cross modifying code:
the proper explanation is given in the "Intel Software Developer's Manual", volume 3 in chapter "Handling Self- and Cross-Modifying Code".

Therefore, the caching issues do not apply, but the multi-core issues do.

roberto

  • Hero Member
  • *****
  • Posts: 649
  • Karma: +2/-0
    • View Profile
Re: QBASIC POKE IN REXX is possible?
« Reply #8 on: November 08, 2021, 05:15:32 pm »
I answer a bit because. I only have a computer where I can try those memory modifications, each time they are more intangible things. To the point that I can not do anything in summer for the increased temperature, which affects and a lot. So I wanted to be able to do the tests on other computers where the QBASIC not works for this, for being more modern or simply different. Anyway, I have to admit that programmers have done a great job. And it is very difficult for me to improve what is currently in the last version.

Dave - The link386 give me the same error as link I am try to link the Hello word! in language E

Saludos