Page 1 of 1

Old 8-bit computer command ideas in a console program

Posted: Sun Feb 14, 2021 9:39 pm
by Desert Polar Bear
Short version: Trying to replicate three old 8-bit computer commands in a console program running on a Mac, so I can't cheat with DLLs, but maybe some kind of Mac magic behind the curtains?

1) BEEP. I accidentally found the command NSBeep_() in some source code on a forum message. It works, but I can't find any documentation on it anywhere. Also, I suspect there are number of other commands with the underscore "{Command}_()" syntax. How can I learn more about these?

2) CLEAR - Clear all numeric variables to 0 and all strings to "". Admittedly, this is kind of crazy, but...um...reasons!

3) SCREEN$ - Capture the console display and save as image.

4) SOUND - Generate specific frequency and wavelength tones without loading an mp3/ogg/Flac sound file.

Any help would be greatly appreciated. :?

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 7:16 am
by Demivec
Desert Polar Bear wrote:2) CLEAR - Clear all numeric variables to 0 and all strings to "". Admittedly, this is kind of crazy, but...um...reasons!
Define all variables, both numeric and string, within a structure. Use ResetStructure() to reset all as at first (numeric = 0, strings = "" or more accurately null).

Code: Select all

Structure all_vars
  ; change the names and typed to match your needs 
  n1.i
  n2.i
  n3.b 
  s1.s
  s2.s
  ; and so on
EndStructure 

Define vars.all_vars

vars\n3 = 5
vars\s2 = " blah "
Debug vars\n3
Debug vars\s2
ResetStructure(@vars,  all_vars)
Debug vars\n3
Debug vars\s2

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 7:54 am
by TI-994A
Desert Polar Bear wrote:...some kind of Mac magic behind the curtains?
These might be of interest:

> MacOS Carbon APIs

> MacOS Cocoa APIs

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 2:47 pm
by Desert Polar Bear
Demivec wrote:Define all variables, both numeric and string, within a structure.
Very cool. I have no experience with the Structure command, so I'm looking forward to learning more about it. Thanks!

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 3:19 pm
by Desert Polar Bear
TI-994A wrote:
Desert Polar Bear wrote:...some kind of Mac magic behind the curtains?
These might be of interest:

> MacOS Carbon APIs

> MacOS Cocoa APIs
Sakes! I've stepped in it now. Gonna have to put on my thinking cap for this stuff. Many thanks!

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 5:15 pm
by Bitblazer
Desert Polar Bear wrote:Short version: Trying to replicate three old 8-bit computer commands in a console program running on a Mac, so I can't cheat with DLLs, but maybe some kind of Mac magic behind the curtains?

1) BEEP. I accidentally found the command NSBeep_() in some source code on a forum message. It works, but I can't find any documentation on it anywhere. Also, I suspect there are number of other commands with the underscore "{Command}_()" syntax. How can I learn more about these?
Seems you refer to windows API calls.

The MSDN has all the information for those (Beep). Check Section 5.3 of the PureBasic Survival Guide

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 5:20 pm
by Desert Polar Bear
Bitblazer wrote:Seems you refer to windows API calls.
Running on a Mac, so not sure that's gonna work.

Thanks all the same, though! :)

Re: Old 8-bit computer command ideas in a console program

Posted: Mon Feb 15, 2021 9:32 pm
by mk-soft

Re: Old 8-bit computer command ideas in a console program

Posted: Tue Feb 16, 2021 1:09 am
by Desert Polar Bear
Many thanks!