I'm having a go at rewriting WizardC in ASM as Version 8. So far my code is:


Code:

#include "ti83plus.inc"
.org $9D93
   .db $BB,$6D
Start:

menuStart:

   b_call(_ClrLCDFull)
   LD   HL,txtHeader
   CALL   dispHeader

   LD   HL,txtItem1
   CALL   dispItem
   LD   HL,txtItem2
   CALL   dispItem
   LD   HL,txtItem3
   CALL   dispItem
   LD   HL,txtItemQuit
   CALL   dispItem

menuLoop:

   b_call(_GetKey)

   CP   k1
   JR   Z,item1

   CP   k2
   JR   Z,item2

   CP   k3
   JR   Z,item3

   CP   k4
   JR   Z,quit

   JR   MenuLoop

item1:

   b_call(_ClrLCDFull)

   LD   BC,0
   LD   (curRow),BC

   LD   HL,txtSelect1
   b_call(_PutS)

   b_call(_GetKey)

   JR   menuStart

item2:

   b_call(_ClrLCDFull)

   LD   BC,0
   LD   (curRow),BC

   LD   HL,txtSelect2

   b_call(_PutS)
   b_call(_GetKey)

   JR   MenuStart

item3:

   b_call(_ClrLCDFull)

   LD   BC,0
   LD   (curRow),BC

   LD   HL,txtSelect3
   b_call(_PutS)

   b_call(_GetKey)

   JR   menuStart

quit:

   b_call(_ClrLCDFull)

   RET

dispHeader:

   LD   BC,$0
   LD   (curRow),BC

   SET   textInverse,(IY+TextFlags)
   b_call(_PutS)
   RES   textInverse,(IY+TextFlags)

   LD   HL,0
   LD   (curRow),HL

   RET

dispItem:

   PUSH   HL
   b_call(_NewLine)
   POP   HL

   b_call(_PutS)

   RET

txtHeader:
   .db "Wizard Currency Converter",0

txtItem1:
   .db "1: Dollars:Gallions",0

txtItem2:
   .db "2: Gallions:Dollars",0

txtItem3:
   .db "3: About",0

txtSelect1:
   .db "Dollars:Gallions is under construction.",0

txtSelect2:
   .db "Gallions:Dollars is under construction.",0

txtSelect3:
   .db "About is under construction.",0

txtItemQuit:
   .db "4: Quit",0
.end
END
Cool! Looks like you are getting the hang of things. Smile
When I try to compile the code, I get an error message "label 'menuStart' already defined".

What in my code went wrong?
Try naming it something else, because something else is already named menuStart and you can't use it.
What else is named menuStart?
In ti83plus.inc, it says
Code:
menuStart      equ 02Bh
. menuStart is a key equate for something to do with menus (I'm not exactly sure what but it isn't really important now) which you cannot redefine. Since you cannot have two equates with the same name, the assembler gives you an error.
http://z80-heaven.wikidot.com/menus

I'm trying to make a menu for my program from the site above and it says for me to make a label menuStart.

Why does it say that?
Maybe that guide is outdated or something. You should name menuStart something different and that should solve the problem.
Okay. Where on the web are the best routines for z80 ASM?

Any alternatives to z80-heaven.wikidot.com?

Any helpful routines for WizardC8?
The "best" code is entirely dependent on what you need to do, but for routines I would say that you should look on Ticalc and other sites for programs which are open-source for examples. Wikiti also has some routines but is more oriented toward the hardware. If you use code make sure to credit the author.
I want to make WizardC8 for the ti 83\84 plus and for the ti 84 plus CSE. Cross compatible would be helpful or at least my code can compile 2 versions of it.
Okay. First you have to think through it and create the game on one platform first, and then perhaps the easiest way would be to port it over to the other version of calculator. We can help with any code issues and questions you may have, but a simple Google search for these things will sometimes suffice. Also, the search bar on Cemetech is also a great resource as well. I wish you the best of luck! Smile
I'm having trouble displaying the text in the right position


Code:
#include "ti83plus.inc"
.org $9D93
   .db $BB,$6D
Start:
   b_call(_RunIndicOff)   ; Turns off Run Indicator

;--------------Main Menu------------------

MainMenuStart:

   b_call(_ClrLCDFull)   ; Clears the screen
   LD   HL,txtMainMenuHeader
   CALL   dispHeader
   
   LD   A,0            ; 0->A
   LD   (penCol),A

   LD   HL,txtItem1
   CALL   dispItem
   LD   HL,txtItem2
   CALL   dispItem
   LD   HL,txtItem3
   CALL   dispItem
   LD   HL,txtItemExit
   CALL   dispItem

MainMenuLoop:

   b_call(_GetKey)   ; Waits for a key to be pressed

   CP   k1         ; If the 1 key is pressed,
   JR   Z,item1      ; goto label item1.

   CP   k2         ; If the 2 key is pressed,
   JP   Z,item2      ; goto label item2.

   CP   k3         ; If the 3 key is pressed,
   JP   Z,AboutScreen   ; goto label AboutScreen.

   CP   k4         ; If the 4 key is pressed,
   JP   Z,ExitScreen   ; goto label ExitScreen.

   JR   MainMenuLoop

;-------------Dollars:Gallions--------------

item1:

   b_call(_ClrLCDFull)   ; Clears the screen

   LD   BC,3         ; 3->BC
   LD   (curRow),BC
   LD   BC,4         ; 4->BC
   LD   (curCol),BC

   LD   HL,txtSelect1UserInputDS
   b_call(_PutS)      ; Display large text

   LD   A,0            ; 0->A

item1UserInputLoop:

   b_call(_GetKey)      ; Waits for a key to be pressed

   CP   kUp            ; If the up key is pressed,
   INC   A            ; A+1->A

   CP   kDown         ; If the down key is pressed,
   DEC   A            ; A-1->A

   CP   kEnter         ; If the Enter key is pressed,
   JP   MainMenuStart   ; goto label MainMenuStart.

   JR   item1UserInputLoop

;---------Gallions:Dollars-----------

item2:

   b_call(_ClrLCDFull)   ; Clears the screen

   LD   BC,0         ; 0->BC
   LD   (penRow),BC
   LD   (penCol),BC

   LD   HL,txtSelect2

   b_call(_VPutS)      ; Display small text

   b_call(_GetKey)      ; Waits for a key to be pressed

   JP   MainMenuStart

;----------About--------------

AboutScreen:

   b_call(_ClrLCDFull)   ; Clears the screen

   LD   HL,10         ; 10->HL
   LD   (penRow),HL
   
   LD   A,2            ; 2->A
   LD   (penCol),A

   LD   HL,AboutTxtLine1
   CALL   dispItem
   
   LD   A,10         ; 10->A
   LD   (penCol),A

   LD   HL,AboutTxtLine2
   CALL   dispItem
   
   LD   A,15         ; 15->A
   LD   (penCol),A

   LD   HL,AboutTxtLine3
   CALL   dispItem
   
   LD   A,5            ; 5->A
   LD   (penCol),A

   LD   HL,AboutTxtLine4
   CALL   dispItem

   b_call(_GetKey)      ; Waits for a key to be pressed

   JP   MainMenuStart

;---------Exit---------------

ExitScreen:

   b_call(_ClrLCDFull)   ; Clears the screen

ExitScreenText:

   LD   HL,txtExitHeader
   CALL   dispHeader
   
   LD   A,0            ; 0->A
   LD   (penCol),A

   LD   HL,No
   CALL   dispItem
   LD   HL,Yes
   CALL   dispItem

ExitScreenLoop:

   b_call(_GetKey)      ; Waits for a key to be pressed

   CP   k1            ; If the 1 key is pressed,
   JP   Z,MainMenuStart   ; goto label MainMenuStart.

   CP   k2            ; If the 2 key is pressed,
   JR   Z,Exit         ; goto label Exit.

   JR   ExitScreenLoop

