nc100: draw in the right location
authorAlan Cox <alan@linux.intel.com>
Mon, 5 Oct 2015 12:43:30 +0000 (13:43 +0100)
committerAlan Cox <alan@linux.intel.com>
Mon, 5 Oct 2015 12:43:30 +0000 (13:43 +0100)
Kernel/platform-nc100/nc100.s

index b3c1966..82b31d8 100644 (file)
@@ -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: