From: sparky4 Date: Fri, 13 Nov 2015 01:58:33 +0000 (-0600) Subject: xlib going somewhere~ X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=7348fba00dc35dd13e9ab49f4c944a0cbccfa3cc xlib going somewhere~ --- diff --git a/16.exe b/16.exe index 81763d01..55e5c3be 100755 Binary files a/16.exe and b/16.exe differ diff --git a/16/xlib/demo1.exe b/16/xlib/demo1.exe deleted file mode 100755 index 7d8a4d65..00000000 Binary files a/16/xlib/demo1.exe and /dev/null differ diff --git a/16/xlib/demo2.exe b/16/xlib/demo2.exe deleted file mode 100755 index d6dfd068..00000000 Binary files a/16/xlib/demo2.exe and /dev/null differ diff --git a/16/xlib/demo3.exe b/16/xlib/demo3.exe deleted file mode 100755 index ef3a06a2..00000000 Binary files a/16/xlib/demo3.exe and /dev/null differ diff --git a/16/xlib/demo4.exe b/16/xlib/demo4.exe deleted file mode 100755 index 54c567da..00000000 Binary files a/16/xlib/demo4.exe and /dev/null differ diff --git a/16/xlib/demo5.exe b/16/xlib/demo5.exe deleted file mode 100755 index 30993d2f..00000000 Binary files a/16/xlib/demo5.exe and /dev/null differ diff --git a/16/xlib/demo6.exe b/16/xlib/demo6.exe deleted file mode 100755 index 7e26f1f6..00000000 Binary files a/16/xlib/demo6.exe and /dev/null differ diff --git a/16/xlib/demo7.exe b/16/xlib/demo7.exe deleted file mode 100755 index 3762184b..00000000 Binary files a/16/xlib/demo7.exe and /dev/null differ diff --git a/16/xlib/demo8.exe b/16/xlib/demo8.exe deleted file mode 100755 index 98c480e2..00000000 Binary files a/16/xlib/demo8.exe and /dev/null differ diff --git a/16/xlib/makefile b/16/xlib/makefile index cba0dcac..d1ec5db3 100755 --- a/16/xlib/makefile +++ b/16/xlib/makefile @@ -150,6 +150,9 @@ xvsync.$(OBJ) : xvsync.asm# xvsync.inc xlib.inc model.inc xfill.$(OBJ) : xfill.asm# xfill.inc xlib.inc model.inc $(CC) -c $(CFLAGS) xfill.asm# xfill.inc xlib.inc model.inc +xbezier.$(OBJ): xbezier.asm + $(CC) -c $(CFLAGS) xbezier.asm + # #other~ # diff --git a/16/xlib/model.inc b/16/xlib/model.inc index 0aded8e9..f35b3fae 100755 --- a/16/xlib/model.inc +++ b/16/xlib/model.inc @@ -1,20 +1,22 @@ -/*;IFDEF s +IFDEF s ; DISPLAY "XLIB04 Small Model" -; .model small -;ELSE -; IFDEF c + .model small +ELSE + IFDEF c ; DISPLAY "XLIB04 Compact Model" -; .model compact -; ELSE -; IFDEF l + .model compact + ELSE + IFDEF l ; DISPLAY "XLIB04 Large Model" -; .model large -; ELSE + .model large + ELSE + IFDEF h + .model huge + ELSE ; DISPLAY "WARNING: Model was not defined at the command line." ; DISPLAY " Using default small model ie /ds " ; DISPLAY " Include in TASM commandline either /ds, /dc or /dl" -;; .model small -; ENDIF -; ENDIF -;ENDIF -*/ + .model small + ENDIF + ENDIF +ENDIF diff --git a/16/xlib/xbmtools.asm b/16/xlib/xbmtools.asm index f39c9a32..490b2635 100755 --- a/16/xlib/xbmtools.asm +++ b/16/xlib/xbmtools.asm @@ -42,7 +42,7 @@ COMMENT $ $ -LOCALS +.LOCALS .8086 include model.inc diff --git a/16/xlib/xfileio.asm b/16/xlib/xfileio.asm index 40a07775..253e237c 100755 --- a/16/xlib/xfileio.asm +++ b/16/xlib/xfileio.asm @@ -430,4 +430,3 @@ _f_filelength endp end - diff --git a/16/xlib/xlib.inc b/16/xlib/xlib.inc index 3dbfa758..e352f3cf 100755 --- a/16/xlib/xlib.inc +++ b/16/xlib/xlib.inc @@ -19,12 +19,12 @@ ; -;.LOCALS +;.global ;.8086 ; First lets find out what memory model to use - -include model.inc +;.model huge +;include model.inc AC_INDEX equ 03c0h ;Attribute controller index register @@ -162,5 +162,3 @@ WaitNotVsync2: global _VsyncPaletteStart :word global _VsyncPaletteCount :word global _VsyncPaletteBuffer :byte - - diff --git a/16/xlib/xline.asm b/16/xlib/xline.asm index 6c9c5c56..910c1fc9 100755 --- a/16/xlib/xline.asm +++ b/16/xlib/xline.asm @@ -26,9 +26,10 @@ ModeXAddr macro mov dx,[_ScrnLogicalByteWidth] mul dx pop dx - shr bx,2 + shr bx,1 + shr bx,1 add bx,ax - add bx,[PgOffs] + add bx,[bp+14] and cl,3 endm @@ -44,7 +45,7 @@ ModeXAddr macro ; _x_line proc -ARG x1:word,y1:word,x2:word,y2:word,Color:word,PgOffs:word +;ARG x1:word,y1:word,x2:word,y2:word,Color:word,PgOffs:word LOCAL vertincr:word,incr1:word,incr2:word,routine:word=LocalStk push bp ; Set up stack frame mov bp,sp @@ -60,8 +61,8 @@ LOCAL vertincr:word,incr1:word,incr2:word,routine:word=LocalStk ; check for vertical line mov si,[_ScrnLogicalByteWidth] - mov cx,[x2] - sub cx,[x1] + mov cx,[bp+8] + sub cx,[bp+4] jz VertLine ; force x1 < x2 @@ -70,19 +71,19 @@ LOCAL vertincr:word,incr1:word,incr2:word,routine:word=LocalStk neg cx - mov bx,[x2] - xchg bx,[x1] - mov [x2],bx + mov bx,[bp+8] + xchg bx,[bp+4] + mov [bp+8],bx - mov bx,[y2] - xchg bx,[y1] - mov [y2],bx + mov bx,[bp+10] + xchg bx,[bp+6] + mov [bp+10],bx ; calc dy = abs(y2 - y1) L01: - mov bx,[y2] - sub bx,[y1] + mov bx,[bp+10] + sub bx,[bp+6] jnz short skip jmp HorizLine skip: jns L03 @@ -113,14 +114,17 @@ L04: ; calc first pixel address push cx - mov ax,[y1] - mov bx,[x1] + mov ax,[bp+6] + mov bx,[bp+4] ModeXAddr mov di,bx mov al,1 shl al,cl mov ah,al ; duplicate nybble - shl al,4 + shl al,1 + shl al,1 + shl al,1 + shl al,1 add ah,al mov bl,ah pop cx @@ -130,8 +134,8 @@ L04: ; routine for verticle lines VertLine: - mov ax,[y1] - mov bx,[y2] + mov ax,[bp+6] + mov bx,[bp+10] mov cx,bx sub cx,ax jge L31 @@ -140,7 +144,7 @@ VertLine: L31: inc cx - mov bx,[x1] + mov bx,[bp+4] push cx ModeXAddr @@ -149,7 +153,7 @@ L31: mov al,MAP_MASK out dx,ax pop cx - mov ax, word ptr [Color] + mov ax, word ptr [bp+12] ; draw the line @@ -164,15 +168,15 @@ L32: HorizLine: push ds - mov ax,[y1] - mov bx,[x1] + mov ax,[bp+6] + mov bx,[bp+4] ModeXAddr mov di,bx ; set dl = first byte mask mov dl,00fh shl dl,cl - mov cx,[x2] ; set dh = last byte mask + mov cx,[bp+8] ; set dh = last byte mask and cl,3 mov dh,00eh shl dh,cl @@ -180,17 +184,19 @@ HorizLine: ; determine byte offset of first and last pixel in line - mov ax,[x2] - mov bx,[x1] + mov ax,[bp+8] + mov bx,[bp+4] - shr ax,2 ; set ax = last byte column - shr bx,2 ; set bx = first byte column + shr ax,1 ; set ax = last byte column + shr bx,1 ; set bx = first byte column + shr ax,1 ; set ax = last byte column + shr bx,1 ; set bx = first byte column mov cx,ax ; cx = ax - bx sub cx,bx mov ax,dx ; mov end byte masks to ax mov dx,SC_INDEX ; setup dx for VGA outs - mov bx, [Color] + mov bx, [bp+12] ; set pixels in leftmost byte of line @@ -231,7 +237,7 @@ L44: LoSlopeLine: mov al,MAP_MASK - mov bh,byte ptr [Color] + mov bh,byte ptr [bp+12] L10: mov ah,bl @@ -283,7 +289,7 @@ HiSlopeLine: mov al,MAP_MASK L21: out dx,ax push ax - mov ax,[Color] + mov ax,[bp+12] mov es:[di],al pop ax add di,bx @@ -314,4 +320,3 @@ Lexit: _x_line endp end - \ No newline at end of file diff --git a/16/xlib/xmain.asm b/16/xlib/xmain.asm index a8fd4184..cdb174fd 100755 --- a/16/xlib/xmain.asm +++ b/16/xlib/xmain.asm @@ -22,19 +22,18 @@ ; and tripple buffering - Tore Jahn Bastiansen ; (toreba@ifi.uio.no) for the ;----------------------------------------------------------------------- - - include xlib.inc include xmain.inc - .data + _DATA SEGMENT WORD PUBLIC USE16 'DATA' +;.data ; Mode X CRTC register tweaks for various resolutions -LABEL X256Y200 word +X256Y200 LABEL word db 0e3h ; dot clock db 8 ; Number of CRTC Registers to update dw 05f00h ; horz total @@ -49,7 +48,7 @@ LABEL X256Y200 word dw 200 -LABEL X256Y240 word +X256Y240 label word db 0e3h ; dot clock db 16 ; Number of CRTC Registers to update dw 05f00h ; horz total @@ -157,7 +156,7 @@ X376Y282 label word dw 376 dw 282 -LABEL X256Y400 word +X256Y400 label word db 0e3h ; dot clock db 8 ; Number of CRTC Registers to update dw 05f00h ; horz total @@ -173,7 +172,7 @@ LABEL X256Y400 word dw 400 -LABEL X256Y480 word +X256Y480 label word db 0e3h ; dot clock db 16 ; Number of CRTC Registers to update dw 05f00h ; horz total @@ -439,6 +438,9 @@ PARAM_COUNT equ ($-PARAMS) DoubleScanFlag db ? ; Flag to indicate double scanned mode +_DATA ENDS + + .code ;------------------------------------------------------------------------- @@ -459,7 +461,9 @@ SetLogicalScrWidth proc mov ax,bx ; no - set logical width = physical @@ValidLogicalWidth: - shr ax,3 + shr ax,1 + shr ax,1 + shr ax,1 out dx,al ; The EXACT logical pixel width may not have been possible since @@ -472,10 +476,12 @@ SetLogicalScrWidth proc mov [_RightClip],ax ; Set default Right clip column ; screen sub ax,[_ScrnPhysicalByteWidth] ; Calculate and store Max X position - shl ax,2 ; of physical screen in virtual + shl ax,1 ; of physical screen in virtual + shl ax,1 ; of physical screen in virtual mov [_MaxScrollX],ax ; screen in pixels mov ax,bx ; set ax to byte width of virt scrn - shl ax,2 ; convert to pixels + shl ax,1 ; convert to pixels + shl ax,1 ; convert to pixels mov [_ScrnLogicalPixelWidth],ax ; store virt scrn pixel width mov cx,ax ; save ax (return value) @@ -550,7 +556,7 @@ clear_vram endp ; parts adapted from M. Abrash code. ;------------------------------------------------------------------------ _x_set_mode proc - ARG mode:word,logicalscrwidth:word + ;;arg mode:word,logicalscrwidth:word push bp ;preserve caller's stack frame mov bp,sp @@ -565,7 +571,7 @@ _x_set_mode proc mov cx,PARAM_COUNT rep stosb - mov cx,[mode] + mov cx,[BP+4] cmp cx,LAST_X_MODE ; have we selected a valid mode jle @@ValidMode ; Yes ! @@ -657,7 +663,8 @@ _x_set_mode proc mov [_SplitScrnScanLine],ax ; No splitscrn == ; splitscrn=PhysicalscrnHeight mov bx,ax ; Copy width for later use - shr ax,2 ; Convert to byte width + shr ax,1 ; Convert to byte width + shr ax,1 ; Convert to byte width mov [_ScrnPhysicalByteWidth],ax ; Store for later use lodsw ; Load Screen Phys. Height mov [_ScrnPhysicalHeight],ax ; Store for later use @@ -665,7 +672,7 @@ _x_set_mode proc ; Mode X is set, now set the required logical page width. - mov cx,[logicalscrwidth] + mov cx,[BP+6] call SetLogicalScrWidth @@ -687,10 +694,10 @@ _x_set_mode endp ; Written by Themie Gouthas ;---------------------------------------------------------------------- _x_select_default_plane proc -ARG Plane:byte + ;arg Plane:byte push bp mov bp,sp ; set up stack frame - mov cl,byte ptr [Plane] + mov cl,byte ptr [bp+4] ; SELECT WRITE PLANE and cl,011b ;CL = plane @@ -727,7 +734,7 @@ _x_select_default_plane endp ;---------------------------------------------------------------------- _x_set_splitscreen proc - ARG Line:word + ;arg Line:word push bp mov bp,sp ; set up stack frame push si @@ -769,7 +776,7 @@ _x_set_splitscreen proc mov [_PhysicalStartPixelX],ax ; offset within virtual screen mov [_PhysicalStartY],ax mov [_SplitScrnActive],TRUE - mov ax,[Line] + mov ax,[bp+4] jns @@NotNeg ; Check that Split Scrn start scan line is +ve mov ax,0 ; Since -ve set to 0 @@ -804,7 +811,10 @@ _x_set_splitscreen proc mov ah,bh and ah,1 - shl ah,4 + shl ah,1 + shl ah,1 + shl ah,1 + shl ah,1 mov al,OVERFLOW ; Bit 4 of overflow register = Bit 8 of split out dx,al ; screen scan line, inc dx ; So using readability of VGA registers @@ -816,7 +826,9 @@ _x_set_splitscreen proc dec dx mov ah,bh and ah,2 - ror ah,3 + ror ah,1 + ror ah,1 + ror ah,1 mov al,MAX_SCAN_LINE ; Bit 6 of max scan line register = out dx,al ; Bit 9 of split screen scan line inc dx ; As we did before, update the apropriate @@ -846,9 +858,9 @@ _x_set_splitscreen proc mov [_ScrnLogicalHeight],ax ; Save Screen Logical Height cmp ax,[_BottomClip] - jle @@BottomClipOK ; Adjust Clip Rectangle if necessary + jle @@BottomClipOK2 ; Adjust Clip Rectangle if necessary mov [_BottomClip],ax -@@BottomClipOK: +@@BottomClipOK2: sub ax,[_SplitScrnScanLine] ; Update the maximum Y position of mov [_MaxScrollY],ax ; Physical screen in logical screen @@ -875,14 +887,14 @@ _x_set_splitscreen endp ;------------------------------------------------------------------------ _x_page_flip proc - ARG x:word,y:word + ;arg x:word,y:word push bp ;preserve caller's stack frame mov bp,sp ;point to local stack frame push si - mov si,[x] + mov si,[bp+4] mov ax,[_ScrnLogicalByteWidth] ; Calculate Offset increment - mov cx,[y] + mov cx,[bp+6] mul cx ; for Y cmp [_DoubleBufferActive],TRUE ; Do we have double buffering ? je @@DoubleBuffer @@ -931,14 +943,14 @@ _x_page_flip endp ; Parts addapted from M. Abrash code published in DDJ Mag. ;------------------------------------------------------------------------ _x_set_start_addr proc - ARG x:word,y:word + ;arg x:word,y:word push bp mov bp,sp push si - mov si,[x] + mov si,[bp+4] mov ax,[_ScrnLogicalByteWidth] ; Calculate Offset increment - mov cx,[y] ; for Y + mov cx,[bp+6] ; for Y mul cx cmp [_DoubleBufferActive],TRUE ; Do we have double buffering ? je @@PageResolution @@ -958,7 +970,8 @@ PageFlipEntry2: @@AddColumn: mov cx,si - shr cx,2 + shr cx,1 + shr cx,1 mov [_PhysicalStartByteX],cx add ax,cx ; add the column offset for X mov bh,al ; setup CRTC start addr regs and @@ -1052,14 +1065,14 @@ _x_hide_splitscreen proc cmp [_SplitScrnActive],TRUE je @@SplitScreenEnabled -@@error: +@@error0: mov [_ErrorValue],ERROR pop bp ret @@SplitScreenEnabled: cmp [_CurrXMode],4 ; Do nothing for Modes > 2 - jg @@error + jg @@error0 mov bx,[_ScrnPhysicalHeight] mov ax,[_ScrnLogicalHeight] @@ -1069,10 +1082,10 @@ _x_hide_splitscreen proc mov [_SplitScrnVisibleHeight],ax or [DoubleScanFlag],0 - jz @@NotDoubleScanned + jz @@NotDoubleScanned0 shl bx,1 dec bx -@@NotDoubleScanned: +@@NotDoubleScanned0: ;mov cl,[DoubleScanFlag] ; Compensate for double scanned modes ;shl bx,cl @@ -1086,7 +1099,10 @@ _x_hide_splitscreen proc mov ah,bh and ah,1 - shl ah,4 + shl ah,1 + shl ah,1 + shl ah,1 + shl ah,1 mov al,OVERFLOW ; Bit 4 of overflow register = Bit 8 of split out dx,al ; screen scan line, inc dx ; So using readability of VGA registers @@ -1098,7 +1114,9 @@ _x_hide_splitscreen proc dec dx mov ah,bh and ah,2 - ror ah,3 + ror ah,1 + ror ah,1 + ror ah,1 mov al,MAX_SCAN_LINE ; Bit 6 of max scan line register = out dx,al ; Bit 9 of split screen scan line inc dx ; As we did before, update the apropriate @@ -1108,7 +1126,7 @@ _x_hide_splitscreen proc out dx,al sti ; Registers are set, so interrupts are safe -@@done: +@@done0: mov [_ErrorValue],OK pop bp @@ -1140,16 +1158,16 @@ _x_show_splitscreen proc mov bp,sp cmp [_SplitScrnActive],TRUE - je @@SplitScreenEnabled + je @@SplitScreenEnabled0 -@@error: +@@error1: mov [_ErrorValue],ERROR pop bp ret -@@SplitScreenEnabled: +@@SplitScreenEnabled0: cmp [_CurrXMode],4 ; Do nothing for Modes > 2 - jg @@error + jg @@error1 mov bx,[_SplitScrnScanLine] mov ax,[_ScrnLogicalHeight] ; Update Max Scroll Y @@ -1161,10 +1179,10 @@ _x_show_splitscreen proc mov [_SplitScrnVisibleHeight],ax or [DoubleScanFlag],0 - jz @@NotDoubleScanned + jz @@NotDoubleScanned1 shl bx,1 dec bx -@@NotDoubleScanned: +@@NotDoubleScanned1: ;mov cl,[DoubleScanFlag] ; Compensate for double scanned modes ;shl bx,cl WaitVsyncStart ; wait for vertical retrace @@ -1177,7 +1195,10 @@ _x_show_splitscreen proc mov ah,bh and ah,1 - shl ah,4 + shl ah,1 + shl ah,1 + shl ah,1 + shl ah,1 mov al,OVERFLOW ; Bit 4 of overflow register = Bit 8 of split out dx,al ; screen scan line, inc dx ; So using readability of VGA registers @@ -1189,7 +1210,9 @@ _x_show_splitscreen proc dec dx mov ah,bh and ah,2 - ror ah,3 + ror ah,1 + ror ah,1 + ror ah,1 mov al,MAX_SCAN_LINE ; Bit 6 of max scan line register = out dx,al ; Bit 9 of split screen scan line inc dx ; As we did before, update the apropriate @@ -1199,7 +1222,7 @@ _x_show_splitscreen proc out dx,al sti ; Registers are set, so interrupts are safe -@@Done: +@@Done1: mov [_ErrorValue],0 pop bp ret @@ -1229,24 +1252,24 @@ _x_show_splitscreen endp _x_adjust_splitscreen proc - ARG ScanLine + ;arg ScanLine push bp mov bp,sp cmp [_SplitScrnActive],TRUE - je @@SplitScreenEnabled + je @@SplitScreenEnabled1 -@@error: +@@error2: mov [_ErrorValue],ERROR pop bp ret -@@SplitScreenEnabled: +@@SplitScreenEnabled1: cmp [_CurrXMode],4 ; Do nothing for Modes > 2 - jg @@error - mov bx,[ScanLine] ; Is the required starting scan line + jg @@error2 + mov bx,[bp+4] ; Is the required starting scan line cmp bx,[_SplitScrnScanLine] ; valid ? - js @@Done ; No - Then do nothing + js @@Done2 ; No - Then do nothing @@ValidScanLine: @@ -1259,10 +1282,10 @@ _x_adjust_splitscreen proc mov [_SplitScrnVisibleHeight],ax or [DoubleScanFlag],0 - jz @@NotDoubleScanned + jz @@NotDoubleScanned2 shl bx,1 dec bx -@@NotDoubleScanned: +@@NotDoubleScanned2: ;mov cl,[DoubleScanFlag] ; Compensate for double scanned modes ;shl bx,cl @@ -1277,7 +1300,10 @@ _x_adjust_splitscreen proc mov ah,bh and ah,1 - shl ah,4 + shl ah,1 + shl ah,1 + shl ah,1 + shl ah,1 mov al,OVERFLOW ; Bit 4 of overflow register = Bit 8 of split out dx,al ; screen scan line, inc dx ; So using readability of VGA registers @@ -1289,7 +1315,9 @@ _x_adjust_splitscreen proc dec dx mov ah,bh and ah,2 - ror ah,3 + ror ah,1 + ror ah,1 + ror ah,1 mov al,MAX_SCAN_LINE ; Bit 6 of max scan line register = out dx,al ; Bit 9 of split screen scan line inc dx ; As we did before, update the apropriate @@ -1298,7 +1326,7 @@ _x_adjust_splitscreen proc or al,ah out dx,al sti ; Registers are set, so interrupts are safe -@@Done: +@@Done2: mov [_ErrorValue],OK pop bp ret @@ -1330,7 +1358,7 @@ _x_adjust_splitscreen endp _x_set_doublebuffer proc - ARG PageHeight:word + ;arg PageHeight:word push bp mov bp,sp @@ -1346,7 +1374,7 @@ _x_set_doublebuffer proc mov ax,[_ScrnLogicalHeight] ; Set Maximum D.B. Page height to shr ax,1 ; _ScrnLogicalHeight / 2 - mov bx,[PageHeight] ; Is the require D.B. Page Height + mov bx,[bp+4] ; Is the require D.B. Page Height cmp ax,bx ; > the Maximum D.B. Page Height ? js @@InvalidHeight ; no - jump @@ -1357,9 +1385,9 @@ _x_set_doublebuffer proc mov [_ScrnLogicalHeight],ax ; Update logical screen height to ; reflect the height of a D.B. page cmp ax,[_BottomClip] - jle @@BottomClipOK ; Adjust Clip Rectangle if necessary + jle @@BottomClipOK0 ; Adjust Clip Rectangle if necessary mov [_BottomClip],ax -@@BottomClipOK: +@@BottomClipOK0: push ax mul [_ScrnLogicalByteWidth] ; Calculate the offset of the second mov cx,ax ; D.B. Page in video ram @@ -1410,40 +1438,40 @@ _x_set_doublebuffer endp ;------------------------------------------------------------------------ _x_set_tripplebuffer proc - ARG PageHeight:word + ;arg PageHeight:word push bp mov bp,sp cmp [_DoubleBufferActive],0 - jne @@Error + jne @@Error3 cmp [_TrippleBufferActive],0 - je @@OkToContinue -@@Error: + je @@OkToContinue3 +@@Error3: mov [_ErrorValue],ERROR pop bp ret -@@OkToContinue: +@@OkToContinue3: mov [_VisiblePageIdx],0 ; Set visible Page to 0 mov ax,[_ScrnLogicalHeight] ; Set Maximum T.B. Page height to mov bx,3 xor dx,dx idiv bx ; _ScrnLogicalHeight / 3 - mov bx,[PageHeight] ; Is the require T.B. Page Height + mov bx,[bp+4] ; Is the require T.B. Page Height cmp ax,bx ; > the Maximum T.B. Page Height ? - js @@InvalidHeight ; no - jump + js @@InvalidHeight0 ; no - jump mov ax,bx ; yes - Set the T.B. Page height to ; to the maximum allowed. -@@InvalidHeight: +@@InvalidHeight0: mov [_ScrnLogicalHeight],ax ; Update logical screen height to ; reflect the height of a T.B. page cmp ax,[_BottomClip] - jle @@BottomClipOK ; Adjust Clip Rectangle if necessary + jle @@BottomClipOK1 ; Adjust Clip Rectangle if necessary mov [_BottomClip],ax -@@BottomClipOK: +@@BottomClipOK1: push ax mul [_ScrnLogicalByteWidth] ; Calculate the offset of the second mov cx,ax ; D.B. Page in video ram @@ -1489,19 +1517,19 @@ _x_set_tripplebuffer endp ;------------------------------------------------------------------------ _x_set_cliprect proc -ARG left:word,top:word,right:word,bottom:word +;arg left:word,top:word,right:word,bottom:word push bp mov bp,sp - mov ax,[left] - mov bx,[right] + mov ax,[bp+4] + mov bx,[bp+8] cmp bx,ax jns @@CorrectXOrder xchg bx,ax @@CorrectXOrder: mov [_LeftClip],ax mov [_RightClip],bx - mov ax,[top] - mov bx,[bottom] + mov ax,[bp+6] + mov bx,[bp+10] cmp bx,ax jns @@CorrectYOrder xchg bx,ax @@ -1536,4 +1564,4 @@ _x_wait_vsync proc _x_wait_vsync endp - end +end diff --git a/16/xlib/xmain.inc b/16/xlib/xmain.inc index 44b40fc2..4b1f4410 100755 --- a/16/xlib/xmain.inc +++ b/16/xlib/xmain.inc @@ -26,6 +26,6 @@ global _x_show_splitscreen :proc global _x_adjust_splitscreen :proc global _x_set_doublebuffer :proc - global _x_set_tripplebuffer :proc + global _x_set_tripplebuffer :proc global _x_set_cliprect :proc - global _x_wait_vsync :proc \ No newline at end of file + global _x_wait_vsync :proc diff --git a/16/xlib/xpoint.asm b/16/xlib/xpoint.asm index f6bed961..7b7dc910 100755 --- a/16/xlib/xpoint.asm +++ b/16/xlib/xpoint.asm @@ -34,21 +34,21 @@ include xpoint.inc ; _x_put_pix proc - ARG X:word,Y:word,PgOfs:word,Color:word + ;ARG X:word,Y:word,PgOfs:word,Color:word push bp ;preserve caller's stack frame mov bp,sp ;point to local stack frame mov ax,[_ScrnLogicalByteWidth] - mul [Y] ;offset of pixel's scan line in page - mov bx,[X] + mul [BP+6] ;offset of pixel's scan line in page + mov bx,[BP+4] shr bx,1 ;X/4 = offset of pixel in scan line shr bx,1 ;X/4 = offset of pixel in scan line add bx,ax ;offset of pixel in page - add bx,[PgOfs] ;offset of pixel in display memory + add bx,[BP+8] ;offset of pixel in display memory mov ax,SCREEN_SEG mov es,ax ;point ES:BX to the pixel's address - mov cl,byte ptr [X] + mov cl,byte ptr [BP+4] and cl,011b ;CL = pixel's plane mov ax,0100h + MAP_MASK ;AL = index in SC of Map Mask reg shl ah,cl ;set only the bit for the pixel's @@ -56,7 +56,7 @@ _x_put_pix proc mov dx,SC_INDEX ;set the Map Mask to enable only the out dx,ax ; pixel's plane - mov al,byte ptr [Color] + mov al,byte ptr [BP+10] mov es:[bx],al ;draw the pixel in the desired color pop bp ;restore caller's stack frame @@ -74,21 +74,21 @@ _x_put_pix endp _x_get_pix proc - ARG x:word,y:word,PageBase:word + ;ARG x:word,y:word,PageBase:word push bp ;preserve caller's stack frame mov bp,sp ;point to local stack frame mov ax,[_ScrnLogicalByteWidth] - mul [Y] ;offset of pixel's scan line in page - mov bx,[X] + mul [bp+6] ;offset of pixel's scan line in page + mov bx,[bp+4] shr bx,1 shr bx,1 ;X/4 = offset of pixel in scan line add bx,ax ;offset of pixel in page - add bx,[PageBase] ;offset of pixel in display memory + add bx,[bp+8] ;offset of pixel in display memory mov ax,SCREEN_SEG mov es,ax ;point ES:BX to the pixel's address - mov ah,byte ptr [X] + mov ah,byte ptr [bp+4] and ah,011b ;AH = pixel's plane mov al,READ_MAP ;AL = index in GC of the Read Map reg mov dx,GC_INDEX ;set the Read Map to read the pixel's diff --git a/exmmtest.exe b/exmmtest.exe index ddb08bfb..07856205 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/makefile b/makefile index 6c388c71..5e7828c6 100755 --- a/makefile +++ b/makefile @@ -416,3 +416,9 @@ updatelibs: .symbolic cd $(JSMNLIB) git pull cd ../../../ + +xlib: .symbolic + @cd 16/xlib + @wmake clean + @wmake all + cd ../../ diff --git a/planrpcx.exe b/planrpcx.exe index 6cd69f00..8d261568 100755 Binary files a/planrpcx.exe and b/planrpcx.exe differ diff --git a/scroll.exe b/scroll.exe index f3bebb2c..b0718bab 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/test.exe b/test.exe index 6e5281c3..31afc8ff 100755 Binary files a/test.exe and b/test.exe differ