@@ -1126,21 +1126,6 @@ fontlib_GetItalicSpacingAdjustment:
11261126 ret
11271127
11281128
1129- ;-------------------------------------------------------------------------------
1130- fontlib_GetCurrentFontHeight:
1131- ; Returns the height of the current font
1132- ; Arguments:
1133- ; None
1134- ; Returns:
1135- ; Height
1136- ld a , (_CurrentFontProperties.height)
1137- ld hl , _CurrentFontProperties.spaceAbove
1138- add a , (hl)
1139- inc hl
1140- add a , (hl)
1141- ret
1142-
1143-
11441129;-------------------------------------------------------------------------------
11451130fontlib_ValidateCodePoint:
11461131; Returns true if the given code point is present in the current font.
@@ -1665,6 +1650,28 @@ util.ClearRect:
16651650 ret
16661651
16671652
1653+ ;-------------------------------------------------------------------------------
1654+ fontlib_ScrollWindowUp:
1655+ ; Scrolls the contents of the text window up one line, i.e. everything in the
1656+ ; window is copied DOWN one line, thus yielding the effect of scrolling up.
1657+ ; The current text cursor is ignored. The top line is not erased; you must
1658+ ; erase or overwrite it yourself.
1659+ ; Arguments:
1660+ ; None
1661+ ; Returns:
1662+ ; Nothing
1663+ ld de ,- ti.lcdWidth
1664+ call fontlib_ScrollWindowDown.part1
1665+ ; Compute write pointer
1666+ ld hl , (_TextYMax)
1667+ dec l
1668+ call fontlib_ScrollWindowDown.part2
1669+ ; Compute read pointer as HL -= ti.lcdWidth * CurrentFontHeight
1670+ sbc hl , bc
1671+ sbc hl , bc
1672+ jr fontlib_ScrollWindowDown.part3
1673+
1674+
16681675;-------------------------------------------------------------------------------
16691676fontlib_ScrollWindowDown:
16701677; Scrolls the contents of the text window down one line, i.e. everything in the
@@ -1677,6 +1684,7 @@ fontlib_ScrollWindowDown:
16771684; A = 0
16781685 ld de , ti.lcdWidth
16791686 call .part1
1687+ ; A has height
16801688; Compute write pointer
16811689 ld hl , (_TextYMin)
16821690 call .part2
@@ -1711,21 +1719,6 @@ fontlib_ScrollWindowDown:
17111719 jr nz , .copy
17121720 ret
17131721
1714- .part1:
1715- ; Get width loop control first
1716- call fontlib_GetWindowWidth
1717- pop bc
1718- ret c
1719- ret z
1720- push bc
1721- push hl
1722- pop iy ; Stash it in IY for quick access
1723- ex de , hl
1724- sbc hl , de ; carry reset from above
1725- ld (.delta) , hl
1726- ; Now is a good time to call this internal routine
1727- jp fontlib_GetCurrentFontHeight ; A has height
1728-
17291722.part2:
17301723 ld h , ti.lcdWidth / 2
17311724 mlt hl
@@ -1744,27 +1737,36 @@ fontlib_ScrollWindowDown:
17441737 mlt bc
17451738 ret
17461739
1740+ .part1:
1741+ ; Get width loop control first
1742+ call fontlib_GetWindowWidth
1743+ pop bc
1744+ ret c
1745+ ret z
1746+ push bc
1747+ push hl
1748+ pop iy ; Stash it in IY for quick access
1749+ ex de , hl
1750+ sbc hl , de ; carry reset from above
1751+ ld (.delta) , hl
1752+ ; Now is a good time to call this internal routine
1753+ ; jp fontlib_GetCurrentFontHeight
1754+
1755+ assert $ = fontlib_GetCurrentFontHeight
17471756
17481757;-------------------------------------------------------------------------------
1749- fontlib_ScrollWindowUp:
1750- ; Scrolls the contents of the text window up one line, i.e. everything in the
1751- ; window is copied DOWN one line, thus yielding the effect of scrolling up.
1752- ; The current text cursor is ignored. The top line is not erased; you must
1753- ; erase or overwrite it yourself.
1758+ fontlib_GetCurrentFontHeight:
1759+ ; Returns the height of the current font
17541760; Arguments:
17551761; None
17561762; Returns:
1757- ; Nothing
1758- ld de ,- ti.lcdWidth
1759- call fontlib_ScrollWindowDown.part1
1760- ; Compute write pointer
1761- ld hl , (_TextYMax)
1762- dec l
1763- call fontlib_ScrollWindowDown.part2
1764- ; Compute read pointer as HL -= ti.lcdWidth * CurrentFontHeight
1765- sbc hl , bc
1766- sbc hl , bc
1767- jr fontlib_ScrollWindowDown.part3
1763+ ; Height
1764+ ld a , (_CurrentFontProperties.height)
1765+ ld hl , _CurrentFontProperties.spaceAbove
1766+ add a , (hl)
1767+ inc hl
1768+ add a , (hl)
1769+ ret
17681770
17691771
17701772;-------------------------------------------------------------------------------
0 commit comments