diff --git a/gui/sixels/icnsix.tal b/gui/sixels/icnsix.tal index 6b805fc..8868a12 100644 --- a/gui/sixels/icnsix.tal +++ b/gui/sixels/icnsix.tal @@ -17,18 +17,19 @@ BRK } POP ( | get size ) - ;src scap #0009 SUB2 get-size + ;src scap #0009 SUB2 parse-size ( h ) ;img/height STA ( w ) ;img/width STA - ( | load data ) + ( | get data ) ;src .File/name DEO2 #00 ;img/width LDA #00 ;img/height LDA #30 SFT2 MUL2 .File/length DEO2 ;img/data .File/read DEO2 + #010e DEO #010f DEO BRK -@get-size ( 00x00* -- w h ) +@parse-size ( 00x00* -- w h ) DUP2 sbyte #00 EQU ?&cancel INC2k INC2 LDA LIT "x NEQ ?&cancel INC2k INC2 INC2 sbyte #00 EQU ?&cancel @@ -36,6 +37,37 @@ ( x ) sbyte STHr JMP2r &cancel POP2 #0000 JMP2r +( +@| core ) + +@ ( -- ) + #00 ;img/height LDA #30 SFT2 #0000 + &v ( -- ) + STH2k + #00 ;img/width LDA #30 SFT2 #0000 + &w ( -- ) + DUP2 STH2kr get-pixel phex/b #2018 DEO + + INC2 GTH2k ?&w + POP2 POP2 + POP2r + INC2 GTH2k ?&v + POP2 POP2 + JMP2r + +@get-row ( x* y* -- row* ) + STH2k + ( ) #03 SFT2 SWP2 + ( ) #03 SFT2 SWP2 + ( ) #00 ;img/width LDA MUL2 ADD2 #30 SFT2 + ( ) STH2r #0007 AND2 ADD2 + ( ) ;img/data ADD2 JMP2r + +@get-pixel ( x* y* -- b ) + ( keep x* ) OVR2 NIP #07 AND STH + ( get byte ) get-row LDA + ( flag ) #07 STHr SUB SFT #01 AND JMP2r + ( @|stdlib ) @@ -68,7 +100,8 @@ ( @|memory ) -@img &size &width $1 +@img ( ) + &size &width $1 &height $1 &data