From: Alan Cox Date: Mon, 5 Oct 2015 12:43:30 +0000 (+0100) Subject: nc100: draw in the right location X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3468c2d5631884aaabffe9ba36390de60d120c0d;p=FUZIX.git nc100: draw in the right location --- diff --git a/Kernel/platform-nc100/nc100.s b/Kernel/platform-nc100/nc100.s index b3c19660..82b31d8d 100644 --- a/Kernel/platform-nc100/nc100.s +++ b/Kernel/platform-nc100/nc100.s @@ -560,6 +560,27 @@ _cursor_off: jr cursor_do +; +; Turn a co-ordinate pair in DE into an address in DE +; and map the video. Unlike the font version we work in bytes across +; (for NC100, NC200 needs doing) +; +addr_de_pix: + ld a, #0x43 + out (0x11), a + + ld b, d ; save X + ld a, e ; turn Y into a pixel row + sla d ; X is in 0-63, rotate it left twice + sla d + srl a ; multiple by 64 A into DE + rr d ; roll two bits into D pushing the X bits + srl a ; back where they came from + rr d + add #VIDEO_BASEH ; screen start (0x7000 or 0x6000 for NC200) + ld e, d + ld d, a + ret ; ; For NC100 (NC200 needs doing) ; @@ -578,7 +599,7 @@ _video_cmd: ld d,(hl) inc hl inc hl - call addr_de ; turn DE into screen address (HL is kept) + call addr_de_pix ; turn DE into screen address (HL is kept) nextline: push de nextop: