shell: skeleton for scrolling
This commit is contained in:
parent
d85529f3fa
commit
9516dfa0b0
14
boot.subx
14
boot.subx
|
@ -122,6 +122,20 @@
|
|||
cd/syscall 0x13/imm8/bios-disk-services
|
||||
0f 82/jump-if-carry disk_error/disp16
|
||||
|
||||
# load two more tracks of disk into addresses [0x46c00, 0x56800)
|
||||
b4/copy-to-ah 2/imm8/read-drive
|
||||
# dl comes conveniently initialized at boot time with the index of the device being booted
|
||||
b5/copy-to-ch 0/imm8/cylinder
|
||||
b6/copy-to-dh 6/imm8/head
|
||||
b1/copy-to-cl 1/imm8/sector # 1-based
|
||||
b0/copy-to-al 0x7e/imm8/num-sectors # 2*63 = 126
|
||||
# address to write sectors to = es:bx = 0x46c00, contiguous with boot segment
|
||||
bb/copy-to-bx 0x46c0/imm16
|
||||
8e/->seg 3/mod/direct 3/rm32/bx 0/r32/es
|
||||
bb/copy-to-bx 0/imm16
|
||||
cd/syscall 0x13/imm8/bios-disk-services
|
||||
0f 82/jump-if-carry disk_error/disp16
|
||||
|
||||
# reset es
|
||||
bb/copy-to-bx 0/imm16
|
||||
8e/->seg 3/mod/direct 3/rm32/bx 0/r32/es
|
||||
|
|
|
@ -23,15 +23,18 @@ type trace {
|
|||
# render loop:
|
||||
# rendering displays trace lines that match visible lines
|
||||
# (caching in each line)
|
||||
# (caching top-line)
|
||||
# rendering computes cursor-line based on the cursor-y coordinate
|
||||
# edit-trace updates cursor-y coordinate
|
||||
# edit-trace might add/remove lines to visible
|
||||
# edit-trace might update top-line
|
||||
visible: (handle array trace-line)
|
||||
recreate-caches?: boolean
|
||||
cursor-line-index: int # index into data
|
||||
cursor-y: int # row index on screen
|
||||
unclip-cursor-line?: boolean # extremely short-lived; reset any time cursor moves
|
||||
top-line-index: int # index into data
|
||||
top-line-index: int # start rendering trace past this index into data (updated on re-evaluation)
|
||||
top-line-y: int # trace starts rendering at this row index on screen (updated on re-evaluation)
|
||||
}
|
||||
|
||||
type trace-line {
|
||||
|
@ -434,6 +437,8 @@ fn render-trace screen: (addr screen), _self: (addr trace), xmin: int, ymin: int
|
|||
compare *recreate-caches?, 0/false
|
||||
{
|
||||
break-if-=
|
||||
var dest/eax: (addr int) <- get self, top-line-y
|
||||
copy-to *dest, y
|
||||
recompute-all-visible-lines self
|
||||
mark-lines-clean self
|
||||
}
|
||||
|
@ -441,7 +446,6 @@ fn render-trace screen: (addr screen), _self: (addr trace), xmin: int, ymin: int
|
|||
var trace-ah/eax: (addr handle array trace-line) <- get self, data
|
||||
var _trace/eax: (addr array trace-line) <- lookup *trace-ah
|
||||
var trace/edi: (addr array trace-line) <- copy _trace
|
||||
var i/edx: int <- copy 0
|
||||
var max-addr/ebx: (addr int) <- get self, first-free
|
||||
var max/ebx: int <- copy *max-addr
|
||||
# display trace depth (not in tests)
|
||||
|
@ -460,6 +464,8 @@ fn render-trace screen: (addr screen), _self: (addr trace), xmin: int, ymin: int
|
|||
draw-text-rightward-from-cursor-over-full-screen screen, "trace depth: ", 0x17/fg, 0xc5/bg=blue-bg
|
||||
draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen screen, *max-depth, 0x7/fg, 0xc5/bg=blue-bg
|
||||
}
|
||||
var top-line-addr/edx: (addr int) <- get self, top-line-index
|
||||
var i/edx: int <- copy *top-line-addr
|
||||
$render-trace:loop: {
|
||||
compare i, max
|
||||
break-if->=
|
||||
|
@ -924,6 +930,20 @@ fn edit-trace _self: (addr trace), key: grapheme {
|
|||
copy-to *unclip-cursor-line?, 1/true
|
||||
return
|
||||
}
|
||||
# ctrl-f: scroll down
|
||||
{
|
||||
compare key, 6/ctrl-f
|
||||
break-if-!=
|
||||
scroll-down self
|
||||
return
|
||||
}
|
||||
# ctrl-b: scroll up
|
||||
{
|
||||
compare key, 2/ctrl-b
|
||||
break-if-!=
|
||||
scroll-up self
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fn expand _self: (addr trace) {
|
||||
|
@ -1789,3 +1809,9 @@ fn test-trace-collapse-nested-level {
|
|||
check-screen-row screen, 3/y, "... ", "F - test-trace-collapse-nested-level/post-3"
|
||||
check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-trace-collapse-nested-level/post-3/cursor"
|
||||
}
|
||||
|
||||
fn scroll-down _self: (addr trace) {
|
||||
}
|
||||
|
||||
fn scroll-up _self: (addr trace) {
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ cat a.survey |linux/hex > a.bin
|
|||
dd if=/dev/zero of=code.img count=20160 # 20*16*63 512-byte sectors = almost 10MB
|
||||
dd if=a.bin of=code.img conv=notrunc
|
||||
|
||||
if [ `stat --printf="%s" a.bin` -ge 258048 ] # 8 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
|
||||
if [ `stat --printf="%s" a.bin` -ge 322560 ] # 10 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
|
||||
then
|
||||
echo "a.bin won't all be loaded on boot"
|
||||
exit 1
|
||||
|
|
|
@ -39,7 +39,7 @@ cat a.survey |linux/bootstrap/bootstrap run linux/hex
|
|||
dd if=/dev/zero of=code.img count=20160 # 20*16*63 512-byte sectors = almost 10MB
|
||||
dd if=a.bin of=code.img conv=notrunc
|
||||
|
||||
if [ `stat --printf="%s" a.bin` -ge 258048 ] # 8 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
|
||||
if [ `stat --printf="%s" a.bin` -ge 322560 ] # 10 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
|
||||
then
|
||||
echo "a.bin won't all be loaded on boot"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue