Author Topic: Will this work?  (Read 3949 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Will this work?
« on: November 17, 2020, 08:26:38 pm »
Can QB64 compile this?

**** Quick Basic source code

CALL  trythis   ' a label in assembler
****

****the assembler code  (example A86 assembler)

trythis:
RETF
****

****Quick Basic source code
PRINT "we made it back!!"
end
****
A86 will produce an object file from the assembler code.  Does QB64 support "CALL label " where the label is in assembler code.
« Last Edit: November 17, 2020, 08:34:16 pm by NOVARSEG »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Will this work?
« Reply #1 on: November 17, 2020, 09:06:05 pm »
Nope.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Will this work?
« Reply #2 on: November 19, 2020, 07:20:10 pm »
If you're interested, freebasic's got it all:  https://www.freebasic.net/wiki/KeyPgAsm

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Will this work?
« Reply #3 on: November 19, 2020, 07:35:10 pm »
OK thanks
It looks like inline ASM.

I think the CPU must be in virtual mode (VM) to apply the real mode x86 instruction rules so are real mode x86  ASM in  freebasic a problem?
« Last Edit: November 19, 2020, 07:55:46 pm by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Will this work?
« Reply #4 on: November 19, 2020, 07:49:03 pm »
I can see problems arising since the DS selector value must be derived from  freebasic at compile time?

If DS selector value is known then just a matter of using say EAX for memory addressing so a real mode x86  address needs to be converted to a protected mode address. I guess?
« Last Edit: November 19, 2020, 07:57:09 pm by NOVARSEG »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Will this work?
« Reply #5 on: November 19, 2020, 08:17:59 pm »
There is no real mode with freebasic.  Even freebasic for DOS runs in 32 bit protected mode requiring at least a 386

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Will this work?
« Reply #6 on: November 19, 2020, 11:08:21 pm »
Most the time, anymore, stuff like that is simply emulated or workarounds cause modern OSes don't want to allow you to access low level actions like that anymore.
Granted after becoming radioactive I only have a half-life!

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Will this work?
« Reply #7 on: November 20, 2020, 02:14:33 am »
Cobalt
yep because the OS makers don't want others to control the machine.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Will this work?
« Reply #8 on: November 20, 2020, 02:19:58 am »
Vince

That's Ok as long as the ASM code addresses are protected mode ones

32 bit registers and 32 bit addressing can be done in 16 bit assembler like A86 with the 66h and 67h opcode prefixes. I've done that. Tricky though.