diff --git a/femto.tal b/femto.tal index ed7d705..6a22e90 100644 --- a/femto.tal +++ b/femto.tal @@ -452,8 +452,44 @@ BRK @goto-line ( -> ) - #0016 ;jump-to-line JSR2 - ;draw-all JSR2 BRK + ;messages/goto-line ;messages/null ;do-goto-line ;start-prompt JSR2 + ;draw-prompt JSR2 + ;draw-cursor JSR2 + BRK + +@parse-decimal-number ( addr* -> n* ok^ ) + LDAk ,&non-empty JCN + #00 JMP2r + &non-empty + LIT2r 0000 + &loop + LDAk ,&continue JCN + POP2 STH2r #01 JMP2r + &continue + LDAk LIT '0 LTH ,&fail JCN + LDAk LIT '9 GTH ,&fail JCN + LIT2r 000a MUL2r + LDAk LIT '0 SUB #00 SWP STH2 ADD2r + INC2 ,&loop JMP + &fail + POP2r #00 JMP2r + + +@do-goto-line + ;tmp/data ;parse-decimal-number JSR2 + ,&ok JCN + ;move-to-message-line JSR2 + ;messages/unknown-input ;print JSR2 + ;tmp/data ;print JSR2 + BRK + &ok + #0001 SUB2 ( convert 1-indexing to 0-indexing ) + DUP2 .buffer/line-count LDZ2 LTH2 ,&within JCN + POP2 ;goto-end JMP2 + &within + ;jump-to-line JSR2 + ;draw-all JSR2 + BRK @jump-to-line ( n* -> ) .term/rows LDZ2 #0002 DIV2 LTH2k ( n rows/2 n go to end of file - M-g go to line (TODO) + M-g go to line - C-l refresh screen + C-l refresh screen (DEBUG) C-d delete (C stands for Control)