BBC BASIC for Windows
« Commented Libraries »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:32pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Commented Libraries  (Read 933 times)
Malcolm
Guest
xx Commented Libraries
« Thread started on: Mar 22nd, 2011, 6:14pm »

I imagine most people use the standard compile options so REMs are taken out and variables crunched. That means that the speed of programs is unlikely to be affected much by commenting the library code fully.
I always like to know what is going on even if it is under the hood (bonnet). Would anyone like to comment some of the libraries. I know that there are several readers of these pages that could. I think that WINLIBs would be the obvious ones to start with. I imagine the use of dialog boxes must be one of the first things users progress to.
I understand the "demo" argument on size limitations but it seemed to work in the COMLIB / COMLIBA situation.
Is some of the assembly code essential to making it work, or just for speed or some other purpose, for instance? I hope it isn't there to make it obscure, although it does that for me. Learning machine code is on my list of things to do before I die, but it has been on the list for a long time. I think it is just before sky diving.

If nothing else would it be possible to explain say WINLIB2 workings as an occasional series here.

Malcolm.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Commented Libraries
« Reply #1 on: Mar 22nd, 2011, 10:05pm »

on Mar 22nd, 2011, 6:14pm, Guest-Malcolm wrote:
Is some of the assembly code essential to making it work, or just for speed or some other purpose, for instance?

As far as the supplied libraries are concerned, in the majority of cases the assembler code is essential to the operation of the library, and could not be replaced by BASIC code. The main exceptions are ARRAYLIB and SORTLIB, which use assembler code for reasons of performance.

Richard.
User IP Logged

Malcolm
Guest
xx Re: Commented Libraries
« Reply #2 on: Mar 23rd, 2011, 4:41pm »

Anyone like to expand as to what this does and why?

[OPT 2
.K% push H% : call "SetFocus" : ret 16
.M% cmp dword [esp+8],&500 : jz K%
pop eax : push [^O%] : push eax : jmp "CallWindowProc"
]

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Commented Libraries
« Reply #3 on: Mar 23rd, 2011, 6:58pm »

on Mar 23rd, 2011, 4:41pm, Guest-Malcolm wrote:
Anyone like to expand as to what this does and why?

It calls the SetFocus API, but in the context of the thread containing the message pump rather than the interpreter's thread.

The documentation of SetFocus says: "The SetFocus function sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue":

http://msdn.microsoft.com/en-us/library/ms646312.aspx

Since the interpreter's thread doesn't have a message queue, simply doing SYS "SetFocus" doesn't work.

Richard.
User IP Logged

Malcolm
Guest
xx Re: Commented Libraries
« Reply #4 on: Mar 23rd, 2011, 11:02pm »

Thanks Richard,

I understand the concept of threads but not the practicality. I had better read up some more.

Malcolm.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls