]> 4ch.mooo.com Git - 16.git/commitdiff
replace inline asm with _fmemcpy to copy ROM font char.
authorJonathan Campbell <jonathan@castus.tv>
Thu, 21 Apr 2016 13:31:23 +0000 (06:31 -0700)
committerJonathan Campbell <jonathan@castus.tv>
Thu, 21 Apr 2016 13:31:23 +0000 (06:31 -0700)
add reminder that it might be faster for modexDrawChar to point
directly at ROM font char.

the reason for replacing the inline assembly is that the original
code acted without saving/restoring CPU registers that the C compiler
optimization stage assumes holds results from previous C compiler
generated code. corruptiong the optimizer's expectations is the reason
why all code using modex (and assuming things about DS and ES) is the
reason all game code was blowing up. this fix makes things stable again.

pcx2vrl
pcxsscut
src/lib/modex16.c
vrl2vrs
vrsdump

diff --git a/pcx2vrl b/pcx2vrl
index 3d9ac6e6d0e4fe19bb8f1962de5fd02253dea7be..06179c758ee3353a54ef7bc76b2422c342d53dd7 100755 (executable)
Binary files a/pcx2vrl and b/pcx2vrl differ
index d743ac3b8ac58a73b3cb2380e2367aee9b167169..2ce56d285d26ddb8a30e5f7bf2839df2bde1fa75 100755 (executable)
Binary files a/pcxsscut and b/pcxsscut differ
index 79a03cf3d9f50704d36a19a6190701c292d760db..20c468e2372a2750bd37b33a977ce93b26eecd9c 100755 (executable)
@@ -903,23 +903,11 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons
                y += 8;\r
                continue;\r
        }\r
-       //load the letter 'A'\r
-       __asm {\r
-               MOV DI, addr\r
-               MOV SI, o\r
-               MOV ES, s\r
-               SUB AH, AH\r
-               MOV AL, c       ; the letter\r
-               MOV CX, w\r
-               MUL CX\r
-               ADD SI, AX      ;the address of charcter\r
-       L1:     MOV AX, ES:SI\r
-               MOV DS:DI, AX\r
-               INC SI\r
-               INC DI\r
-               DEC CX\r
-               JNZ L1\r
-       }\r
+\r
+       // load the character into romFontsData.l\r
+       // no need for inline assembly!\r
+       // NTS: It might even be faster to just let the modexDrawChar point directly at ROM font than to copy per char! --J.C.\r
+               _fmemcpy(romFontsData.l,MK_FP(s,o)/*ROM font location*/,w/*char size*/);\r
                modexDrawChar(page, x_draw/*for mode X planar use*/, t, col, bgcol, addrr);\r
                x_draw += 8; /* track X for edge of screen */\r
                addrr += 2; /* move 8 pixels over (2 x 4 planar pixels per byte) */\r
diff --git a/vrl2vrs b/vrl2vrs
index acdd4bda2f0dd8772cdce97a19b6c906e4e09f8e..cee2d1d5ec2093825ded51e0e6c9b8b836e38ee9 100755 (executable)
Binary files a/vrl2vrs and b/vrl2vrs differ
diff --git a/vrsdump b/vrsdump
index 8ba0497deb819d75caeef21a3a0d4086b394845b..a75a903a84ae3d98973e3aecab4a6c08fce8a764 100755 (executable)
Binary files a/vrsdump and b/vrsdump differ