6758
This commit is contained in:
parent
571ff107a2
commit
8c9b8e8f77
|
@ -40,7 +40,7 @@ fn interactive args: (addr array addr array byte) -> exit-status/ebx: int {
|
|||
# initialize screen state
|
||||
var paginated-screen-storage: paginated-screen
|
||||
var paginated-screen/eax: (addr paginated-screen) <- address paginated-screen-storage
|
||||
initialize-paginated-screen paginated-screen, 0x40
|
||||
initialize-paginated-screen paginated-screen, 0x40, 2, 5
|
||||
normal-text paginated-screen
|
||||
#
|
||||
{
|
||||
|
|
|
@ -14,6 +14,8 @@ type paginated-screen {
|
|||
nrows: int # const
|
||||
ncols: int # const
|
||||
page-width: int
|
||||
top-margin: int
|
||||
left-margin: int
|
||||
toprow: int
|
||||
botrow: int
|
||||
leftcol: int
|
||||
|
@ -22,10 +24,7 @@ type paginated-screen {
|
|||
col: int
|
||||
}
|
||||
|
||||
fn initialize-paginated-screen _self: (addr paginated-screen), page-width: int {
|
||||
# hardcoded parameters:
|
||||
# top-margin
|
||||
# page-margin
|
||||
fn initialize-paginated-screen _self: (addr paginated-screen), page-width: int, top-margin: int, left-margin: int {
|
||||
var self/esi: (addr paginated-screen) <- copy _self
|
||||
var screen-ah/eax: (addr handle screen) <- get self, screen
|
||||
var _screen-addr/eax: (addr screen) <- lookup *screen-ah
|
||||
|
@ -42,16 +41,33 @@ fn initialize-paginated-screen _self: (addr paginated-screen), page-width: int {
|
|||
copy-to *dest, ncols
|
||||
# self->page-width = page-width
|
||||
{
|
||||
var pg/eax: int <- copy page-width
|
||||
var tmp/eax: int <- copy page-width
|
||||
dest <- get self, page-width
|
||||
copy-to *dest, pg
|
||||
copy-to *dest, tmp
|
||||
}
|
||||
# self->top-margin = top-margin
|
||||
{
|
||||
var tmp/eax: int <- copy top-margin
|
||||
dest <- get self, top-margin
|
||||
copy-to *dest, tmp
|
||||
}
|
||||
# self->left-margin = left-margin
|
||||
{
|
||||
var tmp/eax: int <- copy left-margin
|
||||
dest <- get self, left-margin
|
||||
copy-to *dest, tmp
|
||||
}
|
||||
# self->toprow = top-margin
|
||||
dest <- get self, toprow
|
||||
copy-to *dest, 2 # top-margin
|
||||
{
|
||||
var tmp/eax: int <- copy top-margin
|
||||
dest <- get self, toprow
|
||||
copy-to *dest, tmp
|
||||
}
|
||||
# self->botrow = nrows
|
||||
dest <- get self, botrow
|
||||
copy-to *dest, nrows
|
||||
{
|
||||
dest <- get self, botrow
|
||||
copy-to *dest, nrows
|
||||
}
|
||||
#
|
||||
start-drawing self
|
||||
}
|
||||
|
@ -134,13 +150,13 @@ $add-grapheme:body: {
|
|||
|
||||
## tests
|
||||
|
||||
fn initialize-fake-paginated-screen _self: (addr paginated-screen), nrows: int, ncols: int, page-width: int {
|
||||
fn initialize-fake-paginated-screen _self: (addr paginated-screen), nrows: int, ncols: int, page-width: int, top-margin: int, left-margin: int {
|
||||
var self/esi: (addr paginated-screen) <- copy _self
|
||||
var screen-ah/eax: (addr handle screen) <- get self, screen
|
||||
allocate screen-ah
|
||||
var screen-addr/eax: (addr screen) <- lookup *screen-ah
|
||||
initialize-screen screen-addr, nrows, ncols
|
||||
initialize-paginated-screen self, page-width
|
||||
initialize-paginated-screen self, page-width, top-margin, left-margin
|
||||
}
|
||||
|
||||
## simple delegates
|
||||
|
@ -229,7 +245,6 @@ fn next-line _self: (addr paginated-screen) {
|
|||
|
||||
fn next-page _self: (addr paginated-screen) {
|
||||
var self/esi: (addr paginated-screen) <- copy _self
|
||||
var pg/edi: (addr int) <- get self, page-width
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
#? # temporary: stop
|
||||
|
@ -246,6 +261,7 @@ fn next-page _self: (addr paginated-screen) {
|
|||
copy-to *tmp, tmp2
|
||||
# self->rightcol = self->leftcol + page-width
|
||||
tmp2 <- copy *tmp
|
||||
var pg/edi: (addr int) <- get self, page-width
|
||||
tmp2 <- add *pg
|
||||
tmp <- get self, rightcol
|
||||
copy-to *tmp, tmp2
|
||||
|
|
Loading…
Reference in New Issue