mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-30 09:43:02 +00:00
714 lines
No EOL
17 KiB
Text
714 lines
No EOL
17 KiB
Text
(
|
|
app/left : text editor
|
|
|
|
TODO
|
|
- Save/Load
|
|
- Double-click select word
|
|
- Right-click find next instance of selection
|
|
- Draw tab characters
|
|
- Don't redraw if nothing has changed
|
|
- Input on selection should erase selection range
|
|
- Erase on selection should erase selection range
|
|
- Scrollbar
|
|
- Don't scroll past oef
|
|
- Hor scroll
|
|
- Real scrolling distance
|
|
)
|
|
|
|
%RTN { JMP2r }
|
|
%RTN? { #00 EQU #02 JNZ STH2r JMP2 }
|
|
|
|
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
|
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
|
|
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
|
|
|
|
( variables )
|
|
|
|
;lock { byte 1 }
|
|
;k { byte 1 }
|
|
;l { byte 1 }
|
|
;i { short 2 }
|
|
;j { short 2 }
|
|
;addr { short 2 }
|
|
;selection { from 2 to 2 }
|
|
;position { x 2 y 2 }
|
|
;scroll { x 2 y 2 }
|
|
;pt { x 2 y 2 }
|
|
;mouse { x 2 y 2 }
|
|
;touch { x1 2 y1 2 x2 2 y2 2 state 1 }
|
|
;textarea { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 }
|
|
;label { x 2 y 2 color 1 addr 2 } ( remove )
|
|
|
|
( devices )
|
|
|
|
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
|
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|
|0130 ;Controller { buttons 1 }
|
|
|0140 ;Keys { key 1 }
|
|
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
|
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
|
|01F0 .RESET .FRAME .ERROR ( vectors )
|
|
|01F8 [ ed0f 3d0f 3d0f ] ( palette )
|
|
|
|
( program )
|
|
|
|
|0200 @RESET
|
|
|
|
( load file )
|
|
,filepath ,load-file JSR2
|
|
( place textarea )
|
|
#0018 =textarea.x1 ~Screen.height 8- =textarea.y2
|
|
|
|
,select JSR2
|
|
,redraw JSR2
|
|
|
|
BRK
|
|
|
|
@FRAME
|
|
|
|
( ctrl )
|
|
|
|
~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,ctrl-end JNZ2
|
|
( lock ) #04 =lock
|
|
~Controller #10 NEQ ,no-ctrl-up JNZ2
|
|
( clamp ) ~position.y #0000 EQU2 ,no-ctrl-up JNZ2
|
|
,find-lineoffset JSR2 =position.x
|
|
~position.y -- =position.y
|
|
,find-selection JSR2 DUP2 =selection.from ++ =selection.to
|
|
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-ctrl-up
|
|
~Controller #20 NEQ ,no-ctrl-down JNZ2
|
|
,find-lineoffset JSR2 =position.x ~position.y ++ =position.y
|
|
,find-selection JSR2 DUP2 =selection.from ++ =selection.to
|
|
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-ctrl-down
|
|
~Controller #40 NEQ ,no-ctrl-left JNZ2
|
|
( clamp ) ~selection.from ,document.body EQU2 ,no-ctrl-left JNZ2
|
|
~selection.from -- DUP2 =selection.from ++ =selection.to
|
|
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-ctrl-left
|
|
~Controller #80 NEQ ,no-ctrl-right JNZ2
|
|
~selection.from ++ DUP2 =selection.from ++ =selection.to
|
|
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-ctrl-right
|
|
( alt )
|
|
~Controller #0f AND #02 NEQ ,no-alt JNZ2
|
|
~Controller #04 SFT #01 NEQ ,no-aup JNZ2
|
|
,find-wordstart JSR2 =selection.to
|
|
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-aup
|
|
~Controller #04 SFT #02 NEQ ,no-adown JNZ2
|
|
,find-wordend JSR2 =selection.to
|
|
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-adown
|
|
~Controller #04 SFT #04 NEQ ,no-aleft JNZ2
|
|
~selection.to -- =selection.to
|
|
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-aleft
|
|
~Controller #04 SFT #08 NEQ ,no-aright JNZ2
|
|
~selection.to ++ =selection.to
|
|
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-aright
|
|
@no-alt
|
|
( ctrl )
|
|
~Controller #0f AND #01 NEQ ,no-ctrl JNZ2
|
|
~Controller #04 SFT #01 NEQ ,no-cup JNZ2
|
|
#0004 ,scroll-up JSR2
|
|
,redraw JSR2 ,ctrl-end JMP2
|
|
@no-cup
|
|
~Controller #04 SFT #02 NEQ ,no-cdown JNZ2
|
|
#0004 ,scroll-down JSR2
|
|
,redraw JSR2 ,ctrl-end JMP2
|
|
@no-cdown
|
|
~Controller #04 SFT #04 NEQ ,no-cleft JNZ2
|
|
,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-cleft
|
|
~Controller #04 SFT #08 NEQ ,no-cright JNZ2
|
|
,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2
|
|
@no-cright
|
|
@no-ctrl
|
|
|
|
@ctrl-end
|
|
|
|
( keys )
|
|
|
|
~Keys #00 EQU ,no-keys JNZ2
|
|
|
|
~Keys #08 NEQ ^$no-backspace JNZ
|
|
( erase )
|
|
~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ
|
|
~selection.to ~selection.from SUB2 ,shift-left JSR2
|
|
,$erase-end JMP2
|
|
$erase-multiple
|
|
~selection.from ++ =selection.from
|
|
~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
|
|
$erase-end
|
|
~selection.from -- =selection.from
|
|
,$keys-end JMP2
|
|
$no-backspace
|
|
|
|
( insert )
|
|
~selection.to ~selection.from SUB2 ,shift-right JSR2
|
|
~Keys ~selection.from POK2
|
|
~selection.from ++ =selection.from
|
|
|
|
$keys-end
|
|
~selection.from ++ =selection.to
|
|
( release ) #00 =Keys
|
|
,redraw JSR2
|
|
|
|
@no-keys
|
|
|
|
( mouse )
|
|
|
|
~Mouse.state ~touch.state EQU ^no-change JNZ
|
|
#0000 =Sprite.x ~Screen.height 8- =Sprite.y
|
|
,mouse00icn =Sprite.addr
|
|
~Mouse.state #01 NEQ ^$nobutton1 JNZ ,mouse01icn =Sprite.addr $nobutton1
|
|
~Mouse.state #10 NEQ ^$nobutton2 JNZ ,mouse10icn =Sprite.addr $nobutton2
|
|
~Mouse.state #11 NEQ ^$nobutton3 JNZ ,mouse11icn =Sprite.addr $nobutton3
|
|
#01 =Sprite.color
|
|
@no-change
|
|
|
|
~Mouse.state #00 EQU ,touch-end JNZ2
|
|
~Mouse.x #0010 LTH2 ,touch-linebar JNZ2
|
|
~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2
|
|
,touch-scrollbar JMP2
|
|
@touch-end
|
|
|
|
~Mouse.state =touch.state
|
|
|
|
( unlock ) ~lock #00 EQU ,skip-unlock JNZ2 ~lock #01 SUB =lock @skip-unlock
|
|
|
|
,draw-cursor JSR2
|
|
|
|
BRK
|
|
|
|
@touch-scrollbar
|
|
|
|
~Mouse.y #0008 GTH2 ^$no-up JNZ
|
|
( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y
|
|
^$end JMP
|
|
$no-up
|
|
~Mouse.y ~Screen.height 8- LTH2 ^$no-down JNZ
|
|
( incr ) ~scroll.y ++ =scroll.y
|
|
^$end JMP
|
|
$no-down
|
|
~Mouse.y 8- =scroll.y
|
|
$end
|
|
,redraw JSR2
|
|
,touch-end JMP2
|
|
|
|
RTN
|
|
|
|
@touch-linebar
|
|
|
|
~Mouse.y 8/ ~scroll.y ADD2 =position.y #0000 =position.x
|
|
,find-selection JSR2 DUP2 =selection.from ++ =selection.to
|
|
,redraw JSR2
|
|
,touch-end JMP2
|
|
|
|
RTN
|
|
|
|
@touch-body
|
|
|
|
~Mouse.y 8/ ~scroll.y ADD2 =position.y
|
|
~Mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x
|
|
|
|
~Mouse.chord #01 NEQ ^$no-chord-cut JNZ
|
|
,cut JSR2
|
|
( release ) #00 DUP =Mouse.state =Mouse.chord
|
|
^$end JMP
|
|
$no-chord-cut
|
|
~Mouse.chord #10 NEQ ^$no-chord-paste JNZ
|
|
,paste JSR2
|
|
( release ) #00 DUP =Mouse.state =Mouse.chord
|
|
^$end JMP
|
|
$no-chord-paste
|
|
|
|
~Mouse.state #11 EQU ^$end JNZ
|
|
~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 ^$no-drag JNZ
|
|
( on drag )
|
|
,find-selection JSR2 ++ =selection.to
|
|
,clamp-selection JSR2
|
|
^$end JMP
|
|
$no-drag
|
|
( on click )
|
|
,find-selection JSR2 DUP2 =selection.from ++ =selection.to
|
|
$end
|
|
,redraw JSR2
|
|
,touch-end JMP2
|
|
|
|
RTN
|
|
|
|
@load-file ( path )
|
|
|
|
=File.name #8000 =File.length ,document.body =File.load
|
|
( get file length )
|
|
,document.body =document.eof
|
|
$loop
|
|
( incr ) ~document.eof ++ =document.eof
|
|
~document.eof PEK2 #00 NEQ ^$loop JNZ
|
|
|
|
RTN
|
|
|
|
@scroll-up ( length )
|
|
|
|
DUP2 ~scroll.y LTH2 ^$clamp JNZ
|
|
#0000 =scroll.y POP2 RTN
|
|
$clamp
|
|
~scroll.y SWP2 SUB2 =scroll.y
|
|
|
|
RTN
|
|
|
|
@scroll-down ( length )
|
|
|
|
( TODO: Clamp )
|
|
~scroll.y SWP2 ADD2 =scroll.y
|
|
|
|
RTN
|
|
|
|
@shift-left ( length )
|
|
|
|
=i
|
|
~selection.from -- =j ( start -> end )
|
|
$loop
|
|
( move ) ~j ~i ADD2 PEK2 ~j POK2
|
|
( incr ) ~j ++ =j
|
|
~j ~document.eof LTH2 ^$loop JNZ
|
|
~document.eof ~i SUB2 =document.eof
|
|
|
|
RTN
|
|
|
|
@shift-right ( length )
|
|
|
|
=i
|
|
~document.eof =j ( end -> start )
|
|
$loop
|
|
( move ) ~j ~i SUB2 PEK2 ~j POK2
|
|
( decr ) ~j -- =j
|
|
~j ~selection.from GTH2 ^$loop JNZ
|
|
~document.eof ~i ADD2 =document.eof
|
|
|
|
RTN
|
|
|
|
@follow-selection
|
|
|
|
~position.y ~scroll.y GTH2 ^$no-up JNZ
|
|
~position.y =scroll.y RTN
|
|
$no-up
|
|
~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 ^$no-down JNZ
|
|
~position.y ~Screen.height #0010 SUB2 8/ SUB2 =scroll.y RTN
|
|
$no-down
|
|
|
|
RTN
|
|
|
|
@clamp-selection
|
|
|
|
~selection.from ~selection.to LTH2 RTN?
|
|
~selection.from ++ =selection.to
|
|
|
|
RTN
|
|
|
|
@goto-linestart
|
|
|
|
$loop
|
|
~selection.from -- PEK2 #0a EQU RTN?
|
|
~selection.from -- PEK2 #0d EQU RTN?
|
|
( decr ) ~selection.from DUP2 =selection.to -- =selection.from
|
|
~selection.from PEK2 #00 NEQ ^$loop JNZ
|
|
( clamp at document body )
|
|
~selection.from ,document.body GTH2 RTN?
|
|
,document.body DUP2 =selection.from ++ =selection.to
|
|
|
|
RTN
|
|
|
|
@goto-lineend
|
|
|
|
$loop
|
|
~selection.from PEK2 #0a EQU RTN?
|
|
~selection.from PEK2 #0d EQU RTN?
|
|
( incr ) ~selection.from ++ DUP2 ++ =selection.to =selection.from
|
|
~selection.from PEK2 #00 NEQ ^$loop JNZ
|
|
( clamp at document body )
|
|
~selection.from ,document.eof LTH2 RTN?
|
|
,document.eof -- DUP2 =selection.from ++ =selection.to
|
|
|
|
RTN
|
|
|
|
@find-wordstart
|
|
|
|
~selection.to =j
|
|
$loop
|
|
( decr ) ~j -- =j
|
|
~j PEK2 #20 EQU ^$end JNZ
|
|
~j PEK2 #0a EQU ^$end JNZ
|
|
~j PEK2 #0d EQU ^$end JNZ
|
|
~j ,document.body GTH2 ^$loop JNZ
|
|
$end
|
|
( return ) ~j --
|
|
|
|
RTN
|
|
|
|
@find-wordend
|
|
|
|
~selection.to =j
|
|
$loop
|
|
( incr ) ~j ++ =j
|
|
~j PEK2 #20 EQU ^$end JNZ
|
|
~j PEK2 #0a EQU ^$end JNZ
|
|
~j PEK2 #0d EQU ^$end JNZ
|
|
~j ,document.body GTH2 ^$loop JNZ
|
|
$end
|
|
( return ) ~j ++
|
|
|
|
RTN
|
|
|
|
@find-lineoffset ( return character offset from linestart )
|
|
|
|
#0000 =j
|
|
$loop
|
|
( incr ) ~j ++ =j
|
|
~selection.from ~j SUB2 PEK2 #0a EQU ^$end JNZ
|
|
~selection.from ~j SUB2 PEK2 #0d EQU ^$end JNZ
|
|
~selection.from ~j SUB2 ,document.body GTH2 ^$loop JNZ
|
|
$end
|
|
( return ) ~j
|
|
|
|
RTN
|
|
|
|
@find-line ( position -> addr )
|
|
|
|
,document.body =j #0000 =pt.y
|
|
$loop
|
|
~pt.y ~position.y -- GTH2 ^$end JNZ
|
|
~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 ^$no-space JNZ
|
|
( incr ) ~pt.y ++ =pt.y
|
|
$no-space
|
|
( incr ) ~j ++ =j
|
|
~j PEK2 #00 NEQ ^$loop JNZ
|
|
$end
|
|
( return ) ~j
|
|
|
|
RTN
|
|
|
|
@find-selection ( position -> addr )
|
|
|
|
,find-line JSR2 ( find line )
|
|
#0000 =pt.x
|
|
$loop
|
|
~j ~pt.x ADD2 PEK2 #0a EQU ^$end JNZ
|
|
~j ~pt.x ADD2 PEK2 #0d EQU ^$end JNZ
|
|
( incr ) ~pt.x ++ =pt.x
|
|
~pt.x ~position.x -- LTH2 ^$loop JNZ
|
|
$end
|
|
( return ) ~pt.x ADD2
|
|
|
|
RTN
|
|
|
|
@cut
|
|
|
|
,copy JSR2
|
|
~selection.to ~selection.from SUB2 ,shift-left JSR2
|
|
~selection.from ++ =selection.to
|
|
|
|
RTN
|
|
|
|
@copy ( selection )
|
|
|
|
#0000 =i ( start )
|
|
~selection.to ~selection.from SUB2 =j ( end )
|
|
~j =clip.len
|
|
$loop
|
|
~selection.from ~i ADD2 PEK2 ,clip.body ~i ADD2 POK2
|
|
( incr ) ~i ++ =i
|
|
~i ~j LTH2 ^$loop JNZ
|
|
|
|
RTN
|
|
|
|
@paste
|
|
|
|
~clip.len ,shift-right JSR2
|
|
#0000 =i ( start )
|
|
~clip.len =j ( end )
|
|
$loop
|
|
,clip.body ~i ADD2 PEK2 ~selection.from ~i ADD2 POK2
|
|
( incr ) ~i ++ =i
|
|
~i ~j LTH2 ^$loop JNZ
|
|
|
|
RTN
|
|
|
|
@select ( position -> selection )
|
|
|
|
,document.body =selection.from #0000 =pt.x #0000 =pt.y
|
|
$loop
|
|
~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 ^$no-space JNZ
|
|
( incr ) ~pt.y ++ =pt.y
|
|
#0000 =pt.x
|
|
$no-space
|
|
~pt.y ~position.y -- GTH2 ~pt.x ~position.x -- GTH2 #0101 NEQ2 ^$no-reached JNZ
|
|
~selection.from ++ =selection.to
|
|
RTN
|
|
$no-reached
|
|
( incr ) ~pt.x ++ =pt.x
|
|
( incr ) ~selection.from ++ =selection.from
|
|
~selection.from PEK2 #00 NEQ ^$loop JNZ
|
|
|
|
RTN
|
|
|
|
( drawing functions )
|
|
|
|
@redraw
|
|
|
|
,draw-textarea JSR2
|
|
,draw-scrollbar JSR2
|
|
,draw-titlebar JSR2
|
|
|
|
( save/load icons )
|
|
~Screen.height 8- =Sprite.y
|
|
~Screen.width #0018 SUB2 =Sprite.x
|
|
,load_icn =Sprite.addr
|
|
#02 =Sprite.color
|
|
~Screen.width #0010 SUB2 =Sprite.x
|
|
,save_icn =Sprite.addr
|
|
#02 =Sprite.color
|
|
|
|
RTN
|
|
|
|
@draw-short ( short )
|
|
|
|
=addr
|
|
,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
|
( draw ) #0e =Sprite.color
|
|
~Sprite.x 8+ =Sprite.x
|
|
,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
|
|
( draw ) #0e =Sprite.color
|
|
~Sprite.x 8+ =Sprite.x
|
|
,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
|
( draw ) #0e =Sprite.color
|
|
~Sprite.x 8+ =Sprite.x
|
|
,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
|
|
( draw ) #0e =Sprite.color
|
|
|
|
RTN
|
|
|
|
@draw-cursor
|
|
|
|
~mouse.x ~Mouse.x NEQ2
|
|
~mouse.y ~Mouse.y NEQ2
|
|
|
|
#0000 EQU2 RTN? ( Return if unchanged )
|
|
|
|
( clear last cursor )
|
|
~mouse.x =Sprite.x
|
|
~mouse.y =Sprite.y
|
|
,blank_icn =Sprite.addr
|
|
#10 =Sprite.color
|
|
|
|
( record mouse positions )
|
|
~Mouse.x =mouse.x
|
|
~Mouse.y =mouse.y
|
|
|
|
( draw new cursor )
|
|
~mouse.x =Sprite.x
|
|
~mouse.y =Sprite.y
|
|
,cursor_icn =Sprite.addr
|
|
#13 =Sprite.color
|
|
|
|
RTN
|
|
|
|
@draw-textarea ( x y color addr )
|
|
|
|
,document.body =textarea.addr
|
|
|
|
( scroll to position )
|
|
#0000 =j ( j is linebreaks )
|
|
$find-offset
|
|
~scroll.y ~j EQU2 ^$find-offset-end JNZ
|
|
~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 ^$no-break JNZ
|
|
( incr ) ~j ++ =j $no-break
|
|
( incr ) ~textarea.addr ++ =textarea.addr
|
|
~textarea.addr PEK2 #00 NEQ ^$find-offset JNZ
|
|
$find-offset-end
|
|
|
|
#0018 =Sprite.x #0000 =Sprite.y
|
|
~textarea.addr =i
|
|
|
|
$loop
|
|
|
|
~Sprite.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2
|
|
|
|
( get character )
|
|
,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr
|
|
|
|
( draw ) #01
|
|
~i ~selection.from -- GTH2
|
|
~i ~selection.to LTH2 #0101 EQU2
|
|
#05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color
|
|
|
|
~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 ,$no-linebreak JNZ2
|
|
( draw linebreak )
|
|
,linebreak_icn =Sprite.addr
|
|
( draw ) #02
|
|
~i ~selection.from -- GTH2
|
|
~i ~selection.to LTH2 #0101 EQU2
|
|
#06 MUL ADD =Sprite.color
|
|
( fill clear )
|
|
$fill-clear
|
|
( incr ) ~Sprite.x 8+ =Sprite.x
|
|
,font =Sprite.addr
|
|
#01 =Sprite.color
|
|
~Sprite.x ~Screen.width 8- LTH2 ^$fill-clear JNZ
|
|
|
|
( draw line number )
|
|
|
|
#0000 =Sprite.x
|
|
~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k
|
|
~position.y EQU2 #0c MUL =l
|
|
,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
|
#02 ~l ADD =Sprite.color
|
|
#0008 =Sprite.x
|
|
,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr
|
|
#02 ~l ADD =Sprite.color
|
|
|
|
#0010 =Sprite.x
|
|
( incr ) ~Sprite.y 8+ =Sprite.y
|
|
$no-linebreak
|
|
|
|
( incr ) ~i ++ =i
|
|
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
|
|
|
|
~i PEK2 #00 NEQ ,$loop JNZ2
|
|
|
|
$end
|
|
|
|
RTN
|
|
|
|
@draw-scrollbar
|
|
|
|
~Screen.width 8- =Sprite.x
|
|
#0000 =Sprite.y
|
|
,scrollbar_bg =Sprite.addr
|
|
|
|
$loop
|
|
( draw ) #08 =Sprite.color
|
|
( incr ) ~Sprite.y 8+ =Sprite.y
|
|
~Sprite.y ~Screen.height LTH2 ^$loop JNZ
|
|
|
|
#0000 =Sprite.y
|
|
,arrowup_icn =Sprite.addr
|
|
( draw ) #08 =Sprite.color
|
|
|
|
( at )
|
|
~scroll.y 8+ =Sprite.y
|
|
,scrollbar_fg =Sprite.addr
|
|
( draw ) #08 =Sprite.color
|
|
|
|
~Screen.height 8- =Sprite.y
|
|
,arrowdown_icn =Sprite.addr
|
|
( draw ) #08 =Sprite.color
|
|
|
|
RTN
|
|
|
|
@draw-titlebar
|
|
|
|
#0018 ~Screen.height 8- #09 ,filepath
|
|
( load ) =label.addr =label.color =Sprite.y =Sprite.x
|
|
~label.addr
|
|
$loop
|
|
( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
|
( incr ) ++
|
|
( incr ) ~Sprite.x 8+ =Sprite.x
|
|
DUP2 PEK2 #00 NEQ ^$loop JNZ
|
|
POP2
|
|
( selection )
|
|
~selection.from ,document.body SUB2 ,draw-short JSR2
|
|
|
|
RTN
|
|
|
|
@font_hex ( 0-F TODO: should pull from @font instead.. )
|
|
[
|
|
003c 464a 5262 3c00 0018 0808 0808 1c00
|
|
003c 4202 3c40 7e00 003c 421c 0242 3c00
|
|
000c 1424 447e 0400 007e 407c 0242 3c00
|
|
003c 407c 4242 3c00 007e 0204 0810 1000
|
|
003c 423c 4242 3c00 003c 4242 3e02 3c00
|
|
003c 4242 7e42 4200 007c 427c 4242 7c00
|
|
003c 4240 4042 3c00 007c 4242 4242 7c00
|
|
007e 4078 4040 7e00 007e 4078 4040 4000
|
|
]
|
|
|
|
@font ( specter8-frag font )
|
|
[
|
|
0000 0000 0000 0000 0008 0808 0800 0800
|
|
0014 1400 0000 0000 0024 7e24 247e 2400
|
|
0008 1e28 1c0a 3c08 0000 2204 0810 2200
|
|
0030 4832 4c44 3a00 0008 1000 0000 0000
|
|
0004 0808 0808 0400 0020 1010 1010 2000
|
|
0000 2214 0814 2200 0000 0808 3e08 0800
|
|
0000 0000 0000 0810 0000 0000 3e00 0000
|
|
0000 0000 0000 0800 0000 0204 0810 2000
|
|
003c 464a 5262 3c00 0018 0808 0808 1c00
|
|
003c 4202 3c40 7e00 003c 421c 0242 3c00
|
|
000c 1424 447e 0400 007e 407c 0242 3c00
|
|
003c 407c 4242 3c00 007e 0204 0810 1000
|
|
003c 423c 4242 3c00 003c 4242 3e02 3c00
|
|
0000 0010 0000 1000 0000 1000 0010 1020
|
|
0000 0810 2010 0800 0000 003e 003e 0000
|
|
0000 1008 0408 1000 003c 420c 1000 1000
|
|
003c 4232 4a42 3c00 003c 4242 7e42 4200
|
|
007c 427c 4242 7c00 003c 4240 4042 3c00
|
|
007c 4242 4242 7c00 007e 4078 4040 7e00
|
|
007e 4078 4040 4000 003c 4240 4642 3c00
|
|
0042 427e 4242 4200 001c 0808 0808 1c00
|
|
007e 0202 0242 3c00 0042 4478 4442 4200
|
|
0040 4040 4040 7e00 0042 665a 4242 4200
|
|
0042 6252 4a46 4200 003c 4242 4242 3c00
|
|
007c 4242 7c40 4000 003c 4242 4244 3a00
|
|
007c 4242 7c44 4200 003e 403c 0242 3c00
|
|
007e 0808 0808 1000 0042 4242 4244 3a00
|
|
0042 4242 4224 1800 0042 4242 5a66 4200
|
|
0042 423c 4242 4200 0042 423e 0242 3c00
|
|
007e 020c 3040 7e00 000c 0808 0808 0c00
|
|
0040 2010 0804 0200 0030 1010 1010 3000
|
|
0008 1400 0000 0000 0000 0000 0000 7e00
|
|
0008 0400 0000 0000 0000 3c02 3e42 3a00
|
|
0040 407c 4242 7c00 0000 3c42 4042 3c00
|
|
0002 023e 4242 3e00 0000 3c42 7e40 3e00
|
|
0000 3e40 7840 4000 0000 3c42 3e02 3c00
|
|
0040 405c 6242 4200 0008 0018 0808 0400
|
|
0008 0018 0808 4830 0040 4244 7844 4200
|
|
0010 1010 1010 0c00 0000 6c52 5252 5200
|
|
0000 5c62 4242 4200 0000 3c42 4242 3c00
|
|
0000 7c42 427c 4040 0000 3e42 423e 0202
|
|
0000 5c62 4040 4000 0000 3e40 3c02 7c00
|
|
0008 7e08 0808 1000 0000 4242 4244 3a00
|
|
0000 4242 4224 1800 0000 5252 5252 2e00
|
|
0000 4224 1824 4200 0000 4242 3e02 7c00
|
|
0000 7e02 3c40 7e00 000c 0810 1008 0c00
|
|
0008 0808 0808 0800 0030 1008 0810 3000
|
|
0000 0032 4c00 0000 3c42 99a1 a199 423c
|
|
]
|
|
|
|
@mouse00icn [ 0000 0000 0000 0000 ]
|
|
@mouse01icn [ 0078 7878 7878 7800 ]
|
|
@mouse10icn [ 001e 1e1e 1e1e 1e00 ]
|
|
@mouse11icn [ 007e 7e7e 7e7e 7e00 ]
|
|
|
|
@linebreak_icn [ 003e 7474 3414 1400 ]
|
|
@blank_icn [ 0000 0000 0000 0000 ]
|
|
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
|
|
@scrollbar_bg [ aa55 aa55 aa55 aa55 ]
|
|
@scrollbar_fg [ ffff ffff ffff ffff ]
|
|
@arrowup_icn [ 0010 387c fe10 1010 ]
|
|
@arrowdown_icn [ 0010 1010 fe7c 3810 ]
|
|
@load_icn [ feaa d6aa d4aa f400 ]
|
|
@save_icn [ fe82 8282 848a f400 ]
|
|
@filepath1 [ projects/examples/gui.hover.usm 00 ]
|
|
@filepath [ projects/software/noodle.usm 00 ]
|
|
|
|
|3000 ;document { eof 2 body 8000 }
|
|
|c000 ;clip { len 2 body 256 }
|
|
|
|
|d000 @ERROR BRK |