Skip to content

Commit

Permalink
Fix extraneous pop, optimize early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
calc84maniac authored Jan 30, 2024
1 parent 4650e44 commit 340bb4f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/ce/getstringinput.src
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ _os_GetStringInput:
sbc hl,de
ld iy,flags
call nz,_PutS
ld hl,(curRow)
ld de,(curRow)
.start:
push hl ; save initial row/column
ld hl,(ix+12) ; buffer size
add hl,de
xor a,a
sbc hl,de
jp z,.empty
ret z
push de ; save initial row/column
push ix
push hl ; save remaining size
ld de,(ix+9)
Expand Down Expand Up @@ -131,8 +131,7 @@ _os_GetStringInput:
sbc hl,bc ; decrement and compare to buf start
add hl,bc
jr nz,.clear_loop
ex de,hl
ld (curRow),hl
ld (curRow),de
jp .start
.done:
call _ClrTxtShd
Expand All @@ -148,7 +147,5 @@ _os_GetStringInput:
pop hl ; remaining size
pop hl ; saved IX
pop hl ; initial row/column
.empty:
pop hl
pop ix
ret

0 comments on commit 340bb4f

Please sign in to comment.