Help on this code fragment


[Prev][Next][Index][Thread]

Help on this code fragment



Could someone please help me out with this code.  I am trying to make it so
that a menu comes up with the different chapters and the user picks a chapter
put my getkey thingie wont work.  Thanks in advance

#include ti-85.h

.org 0
.db "Calclus Notes 0.3b",0

Menu:
  ROM_CALL(CLEARLCD)
  ld a,34
  ld ($8333),a
  ld a,0
  ld ($8334),a
  ld hl,Title
  ld de,(PROGRAM_ADDR)
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,12
  ld ($8334),a
  ld hl,Mt1
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,18
  ld ($8334),a
  ld hl,Mt2
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,24
  ld ($8334),a
  ld hl,Mt3
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,30
  ld ($8334),a
  ld hl,Mt4
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,36
  ld ($8334),a
  ld hl,Mt5
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,42
  ld ($8334),a
  ld hl,Mt6
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld a,0
  ld ($8333),a
  ld a,48
  ld ($8334),a
  ld hl,Mt7
  add hl,de
  ROM_CALL(D_ZM_STR)
MenuGK:
  call GET_KEY
  cp K_1
  jr z,Chap
  cp K_2
  jr z,Chap
  cp K_3
  jr z,Chap
  cp K_4
  jr z,Chap
  cp K_5
  jr z,Chap
  cp K_6
  jr z,Chap
  cp K_7
  jr z,Chap
  cp K_EXIT
  jr nz,MenuGK
  ret
Chap:
  ROM_CALL(CLEARLCD)
  ld a,34
  ld ($8333),a
  ld a,30
  ld ($8334),a
  ld hl,ChapM
  ld de,(PROGRAM_ADDR)
  add hl,de
  ROM_CALL(D_ZM_STR)
ChapGK:
  call GET_KEY
  cp K_EXIT
  JUMP_Z(Menu)
  JUMP_NZ(Menu)
Title:
  .db "Calculus Notes 1.0",0
Mt1:
  .db "1 - Chapter 1",0
Mt2:
  .db "2 - Chapter 2",0
Mt3:
  .db "3 - Chapter 3",0
Mt4:
  .db "4 - Chapter 4",0
Mt5:
  .db "5 - Chapter 5",0
Mt6:
  .db "6 - Chapter 6",0
Mt7:
  .db "7 - Chapter 7",0
ChapM:
  .db "Under Construction",0
  .end

Also if anyone can think of any optimizations I would also appreciate that.


Follow-Ups: