#include "asmyt.h" // __asm{ // PUBLIC C plzline, C setplzparas, C psini, C lsini4, C lsini16 // // LABEL psini BYTE // INCLUDE 'psini.inc' // ; db 16384 dup(?) // // LABEL lsini4 WORD // INCLUDE 'lsini4.inc' // ; db 16384 dup(?) // // LABEL lsini16 WORD // INCLUDE 'lsini16.inc' // ; db 16384 dup(?) // } word anSelfModifyOffsets[5*84]; //int ccc; void lsini4_WriteWord(nIndex, nValue) { word nByteOffset = lsini4_GetOffset() + (nIndex * 2); psini_WriteWord(nByteOffset, nValue); } void lsini16_WriteWord(word nIndex, word nValue) { word nByteOffset = lsini16_GetOffset() + (nIndex * 2); psini_WriteWord(nByteOffset, nValue); } void anSelfModifyOffsets_WriteWord(word nOffset, word nValue) { anSelfModifyOffsets[nOffset] = nValue; } word set_plzstart(word start) { __asm{ mov dx, 3d4h mov al, 18h ; linecompare mov ah, [Byte PTR start] out dx, ax mov al, 07h mov ah, [Byte PTR start+1] shl ah, 1d shl ah, 1d shl ah, 1d shl ah, 1d and ah, 10h or ah, 0fh out dx, ax ; 8th bit } return start; } /* int plzline(int y, int vseg) { // vseg represented a segment, so multiply by sixteen (shift left by 4) // to convert into an offset. var nVgaYOffset = vseg * 16; var cccTable = [ 3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12,19,18,17,16,23,22,21,20,27,26,25,24,31,30,29,28,35,34,33,32,39,38,37,36,43,42,41,40,47,46,45,44,51,50,49,48,55,54,53,52,59,58,57,56,63,62,61,60,67,66,65,64,71,70,69,68,75,74,73,72,79,78,77,76,83,82,81,80 ]; var nCount = 84; var ah = 0; var al = 0; var eax = 0; for (var nIndex = 0; nIndex < nCount; nIndex++) { var ccc = cccTable[nIndex]; if ((ccc & 1) == 1) { var nByteOffset = 0; var bx = 0; nByteOffset = (y * 2) + anSelfModifyOffsets_ReadWord((2 * 84) + ccc); nByteOffset &= 0xFFFF; bx = psini_ReadWord(nByteOffset); nByteOffset = bx + anSelfModifyOffsets_ReadWord((1 * 84) + ccc); nByteOffset &= 0xFFFF; ah = psini_ReadByte(nByteOffset); nByteOffset = (y * 2) + anSelfModifyOffsets_ReadWord((4 * 84) + ccc); nByteOffset &= 0xFFFF; bx = psini_ReadWord(nByteOffset); nByteOffset = bx + (y * 2) + anSelfModifyOffsets_ReadWord((3 * 84) + ccc); nByteOffset &= 0xFFFF; ah += psini_ReadByte(nByteOffset); ah &= 0xFF; } else { var nByteOffset = 0; var bx = 0; nByteOffset = (y * 2) + anSelfModifyOffsets_ReadWord((2 * 84) + ccc); nByteOffset &= 0xFFFF; bx = psini_ReadWord(nByteOffset); nByteOffset = bx + anSelfModifyOffsets_ReadWord((1 * 84) + ccc); nByteOffset &= 0xFFFF; al = psini_ReadByte(nByteOffset); nByteOffset = (y * 2) + anSelfModifyOffsets_ReadWord((4 * 84) + ccc); nByteOffset &= 0xFFFF; bx = psini_ReadWord(nByteOffset); nByteOffset = bx + (y * 2) + anSelfModifyOffsets_ReadWord((3 * 84) + ccc); nByteOffset &= 0xFFFF; al += psini_ReadByte(nByteOffset); al &= 0xFF; } if ((ccc & 3) == 2) { eax = (ah << 8) | (al << 0); eax <<= 16; } if ((ccc & 3) == 0) { eax |= (ah << 8) | (al << 0); VGA_WriteDword(nVgaYOffset + ccc, eax); } } return 0; } */ int setplzparas(int c1, int c2, int c3, int c4) { // static word psini; // static word lsini4; // static word lsini16; /* __asm{ psini WORD .LABEL 'psini.inc' INCLUDE lsini4 WORD .LABEL 'lsini4.inc' INCLUDE lsini16 WORD .LABEL 'lsini16.inc' INCLUDE IRP ccc, <0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83> mov ax, [c1] add ax, OFFSET psini+ccc*8 mov [word (cs:lc1_&ccc)], ax mov ax, [c2] shl ax, 1d add ax, OFFSET lsini16-ccc*8+80*8 mov [word (cs:lc2_&ccc)], ax mov ax, [c3] add ax, OFFSET psini-ccc*4+80*4 mov [word (cs:lc3_&ccc)], ax mov ax, [c4] shl ax, 1d add ax, OFFSET lsini4+ccc*32 mov [word (cs:lc4_&ccc)], ax ENDM ret }*/ word psiniOffset = 0; word lsini16Offset = lsini16_GetOffset(); word lsini4Offset = lsini4_GetOffset(); word ccc; word lc1, lc2, lc3, lc4; for (ccc=0; ccc < 84; ccc++) { word lc1 = c1 + psiniOffset + (ccc * 8); lc1 &= 0xFFFF; anSelfModifyOffsets_WriteWord((1 * 84) + ccc, lc1); lc2 = (c2 * 2) + lsini16Offset - (ccc * 8) + (80 * 8); lc2 &= 0xFFFF; anSelfModifyOffsets_WriteWord((2 * 84) + ccc, lc2); lc3 = c3 + psiniOffset - (ccc * 4) + (80 * 4); lc3 &= 0xFFFF; anSelfModifyOffsets_WriteWord((3 * 84) + ccc, lc3); lc4 = (c4 * 2) + lsini4Offset + (ccc * 32); lc4 &= 0xFFFF; anSelfModifyOffsets_WriteWord((4 * 84) + ccc, lc4); } return 0; }