Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;displays the magic menu
- battle_magic:
- call tobackbuff
- xor a ;set a 0
- ld (_cursor),a
- rectangle(5,4,75,61,0) \ rectangle(4,5,76,60,0)
- largeSprite(4,4,9,57,MenuImg)
- ld hl,(6*256)+6 ;set x
- ld (penCol),hl ;and y loc
- wrappedtext(MagicMenuTitle)
- ld a,6
- ld (penCol),a
- ld a,28
- ld (penRow),a
- call battle_magic_load_buf
- wrappedtext(Text_buffer)
- lcdupdate
- battle_magic_loop:
- ;call name_menu_disp
- b_call _getCSC
- cp skUp
- ;jr z,
- cp skDown
- ;jr z,
- cp skAlpha
- jr z,_
- cp skClear
- jr nz,battle_magic_loop
- _ call frombackbuff
- jp battle_return
- battle_magic_load_buf:
- call clearTextBuff ;clear Text_buffer
- ld hl,BlackMageStats+black ;load start of magic table into hl
- ld b,9 ;need to loop 9 times
- ld c,0 ;incrementing position
- ld de,Text_buffer
- ld (tmpbuf),de ;store Text buffer location for later
- _ push bc ;store b for later
- ld a,(hl) ;test to see if this magic is enabled
- or a ;z==false nz==true
- call nz,_ ;if it is write the string
- pop bc
- inc hl ;increase position in magic table
- inc c ;increase position "pointer"
- djnz -_ ;if (b-=1)!=0 goto last _
- ret ;return, copying done
- _ push hl ;store location on magic table for later
- call _ ;get some stuff, whatev's
- push hl ;got to work with hl
- ld de,Magic_strings
- ex de,hl ;switch de and hl so I can work with de
- sbc hl,de ;can't remember...it works though
- ld b,h ;oh wait bc=(hl=hl-de) Why?
- ld c,l ;bc contains length of string
- pop hl ;now I need it back
- ld de,(tmpbuf) ;get the position in the string
- ;ok so what the registers contain
- ;bc = length of string
- ;de = Text_buffer+offset
- ;hl = Magic_strings+offset
- ;af = poop
- ldir ;copy over the magic string to the Text_buffer+offset
- ld a,'\n' ;I'm a potato
- ld (de),a ;newline for formatting
- ld (tmpbuf),de ;store new Text_buffer+offset
- pop hl
- ret ;poop
- _ ld hl,Magic_strings ;store magic_strings array to hl
- ld b,c ;get the increasing pointer into b for loop
- _ inc hl ;increase position
- ld a,(hl) ;test if 0
- or a ;if (hl)!=0
- jr nz,-_ ;go back to _
- djnz -_ ;elseif (b-=1)!=0 go back to _
- inc hl ;erm...wait! returns the location for after to use
- ret ;I already told you; poop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement