' #include ServBold.col #Module CGA_Sprt.CLL /* Version for CGA 320x200, 4 colors. Coded by Wladimir Mutel Optimized by Oleg N. Cher */ subr lMove ( DI SI ) ' Move screen line SI= from to line DI= to. if {DI < 192 then ' if {SI < 192 then ' ... foolsafe ;) {DI + 4 } {SI + 4 } {AX DI & #FE ** => CX ** ** + CX ** ** {DI & 1 $ROR $ROR $ROR + AX {AX SI & #FE ** => CX ** ** + CX ** ** {SI & 1 $ROR $ROR $ROR + AX BX= 2 do 40 {AX $ES: [SI] $StosW {SI + BX } loop ; ; end subr lClr ( DI ) ' Clear screen line DI. if {DI < 192 then ' ... foolsafe ;) {DI + 4 } {AX DI & #FE ** => CX ** ** + CX ** ** {DI & 1 $ROR $ROR $ROR + AX AX= 0 CX= 40 $REP $StosW ; end subr Cls ' Decorative screen clearing. {AX 0 => BX => ttyXY do 17 Run_Delay $ 1 repeat {Al => $ES: [BX] {BX & #3FFF + 17 {BX >= 16384 until Wait_Delay loop end subr ScrollUp ( DX ) ' Scrolling of screen lines UP. BP= 0 DO{ 192 - DX } SI= DX DI= BP lMove BP++ DX++ LOOP repeat DI= BP lClr {BP ++ >= 192 until end subr ScrollDown ( DX ) ' Scrolling of screen lines DOWN. {BP 191 - DX } DX= 191 ' Negative argument! DO{ BP ++ } SI= BP DI= DX lMove BP-- DX-- LOOP repeat DI= DX lClr {DX -- untilS end subr CR { if ttyY = 15 ' Foolsafe ;) then DX=12 ScrollUp else ttyY ++ ttyY ; 0 => ttyX end subr emt22 ( line , pos ) { if pos < 32 then pos => ttyX ; ' Foolsafe ;) if line < 16 then line => ttyY ; end subr Sprite ( X Y Al ) ' Draw CGA sprite Al= n, 16x12 pixels, 4 colors. CX= Y {X ** {Y ** ** ** ** - CX ** ** ** ** + X + 168 } Ah= Ch {AX ** ** => SI ** {SI + AX ** ** + [ Sprites ] } for Cl= 6 {DI $MovsW $MovsW + 8188 $MovsW $MovsW - 8116 } loop end @subr SetGraxMode ' Set graph mode 320å200, 4 colors. AX= 0'4 $Intr #10 ' Returns: AX = undefined. @end @subr SetTextMode ' Set text mode 80å25. AX= 0'3 $Intr #10 ' Returns: AX = undefined. @end @subr PalColor ( Bl ) ' BL = CGA palette: Bh= 1 Ah= #B $Intr #10 ' 0 background, green, red, and brown/yellow; @end ' 1 background, cyan, magenta, and white. @subr BackColor ( Bl ) ' BL = background/border color Bh= 0 Ah= #B $Intr #10 ' (border only in text modes). @end @subr Grax.Init ' Initialize CGA for 320x200x4 graphic. SetGraxMode $RstD PUSH #B800 POP ES ' ES= segment {AX 0 => ttyXY @end @subr Grax.Done ' Done CGA for textmode. ' Ah= 0 $Intr #16 SetTextMode @end : Sprites #incbin bolder.csp ' Add CGA sprites.