Author Topic: DCS Axiom development  (Read 9704 times)

0 Members and 1 Guest are viewing this topic.

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
DCS Axiom development
« on: April 04, 2011, 03:23:08 pm »
Sparking from this topic (http://ourl.ca/10077/193661;topicseen#new), I've decided to try and see if I can write a DCS axiom! :) However, my assembly is terrible, so I will need LOTS of help with it. From the messages in the thread, it seems that our assembly devs are puzzled at how to write an Axiom, but could easy make an ASM program. Hopefully, from this topic, a quick start/manual can be written on how to write Axioms. THEN our awesome assembly programmers' powers can be unleashed! ;)

OK, so let's get started! :D

First off, I'm basing my Axiom from the MemKit template. My assembler is SPASM (part of the WabbitStudio suite), OS Linux.
I also am using http://dcs.cemetech.net/index.php?title=GUI_API for reference on how to use the DCS' GUI libraries in assembly.
With that, I'm currently just trying to write example code for myself (and probably others).
I'm focusing on: http://dcs.cemetech.net/index.php?title=GUI_API#Adding_GUI_Elements

Here's a code snip from the API docs:
Code: [Select]
ld hl,SmWinData
ld de,SmWinDataEnd-SmWinData
ld a,GUIRSmallWin
call PushGUIStack
ld hl,winButtons
ld de,dat_end-winButtons
ld a,GUIRWinButtons
call pushGUIStack
ld hl,0
call GUIMouse
ret
SmWinData:
     .db 5,5     ;the x and y coordinates relative to the LCD of the top-left of the window
     .db $F8,$88,$88,$88,$F8   ;a square icon
     .db "My Window",0    ;the window title
SmWinDataEnd:
exitMyProg:
  call ResetAppPage
  ret
winButtons:
 .db 00100000b      ;only displaying a close button
 .dw 0              ;null pointer
 .dw 0              ;another null pointer
 .dw exitMyProg     ;we'll jump to exitMyProg when this button is clicked
dat_end:

Of course, we really don't want internal data, but the data for the arguments the user provides! :)

In the end, after a back and forth on IRC, I've gotten this code:
Code: [Select]
.nolist
#include "ti83plus.inc"
#include "Axe.inc"
#include "dcs7.inc"
.list

#define B_CALL(xxxx) rst 28h \ .dw xxxx

 .dw AXM_HEADER

 .dw Ax1_End
 .db AXM_ALL
 .dw tok_DrawL ;DlgBox()
 .db AXM_INLINE
 .db AXM_1ARG
 .org 0
 ; OLD CODE:
 ; call OpenGUIStack
 ; ld hl,SmWinData
 ; ld de,SmWinDataEnd-SmWinData
 ; ld a,GUIRSmallWin
 
 ; OK, so let's first get stuff ready! (Open the GUI stack!)
 call OpenGUIStack
 ; Text is stored in HL already, no need to move it around!
 ; Save hl!
 push hl
 ; Now find the length of the string arg!
 call sub_Length
 ; Copy it to the correct place...
 ex de,hl
 ; ...and bring back the string arg!
 pop hl
 ; Set window type!
 ld a,GUIRSmallWin
 
 ; Push the GUI!
 call PushGUIStack
 
 ; Now, add the close button to the window.
 ld hl,winButtons
 ld de,dat_end-winButtons
 ld a,GUIRWinButtons
 call pushGUIStack

 ; Now, render the GUI and give control (mouse) to DCS!
 ld hl,0
 call GUIMouse

 ret

exitMyProg:
  call ResetAppPage
  ret
winButtons:
 .db 00100000b      ;only displaying a close button
 .dw 0              ;null pointer
 .dw 0              ;another null pointer
 .dw exitMyProg     ;we'll jump to exitMyProg when this button is clicked
dat_end:
Ax1_End:

 .dw AXM_END

.end

Unfortunately, this crashes! :( Is there any errors that should be fixed?
« Last Edit: April 04, 2011, 03:24:28 pm by alberthrocks »
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: DCS Axiom development
« Reply #1 on: April 04, 2011, 03:50:46 pm »
Thank to launch this project, I hope you will succeed !
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: DCS Axiom development
« Reply #2 on: April 04, 2011, 07:09:27 pm »
Thank to launch this project, I hope you will succeed !
Thanks kindermoumoute! :) Don't expect it to be fast though - it's going to be a tough thing to make (at least for me).

So, does anyone has any ideas why this is failing?
Also, if you think you're faster at making this all work, the code is licensed under GPL v3, so feel free to take it and work on it! :)
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: DCS Axiom development
« Reply #3 on: April 08, 2011, 03:42:48 pm »
Bumpity bumpity bump. Any fix for the crashing code above?

Also, this project is 100% open source (and free, obviously)! :) That means that this project is open for any collaboration, and I'd love to get some help for this Axiom. If you want to help out, hop right in! :D
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: DCS Axiom development
« Reply #4 on: April 08, 2011, 03:57:08 pm »
Code: [Select]
call OpenGUIStack

 push hl

 call sub_Length

 ex de,hl

 pop hl

 ld a,GUIRSmallWin
 
 call PushGUIStack
 
 ld hl,winButtons
 ld de,dat_end-winButtons
 ld a,GUIRWinButtons
 call pushGUIStack

 ld hl,0
 call GUIMouse

 ret

This seems like fully working to me. So, I have no idea of what the problem might me. Maybe ask for help at Cemetech too, they have some Assembly experts over there :D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: DCS Axiom development
« Reply #5 on: April 12, 2011, 11:28:02 am »
I may have an idea (Kerm Martian's actually).

Code: [Select]
; OK, so let's first get stuff ready! (Open the GUI stack!)
 call OpenGUIStack
 ; Text is stored in HL already, no need to move it around!
 ; Save hl!
 push hl
 ; Now find the length of the string arg!
 call sub_Length
 ; Copy it to the correct place...
 ex de,hl
 ; ...and bring back the string arg!
 pop hl
 ; Set window type!
 ld a,GUIRSmallWin
 
 ; Push the GUI!

When you call OpenGUIStack, it probably deletes what's in hl, so then you can't really push it.

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: DCS Axiom development
« Reply #6 on: April 13, 2011, 08:57:19 pm »
OK, I've (hopefully) fixed it! :) Unfortunately, I'm *really* busy atm, so I didn't have time to test.
From what you've said above, I've followed this logic:
Code: [Select]
; Save hl!
 push hl
 ; Now find the length of the string arg!
 call sub_Length
The argument is saved, and we call sub_Length to figure out the length of that string argument.
It gets pushed back to HL, so I pushed HL to a stack to save the argument.
Code: [Select]
; Copy it to the correct place...
 ex de,hl
I exchanged the new HL with DE, where it's supposed to go. Now the length is saved!

Code: [Select]
call OpenGUIStackSince we don't need HL anymore, we're can call it and let it destroy things!

Code: [Select]
; ...and bring back the string arg!
 pop hl
And of course, HL is save and sound.... right?

Hopefully that logic will work! :)
I've attached the compiled 8Xp - simply add #Axiom(DCSAXIOM) to your code, and then
use DrawL("hello world!") to test! :)

Beware that this may crash your calc, so please, please, PLEASE back up your stuff before proceeding.
Thanks to KermMartian for the tip! :)

EDIT: Silly me, forgot to actually attach something! :P
Also, you can view the entire code here:
http://code.google.com/p/axe-gui-libraries/source/browse/src/dcs7axiom/DCSAxiom.z80

EDIT 2: Apparently DE is also destroyed too (according to http://dcs.cemetech.net/index.php?title=OpenGUIStack), so I've added a push/pop de into the code and recompiled - hopefully this is the panacea to the crash? (Reattached program with changes)
« Last Edit: April 13, 2011, 09:17:29 pm by alberthrocks »
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: DCS Axiom development
« Reply #7 on: April 14, 2011, 06:10:22 am »
Very nice alberthrocks! I gotta check that and try and add CloseGUIStack.

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: DCS Axiom development
« Reply #8 on: May 16, 2011, 12:54:15 pm »
Up ?
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: DCS Axiom development
« Reply #9 on: May 16, 2011, 05:33:01 pm »
IN summary, this is an Axiom to use Doors CS GUI libraries and such things, right?

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: DCS Axiom development
« Reply #10 on: May 16, 2011, 07:25:34 pm »
Yup! :)
It's still a heavy WIP, but it will be ready soon! :D
Thank you guys for reminding me! It'll be a while before this takes off due to much projects and HW from school, and tests next week. I'm literally swamped to death... X_X
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: DCS Axiom development
« Reply #11 on: May 16, 2011, 08:47:35 pm »
When do you finish school?