Author Topic: Two Questions  (Read 8295 times)

0 Members and 1 Guest are viewing this topic.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Two Questions
« on: July 20, 2011, 07:45:00 pm »
I have two questions, aptly-stated by the title of this thread. My first question is about using the global CALCnet client program I downloaded from Cemetech.net http://www.cemetech.net/programs/index.php?mode=file&path=/win/gcnclient.zip. Reading through the included readme-style PDF document, I understood basically how it works. 

I’m trying to connect my calculator to the internet using Gossamer and the gCn Client software. To get to this work, the way I understand it, I need to run the gcnclient.exe program with some command line arguments.
What exactly are the arguments that I would need to type in the command prompt to get it to work? So far what I have is :
Code: [Select]
>gcnclient.exe -n WebHub
-l (don’t know what to put here)
-s (no idea)
-p 4295
-d direct (not sure if this works yet)

(Obviously without the carriage returns)
So yeah. That’s what I would like cleared up about that.

My second question is, how do I make use of interrupts in Axe? What is some example code where interrupts would be useful? I kind of understand what interrupts are, but not completely.

Thanks.
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Two Questions
« Reply #1 on: July 20, 2011, 07:49:33 pm »
Interrupts are triggered by hardware every ____(you can set the frequency) of a second. When interrupts occur, the CPU switches from executing code where ever it is currently executing to where the interrupt code is. A good usage would be as a timer, as it is called at consistent times, regardless of how much code is executed around it.
« Last Edit: July 20, 2011, 07:50:00 pm by Binder News »
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Ashbad

  • Guest
Re: Two Questions
« Reply #2 on: July 20, 2011, 07:50:20 pm »
Interrupts are basically events that are triggered every few assembly instructions, at a call frequency defined by the second argument of fnInt(.  The first gives the subroutine to be called every few cycles, the second is the speed.  Example:

Code: [Select]
fnInt(LOL,0)

Lbl LOL
  Disp "LOL"
Return

The word "LOL" will be displayed every few cycles.

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Two Questions
« Reply #3 on: July 20, 2011, 07:52:50 pm »
So if I did:

Code: [Select]
fnInt(LOL,5)
then the code at Lbl LOL will be executed five times every second, or every 5 assembly instructions?
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Two Questions
« Reply #4 on: July 20, 2011, 07:57:18 pm »
It's not 5 times a second. It might be every 5 instructions. Maybe it's every 5 CPU cycles. I can't remember off the top of my head.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Two Questions
« Reply #5 on: July 20, 2011, 08:00:23 pm »
About what does the frequency have to be if you want some code to execute once every second?
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Two Questions
« Reply #6 on: July 20, 2011, 08:00:33 pm »
Quote from: commands list
FnInt(LBL,FREQ) Turns the subroutine into an interrupt and then turns interrupts on. The frequency can be (fastest) 0, 2, 4, or 6 (slowest). L2 is used for interrupt data so do not use L2 for storage when using interrupts.
http://eeezor.ec3club.tk/Files/Resources/program%20readmes/Axe/Commands.htm#Int

Seems to me the same thing Desolate has? :P
« Last Edit: July 20, 2011, 08:00:52 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Two Questions
« Reply #7 on: July 20, 2011, 08:03:25 pm »
Although you can specify whatever number you want for the second argument, fnInt()'s second argument is always ANDed with 6. This means that the only meaningful second argument values are 0, 2, 4, and 6. The interrupts will then run at a frequency according to the chart below:

Freq argument   83+BE Freq   All Else Freq
0560Hz512Hz
2248Hz227.55Hz
4170Hz146.29Hz
6118Hz107.79Hz

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Two Questions
« Reply #8 on: July 20, 2011, 08:04:58 pm »
Do you know how I might set up an interrupt to do something once every second?
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Two Questions
« Reply #9 on: July 20, 2011, 08:07:01 pm »
You would need a counter. Then, set it to 0, and when an interrupt is called, increment the counter. If the counter equals a certain value, then reset it and execute the code.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Two Questions
« Reply #10 on: July 20, 2011, 08:07:14 pm »
count the number of calls. When the interupt routine has been called 118 times at frequence 6 on a 83+, then do something

Example:
Code: [Select]
.timer
0->A
0->B
fnInt(INT,0)
Repeat GetKey(15)
End
lnReg

lbl INT
A+1->A
Return!If A=512
B+1->B
Disp B
0->A
Return
« Last Edit: July 20, 2011, 08:11:29 pm by ben_g »
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Two Questions
« Reply #11 on: July 20, 2011, 08:15:04 pm »
The DS<( command can be useful for running an interrupt at a low frequency. On non-83+BE calcs, enclosing all the code in a subroutine running on a 512Hz interrupt with DS<(I,512) can be used to execute a block of code exactly once per second:

Code: [Select]
512→I
fnInt(I,0)

.Main program goes here

Lbl I
  DS<(I,512)
    .1Hz interrupt code goes here
  End
Return


However, on the 83+BE, the timers aren't exact, so don't expect to be able to pull off perfect timing on it. If you're not using the timer for precise timing, you can use the following code. This solution should create an ~1Hz interrupt on any model:

Code: [Select]
fnInt(I,6→I)

.Main program goes here

Lbl I
  DS<(I,{Full+1+Data(108,118)})
    .1Hz interrupt code goes here
  End
Return
« Last Edit: July 20, 2011, 08:21:24 pm by Runer112 »

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Two Questions
« Reply #12 on: July 21, 2011, 04:48:54 pm »
Thanks for the help, this is pretty awesome information.

Can anyone answer my gCn client question?
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Two Questions
« Reply #13 on: July 22, 2011, 03:47:44 am »
Can anyone answer my gCn client question?
Maybe you could try asking on Cemetech? They know a lot about gCn.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Two Questions
« Reply #14 on: July 22, 2011, 10:45:37 am »
Quote from: calcdude84se
If you're on Windows, you'll also need to install the filter driver. Get libusb-win32 at http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-bin-1.2.4.0.zip/download, extract the .zip file, and run bin\x86\install-filter-win.exe
Quote from: calcdude84se
... <local_name> can be anything, but is often based on user name (I use "CalcHub", for example. The main idea is that you provide something unique.) You can ignore the -s and -p options almost always; they default to what's necessary to connect to the server Kerm's set up.
(To clarify: <local_name> refers to what's after -l.)
To use DirectUSB, you are correct in using "-d direct", but note that "-d d" also works and is shorter ;)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.