diff --git a/makefile b/makefile index ea23ab5..fc40a2d 100644 --- a/makefile +++ b/makefile @@ -25,10 +25,10 @@ bin/uxnasm: etc/uxnasm.c bin/porporo: ${SRC} src/porporo.c @ cc ${DEBUG_flags} ${SRC} -o bin/porporo -bin/menu.rom: src/utils/menu.tal +bin/menu.rom: src/utils/menu.tal src/utils/menu.assets.tal @ ${ASM} src/utils/menu.tal bin/menu.rom bin/wallpaper.rom: src/utils/wallpaper.tal @ ${ASM} src/utils/wallpaper.tal bin/wallpaper.rom -bin/log.rom: src/utils/log.tal +bin/log.rom: src/utils/log.tal src/utils/log.assets.tal @ ${ASM} src/utils/log.tal bin/log.rom \ No newline at end of file diff --git a/src/utils/log.assets.tal b/src/utils/log.assets.tal index 7d90cd5..7ac2197 100644 --- a/src/utils/log.assets.tal +++ b/src/utils/log.assets.tal @@ -1,4 +1,4 @@ -@font-icn [ +@font-icn [ 0000 0000 0000 0000 0000 0000 0000 0000 0038 3838 3838 3810 1010 1000 0010 3810 6c6c 2424 4800 0000 0000 0000 0000 0000 @@ -95,5 +95,10 @@ f010 1010 1010 1010 1010 1010 1010 10f0 c020 2020 2020 1008 1020 2020 2020 20c0 6092 0c00 0000 0000 0000 0000 0000 0000 ] -@buf - ">ASCII 20 "Mode, 20 "ready. 0a $1000 +@buf [ + "a) 20 "hello 20 "there 20 "long 20 "sentence 20 +"b) 20 "hello 20 "there 20 "long 20 "sentence 20 +"c) 20 "hello 20 "there 20 "long 20 "sentence 20 ] + + + $1000 diff --git a/src/utils/log.tal b/src/utils/log.tal index 7d5c841..a034d70 100644 --- a/src/utils/log.tal +++ b/src/utils/log.tal @@ -7,10 +7,12 @@ |0100 @on-reset ( -> ) - #cf0f .System/r DEO2 - #cf06 .System/g DEO2 - #cf02 .System/b DEO2 - #0180 .Screen/width DEO2 + ( | theme ) + #f00f .System/r DEO2 + #f006 .System/g DEO2 + #f002 .System/b DEO2 + ( | size ) + #0200 .Screen/width DEO2 #00c0 .Screen/height DEO2 ;on-mouse .Mouse/vector DEO2 @@ -28,22 +30,62 @@ BRK @ ( -- ) - #0008 .Screen/x DEO2 - #0008 .Screen/y DEO2 + #0014 .Screen/x DEO2 + #0004 .Screen/y DEO2 ;buf + JMP2r @ ( str* -- ) #15 .Screen/auto DEO &w ( -- ) - LDAk #0a NEQ ?{ - .Screen/y DEI2k #0010 ADD2 ROT DEO2 - [ LIT2 &anchor $2 ] .Screen/x DEO2 } - LDAk #20 SUB #00 SWP #40 SFT2 ;font-icn ADD2 .Screen/addr DEO2 + handle-wrap LDAk #20 SUB #00 SWP #40 SFT2 ;font-icn ADD2 .Screen/addr DEO2 #0a .Screen/sprite DEO - INC2 LDAk ?&w + &res INC2 LDAk ?&w POP2 JMP2r +@handle-wrap ( str* -- str* ) + LDAk #20 GTH ?{ + INC2k word-fits ?{ + !/res } + } + LDAk #0a NEQ ?{ + !/res } + JMP2r + +@word-fits ( str* -- f ) + .Screen/x DEI2 STH2 + &w ( -- ) + STH2kr .Screen/width DEI2 GTH2 ?&fail + LDAk #20 GTH ?{ + POP2 POP2r #01 JMP2r } + [ LIT2r 0008 ADD2r ] INC2 !&w + JMP2r + &fail POP2 POP2r #00 JMP2r + +@ ( -- ) + .Screen/y DEI2k #0010 ADD2 ROT DEO2 + #0014 .Screen/x DEO2 + JMP2r + +@ ( -- ) + #0000 DUP2 .Screen/x DEO2 + .Screen/y DEO2 + ( | fill ) + #12 .Screen/auto DEO + ;halftone-icn .Screen/addr DEO2 + #00 .Screen/height DEI2 #03 SFT2 NIP SUB + × ( -- ) + [ LIT2 01 -Screen/sprite ] DEO + INC DUP ?× + POP + ( | icon ) + #0000 .Screen/y DEO2 + ;resize-icn .Screen/addr DEO2 + #16 .Screen/auto DEO + [ LIT2 01 -Screen/sprite ] DEOk DEO + JMP2r + @ ( color addr* -- ) [ LIT2 00 -Screen/auto ] DEO ;fill-icn .Screen/addr DEO2 @@ -66,6 +108,20 @@ INC2 & LDAk ?&w JMP2r +@ ( str* -- ) + &w ( -- ) + LDAk #18 DEO + INC2 LDAk #20 GTH ?&w + POP2 JMP2r + +@ ( short* -- ) + SWP /b + &b ( -- ) + DUP #04 SFT /c + &c ( -- ) + #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO + JMP2r + ( @|assets ) @@ -73,5 +129,10 @@ @fill-icn [ ffff ffff ffff ffff ] +@halftone-icn [ aa55 aa55 aa55 aa55 ] + +@resize-icn [ + aa55 805f 9051 9357 aa55 02f9 0a89 cae9 + 9753 9150 9f40 aa55 eac9 8a09 fa01 aa55 ] ~src/utils/log.assets.tal