tickcount   = $39       ;4
 
 screenrows = (224/8)
-charsperline = (512/8)
-xsize = charsperline
+charsperline = 61
 
 CH_HLINE = 7
 CH_VLINE = 7
 
 #  define CLK_TCK               50      /* POSIX */
 #  define CLOCKS_PER_SEC        50      /* ANSI */
 #elif defined(__PCE__)
-/* FIXME: we likely need to read it at runtime */
-#  define CLK_TCK               50      /* POSIX */
-#  define CLOCKS_PER_SEC        50      /* ANSI */
+#  define CLK_TCK               60      /* POSIX */
+#  define CLOCKS_PER_SEC        60      /* ANSI */
 #elif  defined(__GEOS__)
 #  define CLK_TCK               1       /* POSIX */
 #  define CLOCKS_PER_SEC        1       /* ANSI */
 
--- /dev/null
+;
+; Screen size variables
+;
+                .include "pce.inc"
+
+                .export screensize
+screensize:
+                ldx     xsize
+                ldy     ysize
+                rts
+
+; FIXME: changing the video mode allows for different screen sizes
+
+.rodata
+                .export xsize, ysize
+
+xsize:          .byte charsperline
+ysize:          .byte screenrows
 
 ;
 ;----------------------------------------------------------------------------
 
-                .importzp ptr1
+                .importzp ptr1, tmp1
 conio_init:
                 ; Load font
                 st0     #VDC_MAWR
                 sta     ptr1+1
 
                 st0     #VDC_VWR        ; VWR
+
+                lda     #0
+                sta     tmp1
+                jsr     copy
+
+                lda     #<font
+                sta     ptr1
+                lda     #>font
+                sta     ptr1+1
+
+                lda     #$ff
+                sta     tmp1
+                jsr     copy
+
+
+                ldx     #0
+                stx     BGCOLOR
+                inx
+                stx     CHARCOLOR
+
+
+                rts
+
+copy:
                 ldy     #$80            ; 128 chars
 charloop:       ldx     #$08            ; 8 bytes/char
 lineloop:
                 lda     (ptr1)
+                eor     tmp1
                 sta     a:VDC_DATA_LO     ; bitplane 0
                 stz     a:VDC_DATA_HI     ; bitplane 1
 
                 dey
                 bne     charloop        ; next character
 
-                ldx     #0
-                stx     BGCOLOR
-                inx
-                stx     CHARCOLOR
-
-
                 rts
 
                 .rodata
 
                 .export newline, plot
                 .import popa, _gotoxy
                 .import PLOT
+                .import xsize
 
                 .importzp tmp3,tmp4
 
 advance:
                 ldy     CURS_X
                 iny
-                cpy     #xsize
+                cpy     xsize
                 bne     L3
                 jsr     newline         ; new line
                 ldy     #0              ; + cr
 
  - the masks for buttons may be wrong.
  - 6 button gamepads are different and need slightly different code
 
-revers() is a dummy function, actual reverse output is not supported yet
-
 some graphical petscii chars should get added to the charset
 
 interruptor support in crt0 (and cfg) is missing
 - clock() should be hooked to a VBL interrupt
 
-conio lacks support for different screen sizes, which could be used with
-different video modes
-
 --------------------------------------------------------------------------------
 
 a good emulator to use for PC-Engine is "mednafen" (mednafen.sourceforge.net)
 
 
-; FIXME: actual revers output is not supported yet
+                .include "pce.inc"
 
-            .export _revers
-_revers:
-            lda #0
-            rts
+                .export _revers
+
+.proc   _revers
+
+                ldx     #$00                    ; Assume revers off
+                tay                                     ; Test onoff
+                beq     L1                      ; Jump if off
+                ldx     #$80                    ; Load on value
+                ldy     #$00                    ; Assume old value is zero
+L1:             lda     RVS                     ; Load old value
+                stx     RVS                     ; Set new value
+                beq     L2                      ; Jump if old value zero
+                iny                             ; Make old value = 1
+L2:             ldx     #$00                    ; Load high byte of result
+                tya                             ; Load low byte, set CC
+                rts
+
+.endproc
 
 ;-------------------------------------------------------------------------------
 ; force the init constructor to be imported
 
+++ /dev/null
-;
-; Screen size variables
-;
-
-                .export _screensize
-_screensize:
-                ldx     xsize
-                ldy     ysize
-                rts
-
-; FIXME: changing the video mode allows for different screen sizes
-
-.rodata
-                .export xsize, ysize
-
-xsize:          .byte 64
-ysize:          .byte 28
 
     int i, j;
     clock_t clk;
     char *p;
+    unsigned char xsize, ysize, n;
 
     joy_install(&joy_static_stddrv);
 
     clrscr();
+    screensize(&xsize, &ysize);
 
     cputs("hello world");
     cputsxy(0, 2, "colors:" );
         );
     }
 
+    gotoxy(0,ysize - 1);
+    for (i = 0; i < xsize; ++i) {
+        cputc('0' + i % 10);
+    }
+
+    gotoxy(0,ysize - 2 - ((256 + xsize) / xsize));
+    for (i = 0; i < xsize; ++i) {
+        cputc('0' + i % 10);
+    }
+    for (i = 0; i < (xsize * 5); ++i) {
+        cputc('#');
+    }
+    gotoxy(0,ysize - 1 - ((256 + xsize) / xsize));
+    for (i = 0; i < 256; ++i) {
+        if ((i != '\n') && (i != '\r')) {
+            cputc(i);
+        }
+    }
+
     i = get_tv();
     gotoxy(30,0);
     cputs("TV Mode: ");
             cputs("OTHER");
             break;
     }
+    cprintf(" %dx%d", xsize, ysize);
 
     for(;;) {
         gotoxy(13,4);
                      (j & joy_masks[JOY_FIRE])?  " fire " : " ---- ",
                      (j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- ");
         }
+
+        gotoxy(xsize - 10, 3);
+        j = (n >> 5) & 1;
+        revers(j);
+        cputc(j ? 'R' : ' ');
+        cputs(" revers");
+        revers(0);
+
         waitvblank();
+        ++n;
     }
     for(;;);
 }