I am currently testing myself in assembly by undertaking a complete remake of my Pokemon Battle Simulator in full assembly. Thus, I would like some assistance with sprites. Would anyone be so kind as to post some sprites for my game. I don't need all of them, just a few known ones like Pikachu, Bulbasaur, Squirtle, Haunter, ect.

Also, to the asm people here, how do I, in asm, look for an appvar. If found, return pointer into hl, is not, move to another place where it is created.

Also, ret in a subroutine will always move back to the main program. What if I want a "Quit" subroutine that archives the appvar, cleans the screen, then quits the program. how would i do this. My idea:


Code:
jr z,QUIT
   cp b
   ret z   

other code here

QUIT:
   b_call(_ClrLCDFull)
   
   /Archive stuff here
   
   ld b,$FF
   ld a,b
   ret
ACagliano wrote:
Also, ret in a subroutine will always move back to the main program. What if I want a "Quit" subroutine that archives the appvar, cleans the screen, then quits the program. how would i do this. My idea:


Code:
jr z,QUIT
   cp b
   ret z   

other code here

QUIT:
   b_call(_ClrLCDFull)
   
   /Archive stuff here
   
   ld b,$FF
   ld a,b
   ret

Only if the subroutine is called using the call instruction. A jr/jp goes into the code, but won't go back to another section without another jr/jp.
When you call something, you will save the place to return to on the stack. This address is two bytes in length ofcourse. Since the stack grows down, you could try to do something like this.
Replace this:

Code:
    RET

to:

Code:
    INC SP
    INC SP
    RET

or:

Code:
    POP HL
    RET

As for the sprites, I do not have any experience with Pokemon what so ever. As a result, I can't help you with that.
Now you just skip turning back to the main program.
I will post updates to my coding, for critique. Remember, if you see something that can be optimized, I didn't do it because I'm still toying with the long method. Smile


Code:

.nolist
    #include    "ti83plus.inc"
   #include   "dcs7.inc"
.list
Health   .equ   AppBackupScreen
MaxHealth   .equ   AppBackupScreen+1
Level   .equ   AppBackupScreen+2
Exp   .equ   AppBackupScreen+3
Potions   .equ   AppBackupScreen+5
FullRevive   .equ   AppBackupScreen+6
Money   .equ   AppBackupScreen+7
PokeNum   .equ   AppBackupScreen+9
Saved   .equ   AppBackupScreen+10
.org    $9D93
.db    t2ByteTok, tAsmCmp

   b_call(_ClrLCDFull)
   ld a,4
   ld (curCol),a
   ld b,0
   ld (curRow),b
   ld hl,SPLASH1
   b_call(_PutS)
   ld a,3
   ld (curCol),a
   ld b,2
   ld (curRow),b
   ld hl,SPLASH2
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,6
   ld (curRow),b
   ld hl,SPLASH3
   b_call(_PutS)
   b_call(_getKey)   
   ld a,0
   ld (Health),a
   ld a,30
   ld (MaxHealth),a
   ld a,0
   ld (Level),a
   ld a,0
   ld (Exp),a
   ld a,0
   ld (Potions),a
   ld a,0
   ld (FullRevive),a
   ld a,0
   ld (Money),a
   ld a,0
   ld (Saved),a
   ld c,0

/choose pokemon here
   
   ld hl,APPV
   b_call(_Mov9toOp1)
   b_call(_ChkFindSym)
   call UNARC
   call nc,OPEN   
MAINMENU:
   b_call(_ClrLCDFull)
   ld a,3
   ld (curCol),a
   ld b,0
   ld (curRow),b
   ld hl,MMENU
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,1
   ld (curRow),b
   ld hl,MMENU1
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,2
   ld (curRow),b
   ld hl,MMENU2
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,3
   ld (curRow),b
   ld hl,MMENU3
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,4
   ld (curRow),b
   ld hl,MMENU4
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,5
   ld (curRow),b
   ld hl,MMENU5
   b_call(_PutS)
   ld a,0
   ld (curCol),a
   ld b,6
   ld (curRow),b
   ld hl,MMENU6
   b_call(_PutS)
   b_call(_getKey)
   cp k1
   jr z,BATTLE
   cp k2
   jr z,STATS
   cp k3
   jr z,USE
   cp k4
   jr z,BUY
   cp k5
   jr z,SAVE
   cp k6
   jr z,QUIT   
