Qbasicnews.com
September 19, 2019, 03:43:04 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Convert x86 Assembly Code to QBasic  (Read 9183 times)
JasonSG
New Member

Posts: 20


« on: August 17, 2005, 04:29:31 PM »

Challenge:
Create a program to take a file written x86 Assembly Language and convert it to a QBasic .bas file.

Requirements:
  • accept any ASCII format text file
  • outputs an ASCII format file (with either .txt or .bas extension)
  • supports all commands in the x86 assembly language
  • will use Call Interrupt for any code not recognized as QBasic based
  • must be written in QB (not FB)


Judging is based on similarity to the origional .bas file.

If you want a refrence for what QB keywords translate into what asm commands, compile a program with the /zi option, put cv.exe in the same folder as the compiled .exe, go into command prompt, use chdir to change the directory to the one that your program is in, and type "cv [progname]" where [progname] is the name of your program (with the .exe extension).
Logged
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #1 on: August 17, 2005, 06:45:00 PM »

That's rather impossible - QB statements usually don't translate into just one assembler instruction, and QB only uses a small subset of the possible range of x86 instructions.
Logged
JasonSG
New Member

Posts: 20


« Reply #2 on: August 17, 2005, 10:01:08 PM »

Anything that wasn't generated by QB could be placed into QB by using DATA, READ, and CALL INTERRUPT, right?  And wouldn't the same set of QB commands always translate into the same set of assembler instructions, and wouldn't the reverse be true too?  If not, how does the QB compiler work?
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #3 on: August 18, 2005, 12:29:57 AM »

debug.com
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
JasonSG
New Member

Posts: 20


« Reply #4 on: August 18, 2005, 12:58:42 AM »

The idea still holds, if it can be done, the reverse should be able to be done (at least in this case--I think).  However command.com assembles the code from the .bas file, the reverse should be able to be done, at least to some extent.  You should be able to take qb generated assembly code, and turn it back into qb commands, right?
Logged
Moneo
Na_th_an
*****
Posts: 1971


« Reply #5 on: August 18, 2005, 04:47:23 PM »

Wrong. It's kinda like Humpty Dumpty...... and all the kings horses and all the kings men cannot put Humpty Dumpty together again.

In a university research enviromment, given enough time and resources, you could conceive of this kind of reverse-engineering project being achieved. But it is definitely not material for a challenge on this forum to be implemented by one person in a finite amount of time.
*****
Logged
MystikShadows
Ancient Guru
****
Posts: 542



WWW
« Reply #6 on: August 18, 2005, 05:14:25 PM »

I have to agree with Moneo here.  In QB all instructions are not tranlated to Assembler, but rather to B$MNEMONIC which are in themselves series of assembly code.  best that could be done is a translation to those B$MNEMONICS so to speak.
Logged

hen they say it can't be done, THAT's when they call me ;-).




need hosting:  http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Z!re
*/-\*
*****
Posts: 4599


« Reply #7 on: August 18, 2005, 08:16:58 PM »

All variable and function names are lost when you compile in QB

DO, LOOP; WHILE, WEND; FOR, NEXT; LABEL:, GOTO all translate to almost the same.

For example:
A = 0
DO
A = A + 1
LOOP WHILE A < 10

Is equal to:
FOR A = 0 TO 10
NEXT

Or:
A = 0
Label:
A = A + 1
IF A < 10 THEN GOTO Label

Or even:
A = 0
WHILE A < 10
A = A + 1
WEND

They dont result in the same, ASM output, but you have no real way of knowing what the user did.


In the end, too much work for a challenge
Logged
JasonSG
New Member

Posts: 20


« Reply #8 on: August 20, 2005, 10:26:28 PM »

Oh well.  I thought it might be interesting.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!