Browse Source

Converted snarf routines to streams

main
neauoire 4 years ago
parent
commit
01488fccee
  1. 50
      src/main.tal
  2. 1
      src/utils.tal

50
src/main.tal

@ -1222,13 +1222,9 @@ RTN
.toolview/y1 LDZ2 .Screen/y DEO2
AUTO-X
;path/name
DUP2 ;slen JSR2 #0013 >> TOS
;path/name ;slen JSR2 #0013 -- ** ++
( scroll )
DUP2 ;slen JSR2 #0013 >> TOS
;path/name ;slen JSR2 #0013 -- ** ++
&loop
LDAk #20 - TOS 8** ;font ++ .Screen/addr DEO2
STHkr .Screen/sprite DEO
@ -1364,45 +1360,35 @@ RTN
@copy-snarf ( -- )
( open ) DATA-CLIP STH2
;snarf-txt .File/name DEO2
#0010 .File/length DEO2
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
( write char ) GET-ITER GET-ADDR STH2kr ;copy-tile JSR2
( incr index ) LIT2r 0010 ADD2r
GET-ITER GET-ADDR ;&buf #0010 ;mcpy JSR2
;&buf .File/save DEO2
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
( close ) #00 STH2kr STA
;snarf-txt .File/name DEO2
STH2r DATA-CLIP -- .File/length DEO2
DATA-CLIP .File/save DEO2
RTN
&buf $10
@paste-snarf ( -- )
;snarf-txt .File/name DEO2
.selection/y2 LDZ INC .selection/y1 LDZ - TOS
.selection/x2 LDZ INC .selection/x1 LDZ - TOS
MUL2 10** .File/length DEO2
DATA-CLIP .File/load DEO2
( stash x,y ) .selection LDZ2 STH2
.File/success DEI2 #0000
&loop
( limit at selection )
OVRr STHr .selection/x2 LDZ INC LTH ,&linebreak JCN
STH2r INC NIP .selection/x1 LDZ SWP STH2
&linebreak
DUP2 [ DATA-CLIP ++ ] [ STH2kr GET-ADDR ] ;copy-tile JSR2
( move-x ) SWPr LITr 01 ADDr SWPr
#0010 ++ GTH2k ,&loop JCN
POP2 POP2
( destroy x,y ) POP2r
#0010 .File/length DEO2
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
GET-ITER GET-ADDR .File/load DEO2
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
RTN

1
src/utils.tal

@ -1,4 +1,3 @@
( generics )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }

Loading…
Cancel
Save