Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:23 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Firmware Wish List

     Page 14 of 14    
Author Message
jwettroth

Regular Member

Joined: 02/08/2011
Location: United States
Posts: 71
Posted: 07:06pm 13 Nov 2011
Copy link to clipboard 
Print this post

My wish is for a simple way to implement basic drivers for IO devices

For example: I'd like to make a MM system with an LCD display. I'd like to be able to link to a routine that wrote to the LCD when "print" commands were interpreted. In some basics, there are hooks built in but this usually uses assembly language techniques and wouuldn't apply so well to MM Basic.

An easy way to do this would be to enable the "OPEN" commands for a piece of basic code. The syntax would be something like
<< OPEN LCD,INITLINE,EXECLINE,EXITLINE FOR OUTPUT AS 1>.

INITLINE would be an intialization routine that would be called once to initialize the interface- called on open. EXECLINE would be used for normal calls- PRINT #1,DATA, etc. EXITLINE would be called on close or program exit. The basic program and calling return would detmine how the data payload is to be interpreted. It could be passed as an array perhaps and initialized with OPEN.

In concise terms for the wish list, I would call this:

Expand the OPEN Files syntax to allow access to a routine in BASIC for Input Output. Edited by jwettroth 2011-11-15
John Wettroth
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1313
Posted: 12:29am 15 Nov 2011
Copy link to clipboard 
Print this post

  jwettroth said   My wish is for a simple way to implement basic drivers for IO devices

snip---

In concise terms for the wish list, I would call this:

Expand the OPEN Files syntax to allow access to a routine in BASIC for Input Output.


Just wondering if anyone else has comments on this before I add it to the wish list.

Cheers Don...
https://www.dontronics.com
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 12:45am 15 Nov 2011
Copy link to clipboard 
Print this post

Perhaps I'm not understanding, but if functions are implemented, wouldn't that be a cleaner solution?
Micromites and Maximites! - Beginning Maximite
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6097
Posted: 01:23am 15 Nov 2011
Copy link to clipboard 
Print this post

  CircuitGizmos said   Perhaps I'm not understanding, but if functions are implemented, wouldn't that be a cleaner solution?


User defined functions would certainly cover the request and more.
Even being able to pass values to subroutines would help a lot.

Jim
VK7JH
MMedit   MMBasic Help
 
marcwolf

Senior Member

Joined: 08/06/2009
Location: Australia
Posts: 119
Posted: 01:29am 15 Nov 2011
Copy link to clipboard 
Print this post

Passing variables into Subroutines would still cause some issues as any variable changed within the subroutine would be changed globally.

Functions have isolated variables. The only variables that would be changed are Globals and the Passed/Returned values. They are also one of the first steps towards code libraries and object orientation.

Would be very hand to have and make it a lot easier for people to make add in libraries for various purposes.

Dave
Coding Coding Coding..
Keep those keyboards coding..
RAW CODE!!!!!
 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 03:08am 15 Nov 2011
Copy link to clipboard 
Print this post

A couple of months ago someone suggested a stack.
If parameters were pushed onto the stack, the subroutine or function could read them into local variables and push a return value onto the stack.
I don't have my MMBasic doco here, but I think there are only two variable types - strings and floating point numbers. Each would need an array. It should be reasonably easy to code on MMBasic.

I'd have a go at it, but I'm away from my normal computer and Maximite for a while.

James
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
     Page 14 of 14    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024