Author Topic: use of assembly script  (Read 6211 times)

0 Members and 1 Guest are viewing this topic.

Offline mirQB

  • Newbie
  • Posts: 2
    • View Profile
use of assembly script
« on: August 31, 2018, 01:20:51 pm »
Hello gys,

I'd appreciate any help concerning how to use (modify) assembly script written in older QBasic 32-bit version.
(I have some basic experience w/ QB64 programming)

In particular, is it possible to call ituse it QB64 source program?
(I have WIN7 64-bit CPU)

When I tried:

REM $include: 'MyData.ASM'

I've got syntax error.

partial sample of the assembly file I have is listed bellow (*)

hanks in advance for a help!

Mir

Note: (*)

;DECLARE SUB VCOPY (SEG A#, SEG B#, BYVAL n%)
;nx1  nx1
;[a]=>
;
        .model  medium
        .486
VCOPY   proto   fortran, avec:far ptr qword, bvec:far ptr qword, nn:word
        .code
        public  VCOPY
VCOPY   proc    fortran, avec:far ptr qword, bvec:far ptr qword, nn:word
        pusha   ;ax,cx,dx,bx,sp,bp,si,di
        push    ds              ;[a]=>
        push    es              ;nx1  nx1
        lds     si,avec         ;load avec addr
        les     di,bvec         ;load bvec addr
        mov     cx,nn           ;load counter
        shl     cx,1            ;2n=# dwords to move
        cld                     ;clear dir flag
        rep     movsd           ;move data
        pop     es
        pop     ds
        popa    ;
        ret
VCOPY   endp
        end
« Last Edit: September 01, 2018, 11:32:25 am by odin »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: use of assembly script
« Reply #1 on: August 31, 2018, 01:44:49 pm »
Inline Assembly is not supported by QB64. Looking at your asm code and what it does perhaps the _MEM commands could achieve your the desired results. The memory handling commands are located here:

http://qb64.org/wiki/Keyword_Reference_-_By_usage#Memory_Handling_and_Clipboard

_MEMCOPY for example may allow you to do the same thing your asm code is performing.

In other words, perhaps your asm functions could be recreated using QB64?
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: use of assembly script
« Reply #2 on: August 31, 2018, 01:45:49 pm »
Hi mirQB,

Welcome to the forum!

I know nothing of assembly but Wiki has some ideas about it if you search that subject, you might pickup some tips.

http://qb64.org/wiki/index.php?search=assembly&title=Special%3ASearch&go=Go

Offline mirQB

  • Newbie
  • Posts: 2
    • View Profile
Re: use of assembly script
« Reply #3 on: September 01, 2018, 04:54:38 am »
Thanks for a good advice Terry!  It looks like my best approach is to study how to use _MEME* commands.

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: use of assembly script
« Reply #4 on: September 01, 2018, 05:39:30 am »
Welcome to the forum mirQB,

there's also a small tutorial for _MEM blocks usage listed under the "Articles and Tutorials" page:
https://qb64forum.alephc.xyz/index.php?topic=2381.0
« Last Edit: January 31, 2022, 12:16:50 pm by RhoSigma »
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: use of assembly script
« Reply #5 on: September 01, 2018, 11:25:22 am »
Thanks for a good advice Terry!  It looks like my best approach is to study how to use _MEME* commands.

You're welcome. I wish I could have been of more help though. It's been quite some years since I coded in assembler (80's - very early 90's). Seeing your code pushing registers into the stack brings back memories. :)
In order to understand recursion, one must first understand recursion.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: use of assembly script
« Reply #6 on: September 01, 2018, 11:29:58 am »
there's also a small tutorial for _MEM blocks usage listed under the "Articles and Tutorials" page:
http://www.qb64.org/articles/articles.html

I remember a great tutorial on _MEM usage by Steve on the [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] site.

Steve, if you read this, and you still have it, posting it on [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] would be excellent.
In order to understand recursion, one must first understand recursion.