comment out a bunch of currently unused stuff

This commit is contained in:
~d6 2022-03-25 02:22:28 -04:00
parent 4f410c18f6
commit 354cdc802e
1 changed files with 64 additions and 39 deletions

103
femto.tal
View File

@ -60,6 +60,30 @@
%cr { #0d18 DEO } %cr { #0d18 DEO }
%ansi { #1b18 DEO #5b18 DEO } %ansi { #1b18 DEO #5b18 DEO }
( emit macros )
( )
( these save one byte and are easier to read. )
%emit-! { LIT2 '! 18 DEO }
%emit-$ { LIT2 '$ 18 DEO }
%emit-( { LIT2 '( 18 DEO }
%emit-) { LIT2 ') 18 DEO }
%emit-, { LIT2 ', 18 DEO }
%emit-0 { LIT2 '0 18 DEO }
%emit-1 { LIT2 '1 18 DEO }
%emit-2 { LIT2 '2 18 DEO }
%emit-3 { LIT2 '3 18 DEO }
%emit-6 { LIT2 '6 18 DEO }
%emit-7 { LIT2 '7 18 DEO }
%emit-; { LIT2 '; 18 DEO }
%emit-C { LIT2 'C 18 DEO }
%emit-H { LIT2 'H 18 DEO }
%emit-J { LIT2 'J 18 DEO }
%emit-K { LIT2 'K 18 DEO }
%emit-[ { LIT2 '[ 18 DEO }
%emit-m { LIT2 'm 18 DEO }
%emit-n { LIT2 'n 18 DEO }
%emit-~ { LIT2 '~ 18 DEO }
%quit! { #01 .System/halt DEO BRK } %quit! { #01 .System/halt DEO BRK }
( zero page ) ( zero page )
@ -141,7 +165,7 @@
( using error! will print the given message before causing ) ( using error! will print the given message before causing )
( the interpreter to halt. ) ( the interpreter to halt. )
@error! ( msg* -> ) @error! ( msg* -> )
LIT '! emit sp emit-! sp
&loop LDAk ,&continue JCN ,&done JMP &loop LDAk ,&continue JCN ,&done JMP
&continue LDAk emit INC2 ,&loop JMP &continue LDAk emit INC2 ,&loop JMP
&done POP2 nl &done POP2 nl
@ -576,8 +600,6 @@
.config/insert-tabs LDZk #01 EOR SWP STZ .config/insert-tabs LDZk #01 EOR SWP STZ
;draw-statusbar-and-cursor JSR2 BRK ;draw-statusbar-and-cursor JSR2 BRK
@tmp-file-name "file.tmp 00
( TODO: M-f and M-b for next/previous word ) ( TODO: M-f and M-b for next/previous word )
( M-n and M-p for next/previous paragraph ) ( M-n and M-p for next/previous paragraph )
( maybe M-% for search&replace ) ( maybe M-% for search&replace )
@ -633,7 +655,7 @@
BRK BRK
@clear-line ( -> ) @clear-line ( -> )
ansi LIT '2 emit LIT 'K emit JMP2r ansi emit-2 emit-K JMP2r
@clear-message-line @clear-message-line
;move-to-message-line JSR2 ;move-to-message-line JSR2
@ -682,30 +704,30 @@
@min2 ( x* y* -> min* ) @min2 ( x* y* -> min* )
LTH2k JMP SWP2 POP2 JMP2r LTH2k JMP SWP2 POP2 JMP2r
@max2 ( x* y* -> min* ) ( @max2 ( x* y* -> min* )
GTH2k JMP SWP2 POP2 JMP2r GTH2k JMP SWP2 POP2 JMP2r )
@term-move-cursor ( col* row* -> ) @term-move-cursor ( col* row* -> )
ansi INC2 ( row+1 ) ;emit-dec2 JSR2 ansi INC2 ( row+1 ) ;emit-dec2 JSR2
LIT '; emit INC2 ( col+1 ) ;emit-dec2 JSR2 emit-; INC2 ( col+1 ) ;emit-dec2 JSR2
LIT 'H emit JMP2r emit-H JMP2r
@term-move-right ( n* -> ) @term-move-right ( n* -> )
ansi ;emit-dec2 JSR2 LIT 'C emit JMP2r ansi ;emit-dec2 JSR2 emit-C JMP2r
@term-get-cursor-position ( -> ) @term-get-cursor-position ( -> )
ansi LIT '6 emit LIT 'n emit JMP2r ansi emit-6 emit-n JMP2r
@term-erase-all ( -> ) @term-erase-all ( -> )
ansi LIT '2 emit LIT 'J emit JMP2r ansi emit-2 emit-J JMP2r
@offset-for-cur-row ( @offset-for-cur-row
.buffer/offset LDZ2 ( offset ) .buffer/offset LDZ2 ( offset )
#0000 ;cur-rel-row JSR2 SUB2 STH2 ( offset [-k] ) #0000 ;cur-rel-row JSR2 SUB2 STH2 ( offset [-k] )
&loop STH2r ORA ,&next JCN &loop STH2r ORA ,&next JCN
POP2r JMP2r POP2r JMP2r
&next LDAk #0a NEQ JMP INC2r &next LDAk #0a NEQ JMP INC2r
INC2 ,&loop JMP INC2 ,&loop JMP )
@draw-cursor ( -> ) @draw-cursor ( -> )
.prompt/active LDZ ,&on-prompt JCN .prompt/active LDZ ,&on-prompt JCN
@ -742,22 +764,21 @@
#0000 .term/rows LDZ2 ;term-move-cursor JSR2 #0000 .term/rows LDZ2 ;term-move-cursor JSR2
;get-save-status JSR2 ;print JSR2 ;get-save-status JSR2 ;print JSR2
;filename ;print JSR2 ;filename ;print JSR2
#20 emit sp
LIT '[ emit emit-[
.buffer/limit LDZ2 ;data SUB2 ;emit-dec2 JSR2 .buffer/limit LDZ2 ;data SUB2 ;emit-dec2 JSR2
;messages/bytes ;print JSR2 ;messages/bytes ;print JSR2
#20 emit sp
.buffer/line-count LDZ2 ;emit-dec2 JSR2 .buffer/line-count LDZ2 ;emit-dec2 JSR2
;messages/lines ;print JSR2 ;messages/lines ;print JSR2
#20 emit sp
LIT '( emit emit-(
;cur-col JSR2 INC2 ;emit-dec2 JSR2 ;cur-col JSR2 INC2 ;emit-dec2 JSR2
LIT ', emit emit-,
;cur-abs-row JSR2 INC2 ;emit-dec2 JSR2 ;cur-abs-row JSR2 INC2 ;emit-dec2 JSR2
LIT ') emit emit-)
#20 emit sp
;get-tab-status JSR2 ;print JSR2 ;get-tab-status JSR2 ;print JSR2
;emit-reset JSR2 ;emit-reset JSR2
JMP2r JMP2r
@ -782,9 +803,9 @@
@draw-linenum ( n* -> ) @draw-linenum ( n* -> )
;emit-reset JSR2 ;emit-reset JSR2
ansi .config/color LDZ2 emit emit LIT 'm emit ansi .config/color LDZ2 emit emit ( LIT 'm emit ) emit-m
;emit-dec2-pad JSR2 ;emit-dec2-pad JSR2
ansi LIT2 'm '0 emit emit JMP2r ansi ( LIT2 'm '0 emit emit ) emit-0 emit-m JMP2r
@emit-tab ( -> ) @emit-tab ( -> )
#0000 .config/tab-width LDZ2 SUB2 #0000 .config/tab-width LDZ2 SUB2
@ -793,19 +814,23 @@
&next DEOkr INC2 ,&loop JMP &next DEOkr INC2 ,&loop JMP
@emit-red ( -> ) @emit-red ( -> )
ansi LIT '3 emit LIT '1 emit LIT 'm emit JMP2r ( ansi LIT '3 emit LIT '1 emit LIT 'm emit JMP2r )
ansi emit-3 emit-1 emit-m JMP2r
@emit-reset ( -> ) @emit-reset ( -> )
ansi LIT '0 emit LIT 'm emit JMP2r ( ansi LIT '0 emit LIT 'm emit JMP2r )
ansi emit-0 emit-m JMP2r
@emit-red-dollar ( -> ) @emit-red-dollar ( -> )
;emit-red JSR2 LIT '$ emit ;emit-reset JMP2 ;emit-red JSR2 ( LIT '$ emit ) emit-$ ;emit-reset JMP2
@emit-color-reverse ( -> ) @emit-color-reverse ( -> )
ansi .config/color LDZ2 emit emit LIT2 '7 '; emit emit LIT 'm emit JMP2r ( ansi .config/color LDZ2 emit emit LIT2 '7 '; emit emit LIT 'm emit JMP2r )
ansi .config/color LDZ2 emit emit emit-; emit-7 emit-m JMP2r
@emit-color-bold ( -> ) @emit-color-bold ( -> )
ansi .config/color LDZ2 emit emit LIT2 '1 '; emit emit LIT 'm emit JMP2r ( ansi .config/color LDZ2 emit emit LIT2 '1 '; emit emit LIT 'm emit JMP2r )
ansi .config/color LDZ2 emit emit emit-; emit-1 emit-m JMP2r
@draw-all ( -> ) @draw-all ( -> )
;term-erase-all JSR2 ;term-erase-all JSR2
@ -841,7 +866,7 @@
STH2kr .term/rows LDZ2 GTH2 ,&done JCN STH2kr .term/rows LDZ2 GTH2 ,&done JCN
cr nl cr nl
.term/lmargin LDZ2 ;term-move-right JSR2 .term/lmargin LDZ2 ;term-move-right JSR2
LIT '~ emit INC2r ( LIT '~ emit ) emit-~ INC2r
,&eof-loop JMP ,&eof-loop JMP
&done POP2 POP2r POP2r &done POP2 POP2r POP2r
;emit-reset JSR2 ;emit-reset JSR2
@ -888,14 +913,14 @@
INC2 INC2r ,&loop JMP INC2 INC2r ,&loop JMP
&end POP2 STH2r JMP2r &end POP2 STH2r JMP2r
@line-width ( s* -> n* ) ( @line-width ( s* -> n* )
#0000 STH2 #0000 STH2
&loop LDAk #00 EQU ,&done JCN &loop LDAk #00 EQU ,&done JCN
LDAk #0a EQU ,&done JCN LDAk #0a EQU ,&done JCN
LDAk #09 EQU ,&tabs JCN LDAk #09 EQU ,&tabs JCN
INC2 INC2r ,&loop JMP INC2 INC2r ,&loop JMP
&tabs #0004 ADD2 ,&loop JMP &tabs #0004 ADD2 ,&loop JMP
&done POP2 STH2r JMP2r &done POP2 STH2r JMP2r )
@abs-line ( y* -> s* ) @abs-line ( y* -> s* )
#0000 SWP2 SUB2 STH2 ( [-y] ) #0000 SWP2 SUB2 STH2 ( [-y] )
@ -1006,31 +1031,31 @@
( @fits-in-one-screen ( -> bool^ ) ( @fits-in-one-screen ( -> bool^ )
.buffer/line-count LDZ2 .term/rows LDZ2 INC2 LTH2 JMP2r ) .buffer/line-count LDZ2 .term/rows LDZ2 INC2 LTH2 JMP2r )
@mod-div ( x^ y^ -> x%d x/y ) ( @mod-div ( x^ y^ -> x%d x/y )
DIVk STHk MUL SUB STHr JMP2r DIVk STHk MUL SUB STHr JMP2r )
@mod-div2 ( x^ y^ -> x%d x/y ) @mod-div2 ( x^ y^ -> x%d x/y )
DIV2k STH2k MUL2 SUB2 STH2r JMP2r DIV2k STH2k MUL2 SUB2 STH2r JMP2r
@base-10-width ( n* -> w* ) ( @base-10-width ( n* -> w* )
LIT2r 0000 ( n [0] ) LIT2r 0000 ( n [0] )
&loop ( n [w] ) &loop ( n [w] )
DUP2 #0000 EQU2 ,&done JCN ( n [w] ) DUP2 #0000 EQU2 ,&done JCN ( n [w] )
#000a DIV2 ( n/10 [w] ) #000a DIV2 ( n/10 [w] )
INC2r ,&loop JMP ( n/10 [w+1] ) INC2r ,&loop JMP ( n/10 [w+1] )
&done ( 0 [w] ) &done ( 0 [w] )
POP2 STH2r JMP2r POP2 STH2r JMP2r )
@emit-digit ( n^ -> ) @emit-digit ( n^ -> )
LIT '0 ADD emit JMP2r LIT '0 ADD emit JMP2r
@emit-dec ( n^ -> ) ( @emit-dec ( n^ -> )
DUP #63 GTH ,&do3 JCN DUP #63 GTH ,&do3 JCN
DUP #09 GTH ,&do2 JCN DUP #09 GTH ,&do2 JCN
,&do1 JMP ,&do1 JMP
&do3 #64 ;mod-div JSR2 ;emit-digit JSR2 &do3 #64 ;mod-div JSR2 ;emit-digit JSR2
&do2 #0a ;mod-div JSR2 ;emit-digit JSR2 &do2 #0a ;mod-div JSR2 ;emit-digit JSR2
&do1 ;emit-digit JMP2 &do1 ;emit-digit JMP2 )
@emit-dec2 ( n* -> ) @emit-dec2 ( n* -> )
DUP2 #270f GTH2 ,&do5 JCN DUP2 #270f GTH2 ,&do5 JCN