.Z80 ;-------------------------------------------------------------------------- ; ; This patch adapts WordStar version 4 so that it will automatically ; set the screen height and width from the values in the SCB (System ; Control Block) when running on CP/M 3.1 (a.k.a. CP/M Plus). ; ; This patch is harmless on CP/M 2.2. ; ; z80asm cpm3ws4/h ; save ; zsid ws.com ; icpm3ws4.hex ; r ; g0 ; ws.com ; y ; 0100 ; 1B7F ; ; Jon Saxton August 2011 ; ;-------------------------------------------------------------------------- hite equ 031Fh wid equ 0320h inisub equ 03BBh morpat equ 045Bh extra equ 0896h cpmVer equ 12 scbAcc equ 49 bdos equ 5 org inisub jp extra org extra ld c, cpmVer ; CP/M "get version function" call bdos cp 31h ; CP/M Plus? ret c ; Skip if not ld c,scbAcc ; SCB access function ld de,scbpb ; Pre-conditioned for screen height call bdos ; Result comes back in A and L inc a ; Adjust ld (hite),a ; Save screen height ld hl,scbpb ; Adjust SCB parameter block to ld (hl),1Ah ; request screen width ex de,hl ; BDOS expects pointer in DE ld c,scbAcc call bdos inc a ld (wid),a ; Store screen width ret scbpb: defb 1Ch,0,0,0 start: defw 0269h end