A86: Efficiency Problem Part III


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

A86: Efficiency Problem Part III




It's that time again! I have yet another problem with efficiency, as once
again I seem to be inundated with useless, repetetive loops of code. This
time, I am doing an "Inverse Menu" where the selected text appears to be
inversed. Using this method, the screen visibly blinks when the cursor is
moved up and down. There's got to be a faster, more efficient way.

FightLoop:
 call CLS
 ld hl,FightTitle
 set textInverse,(iy+textflags)
 call _puts
 res textInverse,(iy+textflags)
 ld a,(LastOpFight)
 cp 0
 call z,InvText
 ld hl,$0201
 ld (_curRow),hl
 ld hl,Fi1
 call _puts
 res textInverse,(iy+textflags)
 cp 1
 call z,InvText
 ld hl,$0202
 ld (_curRow),hl
 ld hl,Fi2
 call _puts
 res textInverse,(iy+textflags)
 cp 2
 call z,InvText
 ld hl,$0203
 ld (_curRow),hl
 ld hl,Fi3
 call _puts
 res textInverse,(iy+textflags)
 cp 3
 call z,InvText
 ld hl,$0204
 ld (_curRow),hl
 ld hl,Fi4
 call _puts
 res textInverse,(iy+textflags)
 cp 4
 call z,InvText
 ld hl,$0205
 ld (_curRow),hl
 ld hl,Fi5
 call _puts
 res textInverse,(iy+textflags)
 cp 5
 call z,InvText
 ld hl,$0206
 ld (_curRow),hl
 ld hl,FBack
 call _puts
 res textInverse,(iy+textflags)
 jp FightButton

... Code, fightbutton increases or decreases the LastOpFight value

Fi1: .db "High School  ",0
Fi2: .db "Swap Meet    ",0
Fi3: .db "Comm. College",0
Fi4: .db "MIT          ",0
Fi5: .db "???          ",0
FBack: .db "Back         ",0

There must be an easier way... is there a way to inverse a portion of the
screen?

Thanks for the help!