Re: Help on this code fragment


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

Re: Help on this code fragment



I don't know about the getkey stuff, but here is something that will cut
most of your code by 1/4 (why you wrote such huge amounts of code is beyond
me).

#include ti-85.h

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

Menu:
  ROM_CALL(CLEARLCD)
  ld hl,$2200
  ld ($8333),hl
  ld hl,Title
  ld de,(PROGRAM_ADDR)
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$000C
  ld ($8333),hl
  ld hl,Mt1
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$0012
  ld ($8333),hl
  ld hl,Mt2
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$0018
  ld ($8333),hl
  ld hl,Mt3
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$001E
  ld ($8333),hl
  ld hl,Mt4
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$0024
  ld ($8333),hl
  ld hl,Mt5
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$002A
  ld ($8333),hl
  ld hl,Mt6
  add hl,de
  ROM_CALL(D_ZM_STR)
  ld hl,$0030
  ld ($8333),hl
  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 hl,$221E
  ld ($8333),hl
  ld hl,ChapM
  ld de,(PROGRAM_ADDR)   ; Assuming de isn't altered you can remove this
  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



                 Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
         http://www.geocities.com/SiliconValley/Heights/8504
                    http://shinelight.home.ml.org


References: