Author Topic: OK Hi everyone  (Read 583 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Newbie
  • Posts: 73
Re: OK Hi everyone
« Reply #15 on: November 21, 2020, 06:10:42 PM »
Hi Vince

Ok Im not totally against SUBS or FUNCTIONS  which are like magic  black boxes -you put data in and get data out.   Nothing wrong with that,  The thing is - when you start programming in COMMON memory the SUBS and FUNCTIONS suddenly become redundant.

 
Quote
Would you rather have those variables in a permanent location in BC_DATA consuming 14 bytes of data or would they be better suited for the stack where they can be released or use on other temporary variables? You may be likely already using the stack for when you run out of registers in this complicated routine.

Well BC_DATA is 64k bytes and  you can store a lot of variables there.   14 bytes of data is not going to cause any problems.    Assembler code can access the same variable by name say:   (Using Quick Basic 4.5)
****
QB code
DIM APPLE AS INTEGER
APPLE = 27
****
ASM code
add w[apple],1     (that is A86 assembler.)
****
QB code
PRINT APPLE
28
****

This is how assembler interprets the word "apple"

****
ASM code
apple EQU  6
****
Where "apple" is the first variable that was DIMed

EQU means equate

In this case, the word "apple" literally means 6
so
add w[apple],1
is the same as 
add w[6],1

Why the 6??

Data starts at offset 6 into BC_DATA

You can't write to the first 6 bytes as this is reserved for QB, don't know what for.
****
« Last Edit: November 22, 2020, 03:36:38 AM by NOVARSEG »