QB64.org Forum

Active Forums => Programs => Topic started by: mirQB on August 31, 2018, 01:20:51 pm

Title: use of assembly script
Post by: mirQB 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
Title: Re: use of assembly script
Post by: TerryRitchie 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?
Title: Re: use of assembly script
Post by: bplus 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
Title: Re: use of assembly script
Post by: mirQB 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.
Title: Re: use of assembly script
Post by: RhoSigma 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
Title: Re: use of assembly script
Post by: TerryRitchie 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. :)
Title: Re: use of assembly script
Post by: TerryRitchie 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.