BATTLE:

   not done

STATS:

   not done

USE:

   not done

BUY:

   not done

SAVE:
   b_call(_ClrLCDFull)
   ld a,0
   ld (curCol),a
   ld b,0
   ld (curRow),b
   ld hl,SAVING
   b_call(_PutS)   
   ld hl,APPV
   b_call(_Mov9toOp1)
   b_call(_ChkFindSym)
   jr nc,STORE
CREATE:
   ld hl,APPV
   b_call(_Mov9toOp1)
   ld hl,11
   b_call(_CreateAppVar)
STORE:
   ex de,ix
   ld a,(Health)
   ld (ix),a
   ld a,(MaxHealth)
   ld (ix+1),a
   ld a,(Level)
   ld (ix+2),a
   ld hl,(Exp)
   ld (ix+3),hl
   ld a,(Potions)
   ld (ix+5),a
   ld a,(FullRevive)
   ld (ix+6),a
   ld hl,(Money)
   ld (ix+7),hl
   ld a,(PokeNum)
   ld (ix+9),a
   ld hl,APPV
   b_call(_Mov9toOp1)
   b_call(_ChkFindSym)
   call ARC
   ld a,1
   ld (Saved),a
   ld a,1
   cp c
   ret z
   jr MAINMENU
QUIT:
   ld a,1
   ld b,(Saved)
   ld c,1
   cp b
   call nz,SAVE   
   b_call(_ClrLCDFull)
   ret   
ARC:
   b_call(_ArchiveVar)
   ret
UNARC:
   ld a,b
   or a
   b_call(_UnarchiveVar)
   ret   
OPEN:
   ex de,ix
   ld a,(ix)
   ld (Health),a
   ld a,(ix+1)
   ld (MaxHealth),a
   ld a,(ix+2)
   ld (Level),a
   ld l,(ix+3)
   ld h,(ix+4)
   ld (Exp),hl
   ld a,(ix+5)
   ld (Potions),a
   ld a,(ix+6)
   ld (FullRevive),a
   ld l,(ix+7)
   ld h,(ix+8)
   ld (Money),hl
   ld a,(ix+9)
   ld (PokeNum),a
   ld a,1
   ld (Saved),a
      
SPLASH1:
.db "Pokemon",0   
SPLASH2:
.db "Version 6.0",0
SPLASH3:
.db "by ACagliano",0
MMENU:
.db "Main Menu",0
MMENU1:
.db "1: Fight",0
MMENU2:
.db "2: View Stats",0
MMENU3:
.db "3: Use Item",0
MMENU4:
.db "4: Buy Items",0
MMENU5:
.db "5: Save",0
MMENU6:
.db "6: Quit",0
SAVING:
.db "Saving...",0
ATK1:
.db "1: Tackle",0
ATK2:
.db "2: Slam",0
ATK3:
.db 0,0,0,0,0,0,0,0
ATK4:
.db 0,0,0,0,0,0,0,0
FIRE1:
.db "3: Scratch",0
FIRE2:
.db "4: Ember",0
WATER1:
.db "3: Splash",0
WATER2:
.db "4: Surf",0
PLANT1:
.db "3: Vine Whip",0
PLANT2:
.db "4: Absorb",0


APPV:
.db AppVarObj,"PokeSav",0
   
.end
.end



Questions:

Can you use PLANT1 as a reference to the data there, like a variable. Like copy the contents of PLANT1 to ATK1.
Yes you can, by something like this:

Code:
;Copy PLANT1 to ATK1
    LD HL, PLANT1
    LD BC, 0
CheckForZero:
    LD A, (HL)
    OR A
    JR Z, MoveData
    INC HL
    INC BC
    JR CheckForZero
MoveData:
    LD DE, ATK1
    LD HL, PLANT1
    LDIR
  
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
Page 1 of 1
» 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