Exit:

   b_call(_ClrLCDFull)   ; Clears the screen
   LD   HL,NowExiting
   b_call(_PutS)      ; Display large text
   RET               ; Exit program.

;---------Data-----------

dispHeader:

   LD   BC,$0
   LD   (penRow),BC
   LD   (penCol),BC

   SET   textInverse,(IY+TextFlags)   ; Turn on white on black text mode

   b_call(_VPutS)               ; Display small text
   RES   textInverse,(IY+TextFlags)   ; Turn off white on black text mode

   LD   HL,0                  ; 0->HL
   LD   (penRow),HL
   LD   (penCol),HL

   RET                        ; Exit dispHeader routine

dispItem:

   PUSH   HL
   LD   H,5
   LD   L,A
   LD   A,(penRow)
   ADD   A,8                     ; A+8->A
   LD   (penRow),A
   POP   HL

   b_call(_VPutS)               ; Display small text

   RET                        ; Exit dispItem routine

txtMainMenuHeader:
   .db "Wizard Currency Converter",0

txtExitHeader:
   .db "Are you sure?",0

txtItem1:
   .db "1: Dollars:Gallions",0

txtItem2:
   .db "2: Gallions:Dollars",0

txtItem3:
   .db "3: About",0

txtSelect1UserInputDS:
   .db $F2," ",0

txtSelect2:
   .db "Gallions:Dollars is under construction.",0

AboutTxtLine1:
   .db "Wizard Currency Converter",0

AboutTxtLine2:
   .db "Version 8.0",0

AboutTxtLine3:
   .db "Released:",0

AboutTxtLine4:
   .db "November 14th, 2014",0

txtItemExit:
   .db "4: Exit",0

NowExiting:

   .db "Now exiting",0

No:
   .db "1: No",0

Yes:
   .db "2: Yes",0

.end
END


Can you please help me fix it?
You've given us virtually no information to help us help you. I suspect you're mostly copying-and-pasting code without having any idea how it works, and you're expecting us to do the hard part for you. You need to start from something very simple and actually learn assembly properly: trying to modify a big chunk of code from someone else without any idea what you're doing is not going to help. Can you at least specify in what way the text is misaligned, and what text you mean, and what you already tried to fix it? I recommend you read this ASAP:

http://codingkilledthecat.wordpress.com/2012/06/26/how-to-ask-for-programming-help/
What program should I start with?
Ephraim B wrote:
What program should I start with?

1) Read ASM in 28 Days
2) As you read it, try reading other people's ASM programs and understanding how they work.
3) As you read it, test out the code the tutorial includes. Then try tweaking it in small ways to understand what your changes do.
4) Use your knowledge to build small programs from scratch. Build larger programs as you become more confident with the language.
KermMartian wrote:
Ephraim B wrote:
What program should I start with?

1) Read ASM in 28 Days
2) As you read it, try reading other people's ASM programs and understanding how they work.
3) As you read it, test out the code the tutorial includes. Then try tweaking it in small ways to understand what your changes do.
4) Use your knowledge to build small programs from scratch. Build larger programs as you become more confident with the language.


MY sentiments exactly. Smile Please read the manual...
What's the routine for drawing a rectangle?
What's the routine for drawing a line?

I'm trying to do the same UI as I did with WizardC7 in WizardC8.
Please, please, please read the manual. It tells you how to draw lines. Of course, there is also the bcall rectangle routine, but it is better to learn how it works and why it works, so that you can write a much more efficient and customizable routine. Read the manual! Smile
MateoConLechuga wrote:
Please, please, please read the manual. It tells you how to draw lines. Of course, there is also the bcall rectangle routine, but it is better to learn how it works and why it works, so that you can write a much more efficient and customizable routine. Read the manual! Smile
Plus, if you read the TI PDFs and actually learned ASM from ASM in 28 Days, you'd know the answer to your questions. You're repeatedly ignoring every piece of advice we're giving you.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page 1, 2, 3 ... 9, 10, 11  Next
» View previous topic :: View next topic  
Page 1 of 11
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement