diff --git a/libs/piloadc/piloadc.asm b/libs/piloadc/piloadc.asm new file mode 100644 index 00000000..fcaa0830 --- /dev/null +++ b/libs/piloadc/piloadc.asm @@ -0,0 +1,1169 @@ +; *Not* the original file, but an edit to turn it into an includable slice. +; Changes include: +; * removal of the segment declarations (for obvious reasons) +; * no segment prefixes in the constant macros (and instead on every single +; reference to them), as TASM somehow parses these as duplicated definitions +; (???), resulting in a "symbol already defined elsewhere" error +; * the "piloadc_" prefix on constants +; * the @@ prefix on function parameters +; * "rep segcs movsw" being spelled out to what it's actually supposed to mean +; (movs word ptr es:[di], word ptr cs:[si]) +; * the ID check being changed from 'iP' to 'NZ' (lol ZUN) +; * word alignment at the end of the file + +;////////////////////////////////////////////////////////////////////////////// +; +; Pi 16色 グラフィック・ローダ 1990 やなぎさわ +; 1991-3 電脳科学研究所/BERO +; +;////////////////////////////////////////////////////////////////////////////// +line = 1280 ;最大横幅 +lin = 4 +comment | +Cからの利用 + int PiLoad(char *name,int buff,int Size,int X,int Y,int tone,int option) + +PASCALからの利用 + functuon PiLoad( name:string; buff,Size,X,Y,tone,option:integer):integer; + +Assemblerからの利用 + piload0 proc near + es:dx = name(asciz) + ds:0 = buff + si = size + bx = x + cx = y + al = tone + ah = option + + 引数 + name ファイル名 + buff バッファのセグメント + Size バッファのサイズ + X 表示アドレスのX座標 + Y 表示アドレスのY座標 + tone トーン(1~100%) + option オプション(下記のビットで指定)通常は15(01111b) + (lsb)0 .. パレット設定 する/しない = 1/0 + 1 .. 常駐パレット設定 する/しない = 1/0 + 2 .. コメント表示 する/しない = 1/0 + 3 .. 画面設定 する/しない = 1/0 + (VRAMのON,400/200line設定) + 4 .. ノート用パレット する/しない = 1/0 + 5 .. スクロールロード する/しない = 1/0 + 6 .. 透明色利用 する/しない = 1/0 + + 戻り値 + 0 正常終了 + -8 バッファが足りない + -31 Piではない + -32 サポートされていない + 他 エラー(MSDOSのDOSコールエラー参照) + +| + +shl1 macro reg + add reg,reg + endm +rcl1 macro reg + adc reg,reg + endm + +; out cy=bit +get1bit macro n + dec dh + jz gb0&n +gb1&n: shl1 dl + endm + +bitsub macro n +gb0&n: + mov dl,[bx] + inc bx + mov dh,8 +; cmp bx,buffend + db 81h,0fbh +gw&n dw ? + jnz gb1&n + call fread + jmp short gb1&n + endm + +piloadc_coltbl = 0 +piloadc_PaletteBuff = 100h +piloadc_x_pos = word ptr [130h] +piloadc_y_pos = word ptr [132h] +piloadc_x_wid = word ptr [134h] +piloadc_y_wid = word ptr [136h] +piloadc_tone = byte ptr [138h] +piloadc_option = byte ptr [139h] +piloadc_tcol = byte ptr [13ah] +piloadc_flg800 = byte ptr [13bh] +piloadc_line4 = word ptr [13ch] +piloadc_vadr = word ptr [13eh] +piloadc_fhandle = word ptr [140h] +piloadc_bufbgn = word ptr [142h] +piloadc_bufend = word ptr [144h] +piloadc_bufsize = word ptr [146h] +piloadc_yscroll = word ptr [148h] +piloadc_y_wid2 = word ptr [14ah] +piloadc_x_wid2 = word ptr [14ch] +;piloadc_bfseg = word ptr [14eh] +piloadc_tonetbl = 150h +piloadc_gbuff = 160h +piloadc_buffer = 160h+line*(lin+2) +piloadc_parasize = piloadc_buffer + + locals +dftpal db 0,0,0, 0,0,07h, 7h,0,0, 7h,0,7h + db 0,7h,0, 0,7h,7h, 7h,7h,0, 7h,7h,7h + db 0,0,0, 0,0,0fh, 0fh,0,0, 0fh,0,0fh + db 0,0fh,0,0,0fh,0fh, 0fh,0fh,0, 0fh,0fh,0fh +spreg dw ? +dsseg dw ? + + public PiLoad,ToneSet +PiLoad proc near +@@opt = word ptr [bp+4] +@@ton = word ptr [bp+6] +@@y = word ptr [bp+8] +@@x = word ptr [bp+10] +@@bufsiz = word ptr [bp+12] +@@buf = dword ptr [bp+14] +@@nam = dword ptr [bp+18] + push bp + mov bp,sp + push ds + lds dx,@@nam + mov ax,word ptr @@buf + add ax,15 + shr ax,4 + add ax,word ptr @@buf+2 + mov es,ax + cld + mov si,dx + xor dx,dx + mov di,dx + lodsb + xor ch,ch + mov cl,al + rep movsb + xor al,al + stosb + push es + pop ds + mov si,@@bufsiz + mov ax,word ptr @@buf + and ax,15 + sub si,ax + mov bx,@@x + mov cx,@@y + mov di,@@ton + mov ax,@@opt + call piload0 + pop ds + pop bp + ret 16 +PiLoad endp + +ToneSet proc near + mov bx,sp + push ds + mov ax,dsseg + mov ds,ax + mov es,ax + mov al,ss:[bx+2] + mov ds:piloadc_tone,al + call palset + pop ds + ret 2 +ToneSet endp + + public _PiLoad,_ToneSet +_PiLoad proc near + arg @@nam:word,@@buf,@@bufsiz,@@x,@@y,@@ton,@@opt:word + push bp + mov bp,sp + push si + push di + push ds + mov bx,ds + mov es,bx + mov dx,@@nam + mov ax,@@buf + add ax,15 + shr ax,4 + add ax,bx + mov ds,ax + mov si,@@bufsiz + mov ax,@@buf + and ax,15 + sub si,ax + mov bx,@@x + mov cx,@@y + mov di,@@ton + mov ax,@@opt + call piload0 + pop ds + pop di + pop si + pop bp + ret +_PiLoad endp + +_ToneSet proc near + mov bx,sp + push ds + push si + push di + mov ax,dsseg + mov ds,ax + mov es,ax + mov al,ss:[bx+2] + mov ds:piloadc_tone,al + call palset + pop di + pop si + pop ds + ret +_ToneSet endp + + public _PiLoadL,_ToneSetL +_PiLoadL proc far + arg @@nam:dword,@@buf:dword,@@bufsiz,@@x,@@y,@@ton,@@opt:word + push bp + mov bp,sp + push si + push di + push ds + les dx,@@nam + mov ax,word ptr @@buf + add ax,15 + shr ax,4 + add ax,word ptr @@buf+2 + mov ds,ax + mov si,@@bufsiz + mov ax,word ptr @@buf + and ax,15 + sub si,ax + mov bx,@@x + mov cx,@@y + mov di,@@ton + mov ax,@@opt + call piload0 + pop ds + pop di + pop si + pop bp + retf +_PiLoadL endp + +_ToneSetL proc far + mov bx,sp + push ds + push si + push di + mov ax,dsseg + mov ds,ax + mov es,ax + mov al,ss:[bx+4] + mov ds:piloadc_tone,al + call palset + pop di + pop si + pop ds + retf +_ToneSetL endp + + public _PiLoadC +_PiLoadC proc near + arg @@nam:dword,@@buf:dword,@@bufsiz,@@x,@@y,@@ton,@@opt:word + push bp + mov bp,sp + push si + push di + push ds + les dx,@@nam + mov ax,word ptr @@buf + add ax,15 + shr ax,4 + add ax,word ptr @@buf+2 + mov ds,ax + mov si,@@bufsiz + mov ax,word ptr @@buf + and ax,15 + sub si,ax + mov bx,@@x + mov cx,@@y + mov di,@@ton + mov ax,@@opt + call piload0 + pop ds + pop di + pop si + pop bp + ret +_PiLoadC endp + + +; in es:dx = filename +; ds:0 = buff +; si = size(paragraph) +; bx = x +; cx = y +; di = tone +; al = option +; ah = tcol + public piload0 +error0: + ret +piload0: + cld + mov spreg,sp + mov dsseg,ds + mov ds:piloadc_x_pos,bx + mov ds:piloadc_y_pos,cx + mov word ptr ds:piloadc_option,ax + mov ax,di + mov ds:piloadc_tone,al + + xor ax,ax + mov ds:piloadc_flg800,al + + mov ax,-8 + cmp si,piloadc_parasize+18+48 + jb error0 + mov ax,si + sub ax,piloadc_parasize + mov ds:piloadc_bufsize,ax + add ax,piloadc_buffer +; mov buffend,ax +; push cs +; pop ds +; assume ds:_TEXT + irp n,<0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l> + mov word ptr gw&n,ax ;自己書換(^^;) + endm + + push es + pop ds + call fopen + mov bx,dsseg + mov ds,bx + mov es,bx + jc error + mov ds:piloadc_fhandle,ax + call fread + mov si,bx + lodsw + cmp ax,'NZ' ;ID check + mov ax,-31 + jz pilop +error: ret +pilop: + test ds:piloadc_option,4 + jz @@lop2 +@@lop: + lodsb + cmp al,1ah + jz @@lop2 + mov dl,al + mov ah,2 + int 21h + jmp short @@lop +@@lop2: + lodsb + or al,al + jnz @@lop2 + lodsb + mov bl,al ;palet flag + lodsw ;ドット比率 + mov cx,ax + lodsb + cmp al,4 ;plane check + mov ax,-32 + jnz error + test ds:piloadc_option,8 + jz @@skip + mov ax,cx + call gmode +@@skip: + add si,4 ;machine code skip + lodsw + xchg ah,al ;dmy + xor cx,cx + mov dx,cx + mov di,ax + add di,si + and ax,ax + jz codee + +ccode: + cmp si,di + jz codee + lodsb + cmp al,1 + jz code1 + cmp al,2 + jz code2 + jmp short codee + +code1: + lodsw + xchg ah,al + mov cx,ax + lodsw + xchg ah,al + mov dx,ax + jmp short ccode + +code2: + add si,3 + lodsb + test ds:piloadc_option,40h + jnz ccode + cmp ds:piloadc_tcol,0ffh + jz ccode + mov ds:piloadc_tcol,al + or ds:piloadc_option,40h + jmp short ccode + +codee: + mov si,di + cmp ds:piloadc_x_pos,0 + jge @@jmp@ + mov ds:piloadc_x_pos,cx +@@jmp@: + cmp ds:piloadc_y_pos,0 + jge @@jmp + mov ds:piloadc_y_pos,dx +@@jmp: + + mov cx,ds:piloadc_x_pos + mov ax,ds:piloadc_y_pos + shr cx,3 + shl ax,4 + add cx,ax + shl ax,2 + add cx,ax + mov ds:piloadc_vadr,cx + + lodsw + xchg ah,al + mov ds:piloadc_x_wid,ax + + mov cx,ax ;自己書換(^^;) + neg ax + mov line1,ax ;-x_wid + inc ax + mov line11,ax ;-x_wid+1 + dec ax + shl1 ax + mov line2,ax ;-x_wid*2 + shl1 cx + mov ax,cx + add ax,piloadc_gbuff + mov ds:piloadc_bufbgn,ax + shl1 cx + mov ds:piloadc_line4,cx + add ax,cx + mov ds:piloadc_bufend,ax + mov bufend2,ax + mov bufend3,ax + mov bufend4,ax + + mov ax,ds:piloadc_x_pos + and ax,7 + add ax,ds:piloadc_x_wid + mov ds:piloadc_x_wid2,ax + mov cx,ax + lodsw + xchg ah,al + mov ds:piloadc_y_wid,ax + mov ds:piloadc_y_wid2,ax + + test bl,080h ;palet check + jnz nopalet + mov cx,48 + mov di,piloadc_PaletteBuff +@@lop1: + lodsb + shr al,4 + stosb + loop @@lop1 + mov bx,si + jmp short palend +nopalet: + mov bx,si + mov si,offset dftpal + mov di,piloadc_PaletteBuff + mov cx,12 + rep movs word ptr es:[di], word ptr cs:[si] +palend: + test ds:piloadc_option,1 + jz @@skip + call palset +@@skip: + call maketbl + mov dh,1 + mov di,piloadc_gbuff + xor al,al + call color ;ax=col + mov cx,ds:piloadc_x_wid + rep stosw + xor bp,bp + jmp while1 + + bitsub 6 + bitsub 7 +pos2: + get1bit 6 + db 0BEh ;mov si,nn +line2 dw ? + jnc brk + get1bit 7 + db 0BEh ;mov si,nn +line11 dw ? + jnc brk + dec si + dec si + jmp short brk + + + bitsub 8 + bitsub 9 + bitsub a + bitsub b +bit0: + movsw + db 81h,0ffh;cmp di,nn +bufend4 dw ? + jnz while1 + call gtrans +; jmp while1 +while1: + get1bit 8 + jc pos2 + get1bit 9 + db 0BEh ;mov si,nn +line1 dw ? + jc brk + mov si,-4 + mov ax,[di-2] + cmp ah,al + jz pos00 +brk: + cmp si,bp + mov bp,si + jz nopres + add si,di +bjmp: get1bit a + jnc bit0 + mov ax,1 + xor cx,cx +llop: inc cx + get1bit b + jc llop +bitcx: get1bit c + rcl1 ax + loop bitcx +; call getnbit + jc jmp0 +jmp1: + mov cx,ax + db 0B8h ;mov ax,nn +bufend2 dw ? + sub ax,di + shr ax,1 + cmp cx,ax + jae jmp2 + rep movsw + jmp while1 + +; get1bit c + bitsub c + +pos00: + cmp si,bp + mov bp,si + jz nopres + lea si,[di-2] + jmp short bjmp + +nopres: + mov al,[di-1] +noplop: call color + stosw + mov al,ah + db 81h,0ffh;cmp di,nn +bufend3 dw ? + jz cjmp01 +cjmp02: + get1bit d + jc noplop + xor bp,bp + jmp while1 +cjmp01: call gtrans + jmp cjmp02 + +jmp2: + sub cx,ax + xchg cx,ax + rep movsw + call gtrans + sub si,ds:piloadc_line4 + jmp short jmp1 + +jmp0: + xor cx,cx +lop0: + movsw + cmp di,ds:piloadc_bufend + loopnz lop0 + jnz jmp1 + call gtrans + sub si,ds:piloadc_line4 + jcxz jmp1 + jmp short lop0 + + bitsub d + + bitsub e + bitsub 0 + bitsub 1 + bitsub 2 + bitsub 3 + bitsub 4 + +bit01: + get1bit e + jc @@jmp + lodsb + jmp short color2 +@@jmp: + mov ax,[si] + xchg ah,al + mov [si],ax + xor ah,ah + jmp short color2 + +; in al=color +; out al,ah=color +color: + mov bp,di + xor ah,ah + mov si,ax +; add si,piloadc_coltbl + + get1bit 0 + jc bit01 + get1bit 1 + mov cx,1 + jnc bit1 + get1bit 2 + jnc bit2 + get1bit 3 + rcl1 cx +bit2: get1bit 4 + rcl1 cx +bit1: get1bit 5 + rcl1 cx + add si,cx + std + lodsb + lea di,[si+1] + rep movsb + stosb + jmp short color2 + + bitsub 5 + bitsub g + +color2: + xor ah,ah + mov si,ax +; add si,piloadc_coltbl + + get1bit g + jc @bit01 + get1bit h + mov cx,1 + jnc @bit1 + get1bit i + jnc @bit2 + get1bit j + rcl1 cx +@bit2: get1bit k + rcl1 cx +@bit1: get1bit l + rcl1 cx + add si,cx + std + mov ah,al + lodsb + lea di,[si+1] + rep movsb + stosb + xchg ah,al + mov di,bp + cld + ret + +@bit01: + get1bit f + jc @@jmp + mov ah,[si] + mov di,bp + cld + ret +@@jmp: + mov cx,[si] + xchg ch,cl + mov [si],cx + mov ah,cl + mov di,bp + cld + ret + + bitsub h + bitsub i + bitsub j + bitsub k + bitsub l + bitsub f + +maketbl: +; mov di,piloadc_coltbl + xor di,di + mov ax,1000h +@@lop1: mov cx,16 +@@lop2: ;and al,0f0h + stosb + sub al,10h + loop @@lop2 + add al,10h + dec ah + jnz @@lop1 + ret + +;----------------------------------------------------------------------------- +; MS-DOS依存部 +;----------------------------------------------------------------------------- +fopen: +comment ; + push si + push dx + mov si,dx +flop: lodsb + mov dl,al + mov ah,2 + int 21h + or dl,dl + jnz flop + pop dx + pop si +; + mov ax,3d00h + int 21h + ret + +fread: + push ax + push cx + push dx + mov bx,ds:piloadc_fhandle + mov dx,piloadc_buffer + push dx + mov cx,ds:piloadc_bufsize + mov ah,3fh + int 21h + jc @err + pop bx + pop dx + pop cx + pop ax + ret + +@err: + call fclose + mov sp,spreg + ret + +fclose: + mov bx,ds:piloadc_fhandle + mov ah,3eh + int 21h + ret + +;----------------------------------------------------------------------------- +; 98依存部 +;----------------------------------------------------------------------------- + +; 画面モード設定 +; in ax=ドット比率データ +gmode: + cmp ax,102h + jz @@next +; or ax,ax +; mov ax,-32 +; jnz error + mov ch,0c0h + mov ah,42h + int 18h + mov ah,40h + int 18h + mov al,1 + out 6ah,al + ret +@@next: + mov ch,080h + mov ah,42h + int 18h + mov al,8 + out 68h,al + mov ah,40h + int 18h + mov al,1 + out 6ah,al + or ds:piloadc_flg800,4 + ret + + +; gbuffからlinライン分表示(gbuff->VRAM) +gtrans: + pusha + push es + cmp ds:piloadc_vadr,32000 + jl @@skip + sub ds:piloadc_vadr,32000 + or ds:piloadc_flg800,1 + mov al,1 + out 0a6h,al +; out 0a4h,al +@@skip: + +disp: + mov si,ds:piloadc_bufend + mov di,piloadc_gbuff + mov cx,ds:piloadc_x_wid + sub si,cx + sub si,cx + rep movsw + mov si,di + mov cx,lin +ylop: + push cx + mov di,ds:piloadc_vadr + mov ax,ds:piloadc_x_pos + and ax,7 + jz @@skip + mov cx,8 + sub cx,ax + push cx + mov ah,0ffh + shl ah,cl + not al + xor bx,bx + mov dx,bx +@@lop: + lodsb + shl1 al + rcl1 bl + shl1 al + rcl1 bh + shl1 al + rcl1 dl + shl1 al + rcl1 dh + loop @@lop + mov cx,0a800h + mov es,cx + + mov al,0c0h + out 7ch,al + mov al,dh + out 7eh,al + mov al,dl + out 7eh,al + mov al,bh + out 7eh,al + mov al,bl + out 7eh,al + mov al,ah + test ds:piloadc_option,40h + jz @@skip0 + mov ah,ds:piloadc_tcol + shr ah,1 + jnc @@jmp1 + not dh +@@jmp1: + shr ah,1 + jnc @@jmp2 + not dl +@@jmp2: + shr ah,1 + jnc @@jmp3 + not bh +@@jmp3: + shr ah,1 + jnc @@jmp4 + not bl +@@jmp4: + or bx,dx + or bl,bh + or al,bl +@@skip0: + stosb + xor al,al + out 7ch,al + + pop ax + mov cx,ds:piloadc_x_wid + sub cx,ax + shr cx,3 + jmp short xlop +@@skip: + mov cx,ds:piloadc_x_wid + shr cx,3 +xlop: + rept 4 + lodsw + shl1 al + rcl1 bl + shl1 ah + rcl1 bl + shl1 al + rcl1 bh + shl1 ah + rcl1 bh + shl1 al + rcl1 dl + shl1 ah + rcl1 dl + shl1 al + rcl1 dh + shl1 ah + rcl1 dh + endm + mov ax,0a800h + mov es,ax + + test ds:piloadc_option,40h + jnz @@jmp0 + mov es:[di],dh + mov es:[di+8000h],dl + mov ah,0b8h + mov es,ax + mov es:[di],bh + mov ah,0e0h + mov es,ax + mov al,bl + stosb + dec cx + jz xend + jmp xlop +@@jmp0: + mov ah,ds:piloadc_tcol + mov al,0c0h + out 7ch,al + mov al,dh + out 7eh,al + mov al,dl + out 7eh,al + mov al,bh + out 7eh,al + mov al,bl + out 7eh,al + + shr ah,1 + jnc @@jmp1 + not dh +@@jmp1: + shr ah,1 + jnc @@jmp2 + not dl +@@jmp2: + shr ah,1 + jnc @@jmp3 + not bh +@@jmp3: + shr ah,1 + jnc @@jmp4 + not bl +@@jmp4: + mov ax,dx + or ax,bx + or al,ah + stosb + dec cx + jz xend + jmp xlop + +xend: + xor al,al + out 7ch,al + mov cx,ds:piloadc_x_wid2 + and cx,7 + jz ext + mov ah,8 + sub ah,cl + xor bx,bx + mov dx,bx +@@lop: + lodsb + shl1 al + rcl1 bl + shl1 al + rcl1 bh + shl1 al + rcl1 dl + shl1 al + rcl1 dh + loop @@lop + mov cl,ah + mov ch,0ffh + shl ch,cl + shl bx,cl + shl dx,cl + mov ax,0a800h + mov es,ax + + mov al,0c0h + out 7ch,al + mov al,dh + out 7eh,al + mov al,dl + out 7eh,al + mov al,bh + out 7eh,al + mov al,bl + out 7eh,al + mov al,ch + test ds:piloadc_option,40h + jz @@skip0 + mov ah,ds:piloadc_tcol + shr ah,1 + jnc @@jmp1 + not dh +@@jmp1: + shr ah,1 + jnc @@jmp2 + not dl +@@jmp2: + shr ah,1 + jnc @@jmp3 + not bh +@@jmp3: + shr ah,1 + jnc @@jmp4 + not bl +@@jmp4: + or bx,dx + or bl,bh + or al,bl +@@skip0: + stosb + xor al,al + out 7ch,al + +ext: + pop cx + add ds:piloadc_vadr,80 + dec ds:piloadc_y_wid2 + jz piloadc_fin + dec cx + jz ext2 + jmp ylop +ext2: + pop es + popa + mov di,ds:piloadc_bufbgn + ret +piloadc_fin: + test ds:piloadc_flg800,1 + jle @@jmp + mov al,0 +; out 0a4h,al + out 0a6h,al + and ds:piloadc_flg800,not 2 +@@jmp: + call fclose + mov sp,spreg + xor ax,ax + ret + +; パレット設定 + +; in al=tone [PaletteBuff]=palet + +mul38 dw 0,38,76,114,152,190,228,266,304,342,380,418,456,494,532,570 +mul75 dw 0,75,150,225,300,375,450,525,600,675,750,825,900,975,1050,1125 +mul15 dw 0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225 +palset: + push bx + mov bl,ds:piloadc_tone + mov bh,100 + mov di,piloadc_tonetbl + xor cx,cx +@@plop: + mov al,cl + mul bl + div bh + stosb + inc cl + cmp cl,16 + jnz @@plop + + mov si,piloadc_PaletteBuff + mov bx,piloadc_tonetbl + mov cx,16 + xor ah,ah + test ds:piloadc_option,16 + jnz @@lop2 +@@lop: ;通常 + mov al,ah + out 0a8h,al ;palet no + lodsb + xlat [bx] + out 0ach,al ;red + lodsb + xlat [bx] + out 0aah,al ;green + lodsb + xlat [bx] + out 0aeh,al ;blue + inc ah + loop @@lop + pop bx + ret +@@lop2: ;NOTE用 + mov al,16 + sub al,cl + out 0a8h,al ;palet no + mov dx,64 + lodsb + shl1 al + mov di,ax + add dx,mul38[di] + lodsb + shl1 al + mov di,ax + add dx,mul75[di] + lodsb + shl1 al + mov di,ax + add dx,mul15[di] + mov al,7 + sub al,dh + xlat [bx] + mov dl,al + irp port,<0aeh,0ach,0aah> + shr dl,1 + sbb al,al + out port,al + endm + loop @@lop2 + pop bx + ret + + db 0 ; word alignment diff --git a/libs/piloadc/piloadc.doc b/libs/piloadc/piloadc.doc new file mode 100644 index 00000000..8795adbe --- /dev/null +++ b/libs/piloadc/piloadc.doc @@ -0,0 +1,159 @@ +=============================================================================== + + Pi Loader組込み用解説書 1993.10.4 電脳科学研究所/BERO + +=============================================================================== + +これはPi形式の画像を自作ソフトで表示するためのライブラリです。 +Pi0.22から、2画面以上の画像を表示できるようにメインメモリに展開バッファを取る +ようになり、省メモリの利点が失われてしまい、組み込み利用に向かなくなったので、 +余計な部分を無くして組み込み用にライブラリ化しました。 + +Pi0.21以前のpiloadと比較すると +・部分ロードのバグが取れた +・透明色ロードが可能になった +・スモールモデル以外でも使えるようになった +・バッファの指定がセグメントでなくポインタで行えるようになった + +同梱ファイル +piloadc.doc このドキュメント +piloadc.asm ロード部ソース ( C / Pascal 共通 ) +piloadc.obj ロード部オブジェクト +pild.pas TurboPascal使用例 +pild.c TurboC/MS-C/QuickC使用例 + +C,Pascalから呼び出せるモジュールが一つになっています。 +C,Pascalから同じ様に呼び出すことができます。 + +piloadc.obj +------------------------------------------------------------------------------- +small/tinyモデル + int PiLoad(char *name,char *buff,int Size,int X,int Y,int tone,int option) +compact モデル + int PiLoadC(char *name,char *buff,int Size,int X,int Y,int tone,int option) +large/hugeモデル + int PiLoadL(char *name,char *buff,int Size,int X,int Y,int tone,int option) +PASCAL + functuon PiLoad( name:string; var buff; Size,X,Y,tone,option:integer):integer; + + 引数 + name ファイル名 + buff バッファのポインタ + Size バッファのサイズ + X 表示アドレスのX座標(-1で位置情報を利用) + Y 表示アドレスのY座標(-1で位置情報を利用) + tone トーン(1~100%) + option オプション(下記のビットで指定) + (lsb)0 .. パレット設定 する/しない = 1/0 + 1 .. 常駐パレット設定 する/しない = 1/0(*) + 2 .. コメント表示 する/しない = 1/0 + 3 .. 画面設定 する/しない = 1/0 + (VRAMのON,400/200line設定) + 4 .. ノート用パレット する/しない = 1/0 + 5 .. スクロールロード する/しない = 1/0(*) + 6 .. 透明色利用 する/しない = 1/0 + 7 .. 裏画面ロード する/しない = 1/0(*) + 8~15 .. 透明色指定(0~15) + + (*)はpiloadにはありますがpiloadcでは無意味です。 + + 戻り値 + 0 正常終了 + -8 バッファが足りない + -31 Piではない + -32 サポートされていない + 他 エラー(MSDOSのDOSコールエラー参照) + +・バッファは約8Kバイト以上必要です。 +・バッファのオフセット100hから48バイトがパレット、130hから8バイトがX座標、Y座 + 標、横幅、縦幅になります。 +・画像の横幅が1280を越える場合は正常に表示出来ません。 + ソースの line = 1280 を変更することで対応できます。 +・bit6が0の場合、データで透明色が指定されていればそれが使用されます。 + 明示的に透明色を指定する場合はbit6を1にして、上位8ビットで透明色のパレット + 番号を指定して下さい。データの透明色を透明にせずに表示する場合は、bit6を1に + して、上位8ビットにffhを指定して下さい。 +・縦400を越える画像は裏画面に表示されます。スクロール等は自前でして下さい。 + +void ToneSet( int tone) small/tiny/compactモデル +void ToneSetL( int tone) large/hugeモデル +procedure ToneSet(tone:integer) pascal + + 引数 tone トーン(1~100%) + +直前にロードした画像のトーンを変更します。 +画像のフェードイン・フェードアウト等に使います。 + +------------------------------------------------------------------------------- +Cでの使い方 + +(1)ソース中で関数のプロトタイプ宣言をする +int PiLoad(char *name,char *buff,int Size,int X,int Y,int tone,int option); + +(2)piloadc.objをリンクする +MS-C A>CL <組み込みたいファイル.c> piload.obj +TurboC A>TCC <組み込みたいファイル.c> piload.obj + +------------------------------------------------------------------------------- +TurboPascalでの使い方 + +(1)ソース中で関数の外部定義とpiloadc.objのリンク指定をする +functuon PiLoad( name:string; var buff; Size,X,Y,tone,option:integer):integer; + external; +{$l piloadc} + +------------------------------------------------------------------------------- + +Piフォーマットは柳沢明氏が考案されたものです。 +転載および使用に関しては、X68版Pi.rに準じます。 +(Pi.rのDOCより) + ・著作権は放棄しませんが、以下の範囲での使用が可能です。 + ・転載・使用に関しましては私の承認無しに自由に転載・使用して構いません。 + ・組み込みに当たりソースの変更などなさってもかまいません。 + ・営利目的で使用しても構いません(私の承認なしでも結構です) + ただし、その事をどこかに1言書いて下さい(簡単には見れない所でも可) + ・商業誌の広告でPiの紹介をするのであれば事前に連絡を下さい。 +  (いきなり広告に登場するとびっくりします) そして掲載の場合は必ず入手手段 +  を広告掲載者側で用意し、その方法を同じ広告中に明記して下さい(~~で入手で +  きるとか、××に載っているとかは駄目です) + ・ディスクマガジンおよび商業誌への掲載は可です。 + ・使用に関して生じた損害は、その原因が当方にありましても保証しかねますので +  ご了承下さい。 + ・当然Piで圧縮したデータに関しましては当方では如何なる権利も主張しません、 + また表示されるデータに対して如何なる責任も有りません。 + +このソースはTurboAssembler2.0で書かれています。 +ローカルラベル等TASM特有の機能を多用してるので他のアセンブラでは不幸かも。 + +同人等で組込む場合、見本をいただけると嬉しいですが、義務ではありません。 +わざわざ送ってくれた人ありがとうございます。嬉しかったす。 +でもCG集のローダにわざわざpild.cに毛の生えたようなのを作るくらいなら素直に +pi.exeを使って下さい。なんかウィルスが混入したのもあったらしいし。 + ・・ + タケルとかパソコンショップとか書籍添付とか、即売会以外で販売する場合は事前に +相談して下さい。べつにいくらかよこせとかいう訳じゃなくて、素人がそういうのに手 +を出すと、相場を知らないので甘くみられてショップが不当に儲けたりすることが往々 +にしてあるので(某*ッセ3Oとか)、アドバイスします。 + +ソフト作成に便利なツール + +CG集作成キットCGL + 98/68/TOWNS3機種で動作するマウス対応のメニュー形式のCGローダ。 + +電脳インストーラDINST + リセットして起動するだけで自動的にMS-DOSをインストールする賢いIPL。 + +電脳インストーラDINST2 + 68ではHuman68kが、98ではMS-DOSインストーラが起動するもっと賢いIPL。 + +等もよろしく。質問・要望等は以下まで。 + + 電脳科学研究所/BERO + +791-02 温泉郡重信町志津川393-2-203 石尾孝弘 + + 同人NET(東京BBS)03-3857-7822 BERO + CAT-NET CAT23959 + + NiftyServe JBC01267 + PC-VAN EHM44445 diff --git a/readme.md b/readme.md index c68d02fe..7a073dcb 100644 --- a/readme.md +++ b/readme.md @@ -30,8 +30,9 @@ It certainly *seems* to be. During the development of the static English patches * [master.lib](http://www.koizuka.jp/~koizuka/master.lib/), a 16-bit x86 assembly library providing an abstraction layer for all components of a PC-98 DOS system * as well as the Borland C/C++ runtime library, version 4.0. +* Additionally, TH01 includes the [Pi loader library by 電脳科学研究所/BERO](http://www.vector.co.jp/soft/dos/prog/se037608.html). -These two make up a sizable amount of the code in all the executables. In TH05, for example, they amount to 74% of all code in `OP.EXE`, and 40% of all code in `MAIN.EXE`. That's already quite a lot of code we do not have to deal with. Identifying the rest of the code shared across the games will further reduce the workload to a more acceptable amount. +The two main libraries make up a sizable amount of the code in all the executables. In TH05, for example, they amount to 74% of all code in `OP.EXE`, and 40% of all code in `MAIN.EXE`. That's already quite a lot of code we do not have to deal with. Identifying the rest of the code shared across the games will further reduce the workload to a more acceptable amount. With [the Debug edition of Neko Project II](https://github.com/nmlgc/np2debug), we also have an open-source PC-9821 emulator, capable of running the games. This will greatly help in understanding and porting all hardware-specific code. diff --git a/th01_fuuin.asm b/th01_fuuin.asm index c8eb8b41..4fd94646 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -48,1741 +48,8 @@ seg000 segment word public 'CODE' use16 assume es:nothing, ss:_STACK, ds:dseg, fs:nothing, gs:nothing include libs/BorlandC/c0.asm - - db 6 dup(0), 2 dup(7), 2 dup(0), 7, 0, 7, 0, 7 - db 2 dup(0), 4 dup(7), 0, 3 dup(7), 5 dup(0), 2 dup(0Fh) - db 2 dup(0), 0Fh, 0, 0Fh, 0, 0Fh, 2 dup(0), 4 dup(0Fh) - db 0, 3 dup(0Fh) -word_2A2 dw 0 -word_2A4 dw 0 -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push ds - lds dx, [bp+12h] - mov ax, [bp+0Eh] - add ax, 0Fh - shr ax, 4 - add ax, [bp+10h] - mov es, ax - cld - mov si, dx - xor dx, dx - mov di, dx - lodsb - xor ch, ch - mov cl, al - rep movsb - xor al, al - stosb - push es - pop ds - mov si, [bp+0Ch] - mov ax, [bp+0Eh] - and ax, 0Fh - sub si, ax - mov bx, [bp+0Ah] - mov cx, [bp+8] - mov di, [bp+6] - mov ax, [bp+4] - call loc_3E2 - pop ds - pop bp - retn 10h -; --------------------------------------------------------------------------- - mov bx, sp - push ds - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+2] - mov byte_12BD8, al - call sub_BE3 - pop ds - retn 2 -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push si - push di - push ds - mov bx, ds - mov es, bx - assume es:dseg - mov dx, [bp+4] - mov ax, [bp+6] - add ax, 0Fh - shr ax, 4 - add ax, bx - mov ds, ax - mov si, [bp+8] - mov ax, [bp+6] - and ax, 0Fh - sub si, ax - mov bx, [bp+0Ah] - mov cx, [bp+0Ch] - mov di, [bp+0Eh] - mov ax, [bp+10h] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retn -; --------------------------------------------------------------------------- - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - assume es:nothing - mov al, ss:[bx+2] - mov byte_12BD8, al - call sub_BE3 - pop di - pop si - pop ds - retn - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_35A proc far - -arg_0 = dword ptr 6 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh -arg_A = word ptr 10h -arg_C = word ptr 12h -arg_E = word ptr 14h -arg_10 = word ptr 16h - - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+arg_0] - mov ax, [bp+arg_4] - add ax, 0Fh - shr ax, 4 - add ax, [bp+arg_6] - mov ds, ax - mov si, [bp+arg_8] - mov ax, [bp+arg_4] - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_A] - mov cx, [bp+arg_C] - mov di, [bp+arg_E] - mov ax, [bp+arg_10] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retf -sub_35A endp - -; --------------------------------------------------------------------------- - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+4] - mov byte_12BD8, al - call sub_BE3 - pop di - pop si - pop ds - retf -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+4] - mov ax, [bp+8] - add ax, 0Fh - shr ax, 4 - add ax, [bp+0Ah] - mov ds, ax - mov si, [bp+0Ch] - mov ax, [bp+8] - -loc_3C8: - and ax, 0Fh - sub si, ax - mov bx, [bp+0Eh] - mov cx, [bp+10h] - mov di, [bp+12h] - mov ax, [bp+14h] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retn -; --------------------------------------------------------------------------- - -locret_3E1: - retn -; --------------------------------------------------------------------------- - -loc_3E2: - cld - mov cs:word_2A2, sp - mov cs:word_2A4, ds - mov word_12BD0, bx - mov seg_12BD2, cx - mov word ptr byte_12BD9, ax - mov ax, di - mov byte_12BD8, al - xor ax, ax - mov byte ptr unk_12BDB, al - mov ax, 0FFF8h - cmp si, 1FA2h - jb short locret_3E1 - mov ax, si - sub ax, 1F60h - mov seg_12BE6, ax - add ax, 1F60h - mov word ptr cs:loc_736+2, ax - mov word ptr cs:loc_746+2, ax - mov word ptr cs:loc_756+2, ax - mov word ptr cs:loc_766+2, ax - mov word ptr cs:loc_776+2, ax - mov word ptr cs:loc_7E0+2, ax - mov word ptr cs:loc_5DA+2, ax - mov word ptr cs:loc_5EA+2, ax - mov word ptr cs:loc_614+2, ax - mov word ptr cs:loc_624+2, ax - mov word ptr cs:loc_634+2, ax - mov word ptr cs:loc_644+2, ax - mov word ptr cs:loc_6B6+2, ax - mov word ptr cs:loc_716+2, ax - mov word ptr cs:loc_726+2, ax - mov word ptr cs:loc_8B3+2, ax - -loc_456: - mov word ptr cs:loc_7F0+2, ax - -loc_45A: - mov word ptr cs:loc_863+2, ax - mov word ptr cs:loc_873+2, ax - mov word ptr cs:loc_883+2, ax - mov word ptr cs:loc_893+2, ax - mov word ptr cs:loc_8A3+2, ax - push es - pop ds - call sub_8D2 - mov bx, cs:word_2A4 - mov ds, bx - mov es, bx - jb short locret_48F - mov word_12BE0, ax - call sub_8D8 - mov si, bx - lodsw - cmp ax, 4E5Ah - mov ax, 0FFE1h - jz short loc_490 - -locret_48F: - retn -; --------------------------------------------------------------------------- - -loc_490: - test byte_12BD9, 4 - jz short loc_4A4 - -loc_497: - lodsb - cmp al, 1Ah - jz short loc_4A4 - mov dl, al - mov ah, 2 - int 21h ; DOS - DISPLAY OUTPUT - ; DL = character to send to standard output - jmp short loc_497 -; --------------------------------------------------------------------------- - -loc_4A4: - lodsb - or al, al - jnz short loc_4A4 - lodsb - mov bl, al - lodsw - mov cx, ax - lodsb - cmp al, 4 - mov ax, 0FFE0h - jnz short locret_48F - test byte_12BD9, 8 - jz short loc_4C3 - mov ax, cx - call sub_904 - -loc_4C3: - add si, 4 - lodsw - xchg ah, al - xor cx, cx - mov dx, cx - mov di, ax - add di, si - and ax, ax - jz short loc_50C - -loc_4D5: - cmp si, di - jz short loc_50C - lodsb - cmp al, 1 - jz short loc_4E4 - cmp al, 2 - jz short loc_4F0 - jmp short loc_50C -; --------------------------------------------------------------------------- - -loc_4E4: - lodsw - xchg ah, al - mov cx, ax - lodsw - xchg ah, al - mov dx, ax - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_4F0: - add si, 3 - lodsb - test byte_12BD9, 40h - jnz short loc_4D5 - cmp seg_12BDA, 0FFh - -loc_500: - jz short loc_4D5 - mov seg_12BDA, al - or byte_12BD9, 40h - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_50C: - mov si, di - cmp word_12BD0, 0 - jge short loc_519 - mov word_12BD0, cx - -loc_519: - cmp seg_12BD2, 0 - jge short loc_524 - mov seg_12BD2, dx - -loc_524: - mov cx, word_12BD0 - mov ax, seg_12BD2 - shr cx, 3 - shl ax, 4 - add cx, ax - shl ax, 2 - add cx, ax - -loc_538: - mov seg_12BDE, cx - -loc_53C: - lodsw - xchg ah, al - mov word_12BD4, ax - mov cx, ax - neg ax - mov word ptr cs:loc_667+1, ax - inc ax - -loc_54B: - mov word ptr cs:loc_606+1, ax - dec ax - add ax, ax - mov word ptr cs:loc_5FB+1, ax - add cx, cx - mov ax, cx - add ax, 160h - mov seg_12BE2, ax - add cx, cx - mov word_12BDC, cx - add ax, cx - mov word_12BE4, ax - mov word ptr cs:loc_6A2+1, ax - mov word ptr cs:loc_6D5+2, ax - mov word ptr cs:loc_650+2, ax - mov ax, word_12BD0 - and ax, 7 - add ax, word_12BD4 - mov word_12BEC, ax - mov cx, ax - lodsw - xchg ah, al - mov seg_12BD6, ax - mov word ptr off_12BE8+2, ax - test bl, 80h - jnz short loc_5A5 - mov cx, 30h ; '0' - mov di, 100h - -loc_59A: - lodsb - shr al, 4 - stosb - loop loc_59A - mov bx, si - jmp short loc_5B3 -; --------------------------------------------------------------------------- - -loc_5A5: - mov bx, si - mov si, 272h - mov di, 100h - mov cx, 0Ch - rep movs word ptr es:[di], word ptr cs:[si] - -loc_5B3: - test byte_12BD9, 1 - jz short loc_5BD - call sub_BE3 - -loc_5BD: - call sub_8BE - mov dh, 1 - mov di, 160h - xor al, al - call loc_796 - mov cx, word_12BD4 - rep stosw - xor bp, bp - ; Hack (jmp loc_659) - db 0e9h - db 084h - db 000h -; --------------------------------------------------------------------------- - -loc_5D5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5DA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_5F9 - call sub_8D8 - jmp short loc_5F9 -; --------------------------------------------------------------------------- - -loc_5E5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5EA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_604 - call sub_8D8 - jmp short loc_604 -; --------------------------------------------------------------------------- - -loc_5F5: - dec dh - jz short loc_5D5 - -loc_5F9: - add dl, dl - -loc_5FB: - mov si, 0 - jnb short loc_676 - dec dh - jz short loc_5E5 - -loc_604: - add dl, dl - -loc_606: - mov si, 0 - jnb short loc_676 - dec si - dec si - jmp short loc_676 -; --------------------------------------------------------------------------- - -loc_60F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_614: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_65D - call sub_8D8 - jmp short loc_65D -; --------------------------------------------------------------------------- - -loc_61F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_624: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_665 - call sub_8D8 - jmp short loc_665 -; --------------------------------------------------------------------------- - -loc_62F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_634: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_682 - call sub_8D8 - jmp short loc_682 -; --------------------------------------------------------------------------- - -loc_63F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_644: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_690 - call sub_8D8 - jmp short loc_690 -; --------------------------------------------------------------------------- - -loc_64F: - movsw - -loc_650: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jnz short loc_659 - call sub_930 - -loc_659: - dec dh - jz short loc_60F - -loc_65D: - add dl, dl - jb short loc_5F5 - dec dh - jz short loc_61F - -loc_665: - add dl, dl - -loc_667: - mov si, 0 - jb short loc_676 - mov si, 0FFFCh - mov ax, [di-2] - cmp ah, al - jz short loc_6C1 - -loc_676: - cmp si, bp - mov bp, si - jz short loc_6CC - add si, di - -loc_67E: - dec dh - jz short loc_62F - -loc_682: - add dl, dl - jnb short loc_64F - mov ax, 1 - xor cx, cx - -loc_68B: - inc cx - dec dh - jz short loc_63F - -loc_690: - add dl, dl - jb short loc_68B - -loc_694: - dec dh - jz short loc_6B1 - -loc_698: - add dl, dl - adc ax, ax - loop loc_694 - jb short loc_6FB - -loc_6A0: - mov cx, ax - -loc_6A2: - mov ax, 0 - sub ax, di - shr ax, 1 - cmp cx, ax - jnb short loc_6ED - rep movsw - jmp short loc_659 -; --------------------------------------------------------------------------- - -loc_6B1: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_6B6: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_698 - call sub_8D8 - jmp short loc_698 -; --------------------------------------------------------------------------- - -loc_6C1: - cmp si, bp - mov bp, si - jz short loc_6CC - lea si, [di-2] - jmp short loc_67E -; --------------------------------------------------------------------------- - -loc_6CC: - mov al, [di-1] - -loc_6CF: - call loc_796 - stosw - mov al, ah - -loc_6D5: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jz short loc_6E8 - -loc_6DB: - dec dh - jz short loc_711 - -loc_6DF: - add dl, dl - jb short loc_6CF - xor bp, bp - jmp loc_659 -; --------------------------------------------------------------------------- - -loc_6E8: - call sub_930 - jmp short loc_6DB -; --------------------------------------------------------------------------- - -loc_6ED: - sub cx, ax - xchg ax, cx - rep movsw - call sub_930 - sub si, word_12BDC - jmp short loc_6A0 -; --------------------------------------------------------------------------- - -loc_6FB: - xor cx, cx - -loc_6FD: - movsw - cmp di, word_12BE4 - loopne loc_6FD - jnz short loc_6A0 - call sub_930 - sub si, word_12BDC - jcxz short loc_6A0 - jmp short loc_6FD -; --------------------------------------------------------------------------- - -loc_711: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_716: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_6DF - call sub_8D8 - jmp short loc_6DF -; --------------------------------------------------------------------------- - -loc_721: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_726: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_785 - call sub_8D8 - jmp short loc_785 -; --------------------------------------------------------------------------- - -loc_731: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_736: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A0 - call sub_8D8 - jmp short loc_7A0 -; --------------------------------------------------------------------------- - -loc_741: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_746: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A8 - call sub_8D8 - jmp short loc_7A8 -; --------------------------------------------------------------------------- - -loc_751: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_756: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7B3 - call sub_8D8 - jmp short loc_7B3 -; --------------------------------------------------------------------------- - -loc_761: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_766: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7BB - call sub_8D8 - jmp short loc_7BB -; --------------------------------------------------------------------------- - -loc_771: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_776: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7C3 - call sub_8D8 - jmp short loc_7C3 -; --------------------------------------------------------------------------- - -loc_781: - dec dh - jz short loc_721 - -loc_785: - add dl, dl - jb short loc_78C - lodsb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_78C: - mov ax, [si] - xchg ah, al - mov [si], ax - xor ah, ah - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_796: - mov bp, di - xor ah, ah - mov si, ax - dec dh - jz short loc_731 - -loc_7A0: - add dl, dl - jb short loc_781 - dec dh - jz short loc_741 - -loc_7A8: - add dl, dl - mov cx, 1 - jnb short loc_7C7 - dec dh - jz short loc_751 - -loc_7B3: - add dl, dl - jnb short loc_7BF - dec dh - jz short loc_761 - -loc_7BB: - add dl, dl - adc cx, cx - -loc_7BF: - dec dh - jz short loc_771 - -loc_7C3: - add dl, dl - adc cx, cx - -loc_7C7: - dec dh - jz short loc_7DB - -loc_7CB: - add dl, dl - adc cx, cx - add si, cx - std - lodsb - lea di, [si+1] - rep movsb - stosb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_7DB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7E0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7CB - call sub_8D8 - jmp short loc_7CB -; --------------------------------------------------------------------------- - -loc_7EB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7F0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_803 - call sub_8D8 - jmp short loc_803 -; --------------------------------------------------------------------------- - -loc_7FB: - xor ah, ah - mov si, ax - dec dh - jz short loc_7EB - -loc_803: - add dl, dl - jb short loc_844 - dec dh - jz short loc_85E - -loc_80B: - add dl, dl - mov cx, 1 - jnb short loc_82A - dec dh - jz short loc_86E - -loc_816: - add dl, dl - jnb short loc_822 - dec dh - jz short loc_87E - -loc_81E: - add dl, dl - adc cx, cx - -loc_822: - dec dh - jz short loc_88E - -loc_826: - add dl, dl - adc cx, cx - -loc_82A: - dec dh - jz short loc_89E - -loc_82E: - add dl, dl - adc cx, cx - add si, cx - std - mov ah, al - lodsb - lea di, [si+1] - rep movsb - stosb - xchg ah, al - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_844: - dec dh - jz short loc_8AE - -loc_848: - add dl, dl - jb short loc_852 - mov ah, [si] - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_852: - mov cx, [si] - xchg ch, cl - mov [si], cx - mov ah, cl - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_85E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_863: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_80B - call sub_8D8 - jmp short loc_80B -; --------------------------------------------------------------------------- - -loc_86E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_873: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_816 - call sub_8D8 - jmp short loc_816 -; --------------------------------------------------------------------------- - -loc_87E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_883: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_81E - call sub_8D8 - jmp short loc_81E -; --------------------------------------------------------------------------- - -loc_88E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_893: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_826 - call sub_8D8 - jmp short loc_826 -; --------------------------------------------------------------------------- - -loc_89E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8A3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_82E - call sub_8D8 - jmp short loc_82E -; --------------------------------------------------------------------------- - -loc_8AE: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8B3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_848 - call sub_8D8 - jmp short loc_848 - -; =============== S U B R O U T I N E ======================================= - - -sub_8BE proc near - xor di, di - mov ax, 1000h - -loc_8C3: - mov cx, 10h - -loc_8C6: - stosb - sub al, 10h - loop loc_8C6 - add al, 10h - dec ah - jnz short loc_8C3 - retn -sub_8BE endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D2 proc near - mov ax, 3D00h - int 21h ; DOS - 2+ - OPEN DISK FILE WITH HANDLE - ; DS:DX -> ASCIZ filename - ; AL = access mode - ; 0 - read - retn -sub_8D2 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D8 proc near - push ax - push cx - push dx - mov bx, word_12BE0 - mov dx, 1F60h - push dx - mov cx, seg_12BE6 - mov ah, 3Fh - int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE - ; BX = file handle, CX = number of bytes to read - ; DS:DX -> buffer - jb short loc_8F2 - pop bx - pop dx - pop cx - pop ax - retn -; --------------------------------------------------------------------------- - -loc_8F2: - call sub_8FB - mov sp, cs:word_2A2 - retn -sub_8D8 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8FB proc near - mov bx, word_12BE0 - mov ah, 3Eh - int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE - ; BX = file handle - retn -sub_8FB endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_904 proc near - cmp ax, 102h - jz short loc_918 - mov ch, 0C0h ; '' - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - retn -; --------------------------------------------------------------------------- - -loc_918: - mov ch, 80h - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 8 - out 68h, al - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - or byte ptr unk_12BDB, 4 - retn -sub_904 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_930 proc near - pusha - push es - cmp seg_12BDE, 7D00h - jl short loc_949 - sub seg_12BDE, 7D00h - or byte ptr unk_12BDB, 1 - mov al, 1 - out 0A6h, al - -loc_949: - mov si, word_12BE4 - mov di, 160h - mov cx, word_12BD4 - sub si, cx - sub si, cx - rep movsw - mov si, di - mov cx, 4 - -loc_95F: - push cx - mov di, seg_12BDE - mov ax, word_12BD0 - and ax, 7 - jz short loc_9E4 - mov cx, 8 - sub cx, ax - push cx - mov ah, 0FFh - shl ah, cl - not al - xor bx, bx - mov dx, bx - -loc_97C: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_97C - mov cx, 0A800h - mov es, cx - assume es:nothing - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ah - test byte_12BD9, 40h - jz short loc_9D3 - mov ah, seg_12BDA - shr ah, 1 - jnb short loc_9BB - not dh - -loc_9BB: - shr ah, 1 - jnb short loc_9C1 - not dl - -loc_9C1: - shr ah, 1 - jnb short loc_9C7 - not bh - -loc_9C7: - shr ah, 1 - jnb short loc_9CD - not bl - -loc_9CD: - or bx, dx - or bl, bh - or al, bl - -loc_9D3: - stosb - xor al, al - out 7Ch, al - pop ax - mov cx, word_12BD4 - sub cx, ax - shr cx, 3 - jmp short loc_9EB -; --------------------------------------------------------------------------- - -loc_9E4: - mov cx, word_12BD4 - shr cx, 3 - -loc_9EB: - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - mov ax, 0A800h - mov es, ax - test byte_12BD9, 40h - jnz short loc_A97 - mov es:[di], dh - mov es:[di-8000h], dl - mov ah, 0B8h ; '' - mov es, ax - assume es:nothing - mov es:[di], bh - mov ah, 0E0h - mov es, ax - assume es:nothing - mov al, bl - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_A97: - mov ah, seg_12BDA - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - shr ah, 1 - jnb short loc_AB5 - not dh - -loc_AB5: - shr ah, 1 - jnb short loc_ABB - not dl - -loc_ABB: - shr ah, 1 - jnb short loc_AC1 - not bh - -loc_AC1: - shr ah, 1 - jnb short loc_AC7 - not bl - -loc_AC7: - mov ax, dx - or ax, bx - or al, ah - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_AD4: - xor al, al - out 7Ch, al - mov cx, word_12BEC - and cx, 7 - jz short loc_B4F - mov ah, 8 - sub ah, cl - xor bx, bx - mov dx, bx - -loc_AE9: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_AE9 - mov cl, ah - mov ch, 0FFh - shl ch, cl - shl bx, cl - shl dx, cl - mov ax, 0A800h - mov es, ax - assume es:nothing - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ch - test byte_12BD9, 40h - jz short loc_B4A - mov ah, seg_12BDA - shr ah, 1 - jnb short loc_B32 - not dh - -loc_B32: - shr ah, 1 - jnb short loc_B38 - not dl - -loc_B38: - shr ah, 1 - jnb short loc_B3E - not bh - -loc_B3E: - shr ah, 1 - jnb short loc_B44 - not bl - -loc_B44: - or bx, dx - or bl, bh - or al, bl - -loc_B4A: - stosb - xor al, al - out 7Ch, al - -loc_B4F: - pop cx - add seg_12BDE, 50h ; 'P' - dec word ptr off_12BE8+2 - jz short loc_B68 - dec cx - jz short loc_B61 - jmp loc_95F -; --------------------------------------------------------------------------- - -loc_B61: - pop es - assume es:nothing - popa - mov di, seg_12BE2 - retn -; --------------------------------------------------------------------------- - -loc_B68: - test byte ptr unk_12BDB, 1 - jle short loc_B78 - mov al, 0 - out 0A6h, al - and byte ptr unk_12BDB, 0FDh - -loc_B78: - call sub_8FB - mov sp, cs:word_2A2 - xor ax, ax - retn -sub_930 endp - -; --------------------------------------------------------------------------- - db 0 - db 0 - db 26h ; & - db 0 - db 4Ch ; L - db 0 - db 72h ; r - db 0 - db 98h - db 0 - db 0BEh ; - db 0 - db 0E4h - db 0 - db 0Ah - db 1 - db 30h ; 0 - db 1 - db 56h ; V - db 1 - db 7Ch ; | - db 1 - db 0A2h ; - db 1 - db 0C8h ; - db 1 - db 0EEh - db 1 - db 14h - db 2 - db 3Ah ; : - db 2 - db 0 - db 0 - db 4Bh ; K - db 0 - db 96h - db 0 - db 0E1h - db 0 - db 2Ch ; , - db 1 - db 77h ; w - db 1 - db 0C2h ; - db 1 - db 0Dh - db 2 - db 58h ; X - db 2 - db 0A3h ; - db 2 - db 0EEh - db 2 - db 39h ; 9 - db 3 - db 84h - db 3 - db 0CFh ; - db 3 - db 1Ah - db 4 - db 65h ; e - db 4 - db 0 - db 0 - db 0Fh - db 0 - db 1Eh - db 0 - db 2Dh ; - - db 0 - db 3Ch ; < - db 0 - db 4Bh ; K - db 0 - db 5Ah ; Z - db 0 - db 69h ; i - db 0 - db 78h ; x - db 0 - db 87h - db 0 - db 96h - db 0 - db 0A5h ; - db 0 - db 0B4h ; - db 0 - db 0C3h ; - db 0 - db 0D2h ; - db 0 - db 0E1h - db 0 - -; =============== S U B R O U T I N E ======================================= - - -sub_BE3 proc near - push bx - mov bl, byte_12BD8 - mov bh, 64h ; 'd' - mov di, 150h - xor cx, cx - -loc_BEF: - mov al, cl - mul bl - div bh - stosb - inc cl - cmp cl, 10h - jnz short loc_BEF - mov si, 100h - mov bx, 150h - mov cx, 10h - xor ah, ah - test byte_12BD9, 10h - jnz short loc_C25 - -loc_C0F: - mov al, ah - out 0A8h, al - lodsb - xlat - out 0ACh, al - lodsb - xlat - out 0AAh, al - lodsb - xlat - out 0AEh, al - inc ah - loop loc_C0F - pop bx - retn -; --------------------------------------------------------------------------- - -loc_C25: - mov al, 10h - sub al, cl - out 0A8h, al - mov dx, 40h - lodsb - add al, al - mov di, ax - add dx, cs:[di+0B83h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BA3h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BC3h] - mov al, 7 - sub al, dh - xlat - mov dl, al - shr dl, 1 - sbb al, al - out 0AEh, al - shr dl, 1 - sbb al, al - out 0ACh, al - shr dl, 1 - sbb al, al - out 0AAh, al - loop loc_C25 - pop bx - retn -sub_BE3 endp - -; --------------------------------------------------------------------------- db 0 +include libs/piloadc/piloadc.asm include libs/master.lib/graph_400line.asm include libs/master.lib/graph_clear.asm include libs/master.lib/graph_show.asm @@ -8033,8 +6300,7 @@ arg_0 = word ptr 6 mov bp, sp xor ax, ax mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_538+3 + mov al, byte ptr es:[053Bh] cbw mov bx, ax mov dx, 62h ; 'b' @@ -12549,7 +10815,7 @@ loc_EB64: push off_1464A push [bp+arg_2] push [bp+arg_0] - call sub_35A + call _PiLoadL add sp, 12h mov [bp+var_1], al @@ -13099,8 +11365,7 @@ var_4 = dword ptr -4 call SCOPY@ xor ax, ax mov es, ax - assume es:seg000 - movsx eax, word ptr es:loc_3C8+2 + movsx eax, word ptr es:[03CAh] shl eax, 10h add eax, 102h shld edx, eax, 10h diff --git a/th01_op.asm b/th01_op.asm index a5a0fe9c..5eac1e6a 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -47,1655 +47,8 @@ seg000 segment word public 'CODE' use16 assume es:nothing, ss:_STACK, ds:dseg, fs:nothing, gs:nothing include libs/BorlandC/c0.asm - - db 6 dup(0), 2 dup(7), 2 dup(0), 7, 0, 7, 0, 7 - db 2 dup(0), 4 dup(7), 0, 3 dup(7), 5 dup(0), 2 dup(0Fh) - db 2 dup(0), 0Fh, 0, 0Fh, 0, 0Fh, 2 dup(0), 4 dup(0Fh) - db 0, 3 dup(0Fh) -word_2A2 dw 0 -word_2A4 dw 0 -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push ds - lds dx, [bp+12h] - mov ax, [bp+0Eh] - add ax, 0Fh - shr ax, 4 - add ax, [bp+10h] - mov es, ax - cld - mov si, dx - xor dx, dx - mov di, dx - lodsb - xor ch, ch - mov cl, al - rep movsb - xor al, al - stosb - push es - pop ds - mov si, [bp+0Ch] - mov ax, [bp+0Eh] - and ax, 0Fh - sub si, ax - mov bx, [bp+0Ah] - mov cx, [bp+8] - mov di, [bp+6] - mov ax, [bp+4] - call loc_3E2 - pop ds - pop bp - retn 10h -; --------------------------------------------------------------------------- - mov bx, sp - push ds - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+2] - mov byte_123C8, al - call sub_BE3 - pop ds - retn 2 -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push si - push di - push ds - mov bx, ds - mov es, bx - assume es:dseg - mov dx, [bp+4] - mov ax, [bp+6] - add ax, 0Fh - shr ax, 4 - add ax, bx - mov ds, ax - mov si, [bp+8] - mov ax, [bp+6] - and ax, 0Fh - sub si, ax - mov bx, [bp+0Ah] - mov cx, [bp+0Ch] - mov di, [bp+0Eh] - mov ax, [bp+10h] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retn -; --------------------------------------------------------------------------- - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - assume es:nothing - mov al, ss:[bx+2] - mov byte_123C8, al - call sub_BE3 - pop di - pop si - pop ds - retn - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_35A proc far - -arg_0 = dword ptr 6 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh -arg_A = word ptr 10h -arg_C = word ptr 12h -arg_E = word ptr 14h -arg_10 = word ptr 16h - - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+arg_0] - mov ax, [bp+arg_4] - add ax, 0Fh - shr ax, 4 - add ax, [bp+arg_6] - mov ds, ax - mov si, [bp+arg_8] - mov ax, [bp+arg_4] - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_A] - mov cx, [bp+arg_C] - mov di, [bp+arg_E] - mov ax, [bp+arg_10] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retf -sub_35A endp - -; --------------------------------------------------------------------------- - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+4] - mov byte_123C8, al - call sub_BE3 - pop di - pop si - pop ds - retf -; --------------------------------------------------------------------------- - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+4] - mov ax, [bp+8] - add ax, 0Fh - shr ax, 4 - add ax, [bp+0Ah] - mov ds, ax - mov si, [bp+0Ch] - mov ax, [bp+8] - -loc_3C8: - and ax, 0Fh - sub si, ax - mov bx, [bp+0Eh] - mov cx, [bp+10h] - mov di, [bp+12h] - mov ax, [bp+14h] - call loc_3E2 - pop ds - pop di - pop si - pop bp - retn -; --------------------------------------------------------------------------- - -locret_3E1: - retn -; --------------------------------------------------------------------------- - -loc_3E2: - cld - mov cs:word_2A2, sp - mov cs:word_2A4, ds - mov word_123C0, bx - mov word_123C2, cx - mov word_123C9, ax - mov ax, di - mov byte_123C8, al - xor ax, ax - mov byte_123CB, al - mov ax, 0FFF8h - cmp si, 1FA2h - jb short locret_3E1 - mov ax, si - sub ax, 1F60h - mov word_123D6, ax - add ax, 1F60h - mov word ptr cs:loc_736+2, ax - mov word ptr cs:loc_746+2, ax - mov word ptr cs:loc_756+2, ax - mov word ptr cs:loc_766+2, ax - mov word ptr cs:loc_776+2, ax - mov word ptr cs:loc_7E0+2, ax - mov word ptr cs:loc_5DA+2, ax - mov word ptr cs:loc_5EA+2, ax - mov word ptr cs:loc_614+2, ax - mov word ptr cs:loc_624+2, ax - mov word ptr cs:loc_634+2, ax - mov word ptr cs:loc_644+2, ax - mov word ptr cs:loc_6B6+2, ax - mov word ptr cs:loc_716+2, ax - mov word ptr cs:loc_726+2, ax - mov word ptr cs:loc_8B3+2, ax - -loc_456: - mov word ptr cs:loc_7F0+2, ax - -loc_45A: - mov word ptr cs:loc_863+2, ax - mov word ptr cs:loc_873+2, ax - mov word ptr cs:loc_883+2, ax - mov word ptr cs:loc_893+2, ax - mov word ptr cs:loc_8A3+2, ax - push es - pop ds - call sub_8D2 - mov bx, cs:word_2A4 - mov ds, bx - mov es, bx - jb short locret_48F - mov word_123D0, ax - call sub_8D8 - mov si, bx - lodsw - cmp ax, 4E5Ah - mov ax, 0FFE1h - jz short loc_490 - -locret_48F: - retn -; --------------------------------------------------------------------------- - -loc_490: - test byte ptr word_123C9, 4 - jz short loc_4A4 - -loc_497: - lodsb - cmp al, 1Ah - jz short loc_4A4 - mov dl, al - mov ah, 2 - int 21h ; DOS - DISPLAY OUTPUT - ; DL = character to send to standard output - jmp short loc_497 -; --------------------------------------------------------------------------- - -loc_4A4: - lodsb - or al, al - jnz short loc_4A4 - lodsb - mov bl, al - lodsw - mov cx, ax - lodsb - cmp al, 4 - mov ax, 0FFE0h - jnz short locret_48F - test byte ptr word_123C9, 8 - jz short loc_4C3 - mov ax, cx - call sub_904 - -loc_4C3: - add si, 4 - lodsw - xchg ah, al - xor cx, cx - mov dx, cx - mov di, ax - add di, si - and ax, ax - jz short loc_50C - -loc_4D5: - cmp si, di - jz short loc_50C - lodsb - cmp al, 1 - jz short loc_4E4 - cmp al, 2 - jz short loc_4F0 - jmp short loc_50C -; --------------------------------------------------------------------------- - -loc_4E4: - lodsw - xchg ah, al - mov cx, ax - lodsw - xchg ah, al - mov dx, ax - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_4F0: - add si, 3 - lodsb - test byte ptr word_123C9, 40h - jnz short loc_4D5 - cmp byte ptr word_123C9+1, 0FFh - -loc_500: - jz short loc_4D5 - mov byte ptr word_123C9+1, al - or byte ptr word_123C9, 40h - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_50C: - mov si, di - cmp word_123C0, 0 - jge short loc_519 - mov word_123C0, cx - -loc_519: - cmp word_123C2, 0 - jge short loc_524 - mov word_123C2, dx - -loc_524: - mov cx, word_123C0 - -loc_528: - mov ax, word_123C2 - shr cx, 3 - shl ax, 4 - add cx, ax - shl ax, 2 - add cx, ax - -loc_538: - mov word_123CE, cx - -loc_53C: - lodsw - xchg ah, al - mov word_123C4, ax - mov cx, ax - neg ax - mov word ptr cs:loc_667+1, ax - inc ax - -loc_54B: - mov word ptr cs:loc_606+1, ax - dec ax - add ax, ax - mov word ptr cs:loc_5FB+1, ax - add cx, cx - mov ax, cx - add ax, 160h - mov word_123D2, ax - add cx, cx - mov word_123CC, cx - add ax, cx - mov word_123D4, ax - mov word ptr cs:loc_6A2+1, ax - mov word ptr cs:loc_6D5+2, ax - mov word ptr cs:loc_650+2, ax - mov ax, word_123C0 - and ax, 7 - add ax, word_123C4 - mov word_123DC, ax - mov cx, ax - lodsw - xchg ah, al - mov word_123C6, ax - mov word_123DA, ax - test bl, 80h - jnz short loc_5A5 - mov cx, 30h ; '0' - mov di, 100h - -loc_59A: - lodsb - shr al, 4 - stosb - loop loc_59A - mov bx, si - jmp short loc_5B3 -; --------------------------------------------------------------------------- - -loc_5A5: - mov bx, si - mov si, 272h - mov di, 100h - mov cx, 0Ch - rep movs word ptr es:[di], word ptr cs:[si] - -loc_5B3: - test byte ptr word_123C9, 1 - jz short loc_5BD - call sub_BE3 - -loc_5BD: - call sub_8BE - mov dh, 1 - mov di, 160h - xor al, al - call loc_796 - mov cx, word_123C4 - rep stosw - xor bp, bp - ; Hack (jmp loc_659) - db 0e9h - db 084h - db 000h -; --------------------------------------------------------------------------- - -loc_5D5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5DA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_5F9 - call sub_8D8 - jmp short loc_5F9 -; --------------------------------------------------------------------------- - -loc_5E5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5EA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_604 - call sub_8D8 - jmp short loc_604 -; --------------------------------------------------------------------------- - -loc_5F5: - dec dh - jz short loc_5D5 - -loc_5F9: - add dl, dl - -loc_5FB: - mov si, 0 - jnb short loc_676 - dec dh - jz short loc_5E5 - -loc_604: - add dl, dl - -loc_606: - mov si, 0 - jnb short loc_676 - dec si - dec si - jmp short loc_676 -; --------------------------------------------------------------------------- - -loc_60F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_614: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_65D - call sub_8D8 - jmp short loc_65D -; --------------------------------------------------------------------------- - -loc_61F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_624: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_665 - call sub_8D8 - jmp short loc_665 -; --------------------------------------------------------------------------- - -loc_62F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_634: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_682 - call sub_8D8 - jmp short loc_682 -; --------------------------------------------------------------------------- - -loc_63F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_644: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_690 - call sub_8D8 - jmp short loc_690 -; --------------------------------------------------------------------------- - -loc_64F: - movsw - -loc_650: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jnz short loc_659 - call sub_930 - -loc_659: - dec dh - jz short loc_60F - -loc_65D: - add dl, dl - jb short loc_5F5 - dec dh - jz short loc_61F - -loc_665: - add dl, dl - -loc_667: - mov si, 0 - jb short loc_676 - mov si, 0FFFCh - mov ax, [di-2] - cmp ah, al - jz short loc_6C1 - -loc_676: - cmp si, bp - mov bp, si - jz short loc_6CC - add si, di - -loc_67E: - dec dh - jz short loc_62F - -loc_682: - add dl, dl - jnb short loc_64F - mov ax, 1 - xor cx, cx - -loc_68B: - inc cx - dec dh - jz short loc_63F - -loc_690: - add dl, dl - jb short loc_68B - -loc_694: - dec dh - jz short loc_6B1 - -loc_698: - add dl, dl - adc ax, ax - loop loc_694 - jb short loc_6FB - -loc_6A0: - mov cx, ax - -loc_6A2: - mov ax, 0 - sub ax, di - shr ax, 1 - cmp cx, ax - jnb short loc_6ED - rep movsw - jmp short loc_659 -; --------------------------------------------------------------------------- - -loc_6B1: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_6B6: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_698 - call sub_8D8 - jmp short loc_698 -; --------------------------------------------------------------------------- - -loc_6C1: - cmp si, bp - mov bp, si - jz short loc_6CC - lea si, [di-2] - jmp short loc_67E -; --------------------------------------------------------------------------- - -loc_6CC: - mov al, [di-1] - -loc_6CF: - call loc_796 - stosw - mov al, ah - -loc_6D5: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jz short loc_6E8 - -loc_6DB: - dec dh - jz short loc_711 - -loc_6DF: - add dl, dl - jb short loc_6CF - xor bp, bp - jmp loc_659 -; --------------------------------------------------------------------------- - -loc_6E8: - call sub_930 - jmp short loc_6DB -; --------------------------------------------------------------------------- - -loc_6ED: - sub cx, ax - xchg ax, cx - rep movsw - call sub_930 - sub si, word_123CC - jmp short loc_6A0 -; --------------------------------------------------------------------------- - -loc_6FB: - xor cx, cx - -loc_6FD: - movsw - cmp di, word_123D4 - loopne loc_6FD - jnz short loc_6A0 - call sub_930 - sub si, word_123CC - jcxz short loc_6A0 - jmp short loc_6FD -; --------------------------------------------------------------------------- - -loc_711: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_716: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_6DF - call sub_8D8 - jmp short loc_6DF -; --------------------------------------------------------------------------- - -loc_721: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_726: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_785 - call sub_8D8 - jmp short loc_785 -; --------------------------------------------------------------------------- - -loc_731: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_736: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A0 - call sub_8D8 - jmp short loc_7A0 -; --------------------------------------------------------------------------- - -loc_741: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_746: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A8 - call sub_8D8 - jmp short loc_7A8 -; --------------------------------------------------------------------------- - -loc_751: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_756: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7B3 - call sub_8D8 - jmp short loc_7B3 -; --------------------------------------------------------------------------- - -loc_761: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_766: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7BB - call sub_8D8 - jmp short loc_7BB -; --------------------------------------------------------------------------- - -loc_771: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_776: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7C3 - call sub_8D8 - jmp short loc_7C3 -; --------------------------------------------------------------------------- - -loc_781: - dec dh - jz short loc_721 - -loc_785: - add dl, dl - jb short loc_78C - lodsb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_78C: - mov ax, [si] - xchg ah, al - mov [si], ax - xor ah, ah - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_796: - mov bp, di - xor ah, ah - mov si, ax - dec dh - jz short loc_731 - -loc_7A0: - add dl, dl - jb short loc_781 - dec dh - jz short loc_741 - -loc_7A8: - add dl, dl - mov cx, 1 - jnb short loc_7C7 - dec dh - jz short loc_751 - -loc_7B3: - add dl, dl - jnb short loc_7BF - dec dh - jz short loc_761 - -loc_7BB: - add dl, dl - adc cx, cx - -loc_7BF: - dec dh - jz short loc_771 - -loc_7C3: - add dl, dl - adc cx, cx - -loc_7C7: - dec dh - jz short loc_7DB - -loc_7CB: - add dl, dl - adc cx, cx - add si, cx - std - lodsb - lea di, [si+1] - rep movsb - stosb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_7DB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7E0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7CB - call sub_8D8 - jmp short loc_7CB -; --------------------------------------------------------------------------- - -loc_7EB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7F0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_803 - call sub_8D8 - jmp short loc_803 -; --------------------------------------------------------------------------- - -loc_7FB: - xor ah, ah - mov si, ax - dec dh - jz short loc_7EB - -loc_803: - add dl, dl - jb short loc_844 - dec dh - jz short loc_85E - -loc_80B: - add dl, dl - mov cx, 1 - jnb short loc_82A - dec dh - jz short loc_86E - -loc_816: - add dl, dl - jnb short loc_822 - dec dh - jz short loc_87E - -loc_81E: - add dl, dl - adc cx, cx - -loc_822: - dec dh - jz short loc_88E - -loc_826: - add dl, dl - adc cx, cx - -loc_82A: - dec dh - jz short loc_89E - -loc_82E: - add dl, dl - adc cx, cx - add si, cx - std - mov ah, al - lodsb - lea di, [si+1] - rep movsb - stosb - xchg ah, al - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_844: - dec dh - jz short loc_8AE - -loc_848: - add dl, dl - jb short loc_852 - mov ah, [si] - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_852: - mov cx, [si] - xchg ch, cl - mov [si], cx - mov ah, cl - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_85E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_863: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_80B - call sub_8D8 - jmp short loc_80B -; --------------------------------------------------------------------------- - -loc_86E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_873: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_816 - call sub_8D8 - jmp short loc_816 -; --------------------------------------------------------------------------- - -loc_87E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_883: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_81E - call sub_8D8 - jmp short loc_81E -; --------------------------------------------------------------------------- - -loc_88E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_893: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_826 - call sub_8D8 - jmp short loc_826 -; --------------------------------------------------------------------------- - -loc_89E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8A3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_82E - call sub_8D8 - jmp short loc_82E -; --------------------------------------------------------------------------- - -loc_8AE: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8B3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_848 - call sub_8D8 - jmp short loc_848 - -; =============== S U B R O U T I N E ======================================= - - -sub_8BE proc near - xor di, di - mov ax, 1000h - -loc_8C3: - mov cx, 10h - -loc_8C6: - stosb - sub al, 10h - loop loc_8C6 - add al, 10h - dec ah - jnz short loc_8C3 - retn -sub_8BE endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D2 proc near - mov ax, 3D00h - int 21h ; DOS - 2+ - OPEN DISK FILE WITH HANDLE - ; DS:DX -> ASCIZ filename - ; AL = access mode - ; 0 - read - retn -sub_8D2 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D8 proc near - push ax - push cx - push dx - mov bx, word_123D0 - mov dx, 1F60h - push dx - mov cx, word_123D6 - mov ah, 3Fh - int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE - ; BX = file handle, CX = number of bytes to read - ; DS:DX -> buffer - jb short loc_8F2 - pop bx - pop dx - pop cx - pop ax - retn -; --------------------------------------------------------------------------- - -loc_8F2: - call sub_8FB - mov sp, cs:word_2A2 - retn -sub_8D8 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8FB proc near - mov bx, word_123D0 - mov ah, 3Eh - int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE - ; BX = file handle - retn -sub_8FB endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_904 proc near - cmp ax, 102h - jz short loc_918 - mov ch, 0C0h - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - retn -; --------------------------------------------------------------------------- - -loc_918: - mov ch, 80h - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 8 - out 68h, al - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - or byte_123CB, 4 - retn -sub_904 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_930 proc near - pusha - push es - cmp word_123CE, 7D00h - jl short loc_949 - sub word_123CE, 7D00h - or byte_123CB, 1 - mov al, 1 - out 0A6h, al - -loc_949: - mov si, word_123D4 - mov di, 160h - mov cx, word_123C4 - sub si, cx - sub si, cx - rep movsw - mov si, di - mov cx, 4 - -loc_95F: - push cx - mov di, word_123CE - mov ax, word_123C0 - and ax, 7 - jz short loc_9E4 - mov cx, 8 - sub cx, ax - push cx - mov ah, 0FFh - shl ah, cl - not al - xor bx, bx - mov dx, bx - -loc_97C: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_97C - mov cx, 0A800h - mov es, cx - assume es:nothing - mov al, 0C0h - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ah - test byte ptr word_123C9, 40h - jz short loc_9D3 - mov ah, byte ptr word_123C9+1 - shr ah, 1 - jnb short loc_9BB - not dh - -loc_9BB: - shr ah, 1 - jnb short loc_9C1 - not dl - -loc_9C1: - shr ah, 1 - jnb short loc_9C7 - not bh - -loc_9C7: - shr ah, 1 - jnb short loc_9CD - not bl - -loc_9CD: - or bx, dx - or bl, bh - or al, bl - -loc_9D3: - stosb - xor al, al - out 7Ch, al - pop ax - mov cx, word_123C4 - sub cx, ax - shr cx, 3 - jmp short loc_9EB -; --------------------------------------------------------------------------- - -loc_9E4: - mov cx, word_123C4 - shr cx, 3 - -loc_9EB: - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - mov ax, 0A800h - mov es, ax - test byte ptr word_123C9, 40h - jnz short loc_A97 - mov es:[di], dh - mov es:[di-8000h], dl - mov ah, 0B8h - mov es, ax - assume es:nothing - mov es:[di], bh - mov ah, 0E0h - mov es, ax - assume es:nothing - mov al, bl - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_A97: - mov ah, byte ptr word_123C9+1 - mov al, 0C0h - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - shr ah, 1 - jnb short loc_AB5 - not dh - -loc_AB5: - shr ah, 1 - jnb short loc_ABB - not dl - -loc_ABB: - shr ah, 1 - jnb short loc_AC1 - not bh - -loc_AC1: - shr ah, 1 - jnb short loc_AC7 - not bl - -loc_AC7: - mov ax, dx - or ax, bx - or al, ah - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_AD4: - xor al, al - out 7Ch, al - mov cx, word_123DC - and cx, 7 - jz short loc_B4F - mov ah, 8 - sub ah, cl - xor bx, bx - mov dx, bx - -loc_AE9: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_AE9 - mov cl, ah - mov ch, 0FFh - shl ch, cl - shl bx, cl - shl dx, cl - mov ax, 0A800h - mov es, ax - assume es:nothing - mov al, 0C0h - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ch - test byte ptr word_123C9, 40h - jz short loc_B4A - mov ah, byte ptr word_123C9+1 - shr ah, 1 - jnb short loc_B32 - not dh - -loc_B32: - shr ah, 1 - jnb short loc_B38 - not dl - -loc_B38: - shr ah, 1 - jnb short loc_B3E - not bh - -loc_B3E: - shr ah, 1 - jnb short loc_B44 - not bl - -loc_B44: - or bx, dx - or bl, bh - or al, bl - -loc_B4A: - stosb - xor al, al - out 7Ch, al - -loc_B4F: - pop cx - add word_123CE, 50h ; 'P' - dec word_123DA - jz short loc_B68 - dec cx - jz short loc_B61 - jmp loc_95F -; --------------------------------------------------------------------------- - -loc_B61: - pop es - assume es:nothing - popa - mov di, word_123D2 - retn -; --------------------------------------------------------------------------- - -loc_B68: - test byte_123CB, 1 - jle short loc_B78 - mov al, 0 - out 0A6h, al - and byte_123CB, 0FDh - -loc_B78: - call sub_8FB - mov sp, cs:word_2A2 - xor ax, ax - retn -sub_930 endp - -; --------------------------------------------------------------------------- - db 2 dup(0), 26h, 0, 4Ch, 0, 72h, 0, 98h, 0, 0BEh, 0, 0E4h - db 0, 0Ah, 1, 30h, 1, 56h, 1, 7Ch, 1, 0A2h, 1, 0C8h, 1 - db 0EEh, 1, 14h, 2, 3Ah, 2, 2 dup(0), 4Bh, 0, 96h, 0, 0E1h - db 0, 2Ch, 1, 77h, 1, 0C2h, 1, 0Dh, 2, 58h, 2, 0A3h, 2 - db 0EEh, 2, 39h, 3, 84h, 3, 0CFh, 3, 1Ah, 4, 65h, 4, 2 dup(0) - db 0Fh, 0, 1Eh, 0, 2Dh, 0, 3Ch, 0, 4Bh, 0, 5Ah, 0, 69h - db 0, 78h, 0, 87h, 0, 96h, 0, 0A5h, 0, 0B4h, 0, 0C3h, 0 - db 0D2h, 0, 0E1h, 0 - -; =============== S U B R O U T I N E ======================================= - - -sub_BE3 proc near - push bx - mov bl, byte_123C8 - mov bh, 64h ; 'd' - mov di, 150h - xor cx, cx - -loc_BEF: - mov al, cl - mul bl - div bh - stosb - inc cl - cmp cl, 10h - jnz short loc_BEF - mov si, 100h - mov bx, 150h - mov cx, 10h - xor ah, ah - test byte ptr word_123C9, 10h - jnz short loc_C25 - -loc_C0F: - mov al, ah - out 0A8h, al - lodsb - xlat - out 0ACh, al - lodsb - xlat - out 0AAh, al - lodsb - xlat - out 0AEh, al - inc ah - loop loc_C0F - pop bx - retn -; --------------------------------------------------------------------------- - -loc_C25: - mov al, 10h - sub al, cl - out 0A8h, al - mov dx, 40h - lodsb - add al, al - mov di, ax - add dx, cs:[di+0B83h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BA3h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BC3h] - mov al, 7 - sub al, dh - xlat - mov dl, al - shr dl, 1 - sbb al, al - out 0AEh, al - shr dl, 1 - sbb al, al - out 0ACh, al - shr dl, 1 - sbb al, al - out 0AAh, al - loop loc_C25 - pop bx - retn -sub_BE3 endp - -; --------------------------------------------------------------------------- db 0 +include libs/piloadc/piloadc.asm include libs/master.lib/graph_400line.asm include libs/master.lib/graph_clear.asm include libs/master.lib/graph_show.asm @@ -3832,14 +2185,14 @@ loc_B1D8: loc_B1EE: xor ax, ax mov es, ax - mov ax, word ptr es:loc_524 + mov ax, word ptr es:[0524h] mov [bp+var_C], ax xor ax, ax mov dx, [bp+var_C] mov es, ax - mov word ptr es:loc_524+2, dx + mov word ptr es:[0526h], dx mov es, ax - mov byte ptr es:loc_528, 0 + mov byte ptr es:[0528h], 0 inc dword_13418 push 1 call sub_B269 @@ -4256,7 +2609,7 @@ arg_0 = word ptr 6 xor ax, ax mov es, ax assume es:seg000 - mov al, byte ptr es:loc_538+3 + mov al, byte ptr es:[053Bh] cbw mov bx, ax mov dx, 62h ; 'b' @@ -9324,7 +7677,7 @@ loc_DB17: push large 4000h push large [font] push large [bp+arg_0] - call sub_35A + call _PiLoadL add sp, 12h mov [bp+var_1], al @@ -10378,8 +8731,7 @@ var_4 = dword ptr -4 call SCOPY@ xor ax, ax mov es, ax - assume es:seg000 - movsx eax, word ptr es:loc_3C8+2 + movsx eax, word ptr es:[03CAh] shl eax, 10h add eax, 102h shld edx, eax, 10h diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 2ccec3e7..09fdc2c6 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -73,1738 +73,8 @@ seg000 segment word public 'CODE' use16 assume es:nothing, ss:_STACK, ds:dseg, fs:nothing, gs:nothing include libs/BorlandC/c0.asm - - db 6 dup(0), 2 dup(7), 2 dup(0), 7, 0, 7, 0, 7 - db 2 dup(0), 4 dup(7), 0, 3 dup(7), 5 dup(0), 2 dup(0Fh) - db 2 dup(0), 0Fh, 0, 0Fh, 0, 0Fh, 2 dup(0), 4 dup(0Fh) - db 0, 3 dup(0Fh) -word_2A2 dw 0 -word_2A4 dw 0 - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_2A6 proc near - -arg_0 = word ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh -arg_C = word ptr 10h -arg_E = dword ptr 12h - - push bp - mov bp, sp - push ds - lds dx, [bp+arg_E] - mov ax, [bp+arg_A] - add ax, 0Fh - shr ax, 4 - add ax, [bp+arg_C] - mov es, ax - cld - mov si, dx - xor dx, dx - mov di, dx - lodsb - xor ch, ch - mov cl, al - rep movsb - xor al, al - stosb - push es - pop ds - mov si, [bp+arg_8] - mov ax, [bp+arg_A] - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_6] - mov cx, [bp+arg_4] - mov di, [bp+arg_2] - mov ax, [bp+arg_0] - call sub_3E2 - pop ds - pop bp - retn 10h -sub_2A6 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_2ED proc near - mov bx, sp - push ds - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+2] - mov byte_34AD8, al - call sub_BE3 - pop ds - retn 2 -sub_2ED endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_306 proc near - -arg_0 = word ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh -arg_C = word ptr 10h - - push bp - mov bp, sp - push si - push di - push ds - mov bx, ds - mov es, bx - assume es:dseg - mov dx, [bp+arg_0] - mov ax, [bp+arg_2] - add ax, 0Fh - shr ax, 4 - add ax, bx - mov ds, ax - mov si, [bp+arg_4] - mov ax, [bp+arg_2] - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_6] - mov cx, [bp+arg_8] - mov di, [bp+arg_A] - mov ax, [bp+arg_C] - call sub_3E2 - pop ds - pop di - pop si - pop bp - retn -sub_306 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_33F proc near - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - assume es:nothing - mov al, ss:[bx+2] - mov byte_34AD8, al - call sub_BE3 - pop di - pop si - pop ds - retn -sub_33F endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_35A proc far - -arg_0 = dword ptr 6 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh -arg_A = word ptr 10h -arg_C = word ptr 12h -arg_E = word ptr 14h -arg_10 = word ptr 16h - - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+arg_0] - mov ax, [bp+arg_4] - add ax, 0Fh - shr ax, 4 - add ax, [bp+arg_6] - mov ds, ax - mov si, [bp+arg_8] - mov ax, [bp+arg_4] - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_A] - mov cx, [bp+arg_C] - mov di, [bp+arg_E] - mov ax, [bp+arg_10] - call sub_3E2 - pop ds - pop di - pop si - pop bp - retf -sub_35A endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_390 proc far - mov bx, sp - push ds - push si - push di - mov ax, cs:word_2A4 - mov ds, ax - mov es, ax - mov al, ss:[bx+4] - mov byte_34AD8, al - call sub_BE3 - pop di - pop si - pop ds - retf -sub_390 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_3AB proc near - -arg_0 = dword ptr 4 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh -arg_C = word ptr 10h -arg_E = word ptr 12h -arg_10 = word ptr 14h - - push bp - mov bp, sp - push si - push di - push ds - les dx, [bp+arg_0] - mov ax, [bp+arg_4] - add ax, 0Fh - shr ax, 4 - add ax, [bp+arg_6] - mov ds, ax - mov si, [bp+arg_8] - mov ax, [bp+arg_4] - -loc_3C8: - and ax, 0Fh - sub si, ax - mov bx, [bp+arg_A] - mov cx, [bp+arg_C] - mov di, [bp+arg_E] - mov ax, [bp+arg_10] - call sub_3E2 - pop ds - pop di - pop si - pop bp - retn -sub_3AB endp - - -; =============== S U B R O U T I N E ======================================= - - -nullsub_1 proc near - retn -nullsub_1 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_3E2 proc near - cld - mov cs:word_2A2, sp - mov cs:word_2A4, ds - mov word_34AD0, bx - mov word_34AD2, cx - mov word_34AD9, ax - mov ax, di - mov byte_34AD8, al - xor ax, ax - mov byte_34ADB, al - mov ax, 0FFF8h - cmp si, 1FA2h - jb short nullsub_1 - mov ax, si - sub ax, 1F60h - mov word ptr aNormal+1, ax - add ax, 1F60h - mov word ptr cs:loc_736+2, ax - mov word ptr cs:loc_746+2, ax - mov word ptr cs:loc_756+2, ax - mov word ptr cs:loc_766+2, ax - mov word ptr cs:loc_776+2, ax - mov word ptr cs:loc_7E0+2, ax - mov word ptr cs:loc_5DA+2, ax - mov word ptr cs:loc_5EA+2, ax - mov word ptr cs:loc_614+2, ax - mov word ptr cs:loc_624+2, ax - mov word ptr cs:loc_634+2, ax - mov word ptr cs:loc_644+2, ax - mov word ptr cs:loc_6B6+2, ax - mov word ptr cs:loc_716+2, ax - mov word ptr cs:loc_726+2, ax - mov word ptr cs:loc_8B3+2, ax - -loc_456: - mov word ptr cs:loc_7F0+2, ax - -loc_45A: - mov word ptr cs:loc_863+2, ax - mov word ptr cs:loc_873+2, ax - mov word ptr cs:loc_883+2, ax - mov word ptr cs:loc_893+2, ax - mov word ptr cs:loc_8A3+2, ax - push es - pop ds - call sub_8D2 - mov bx, cs:word_2A4 - mov ds, bx - mov es, bx - jb short locret_48F - mov word ptr aEasy, ax ; "EASY" - call sub_8D8 - mov si, bx - lodsw - cmp ax, 4E5Ah - mov ax, 0FFE1h - jz short loc_490 - -locret_48F: - retn -; --------------------------------------------------------------------------- - -loc_490: - test byte ptr word_34AD9, 4 - jz short loc_4A4 - -loc_497: - lodsb - cmp al, 1Ah - jz short loc_4A4 - mov dl, al - mov ah, 2 - int 21h ; DOS - DISPLAY OUTPUT - ; DL = character to send to standard output - jmp short loc_497 -; --------------------------------------------------------------------------- - -loc_4A4: - lodsb - or al, al - jnz short loc_4A4 - lodsb - mov bl, al - lodsw - mov cx, ax - lodsb - cmp al, 4 - mov ax, 0FFE0h - jnz short locret_48F - test byte ptr word_34AD9, 8 - jz short loc_4C3 - mov ax, cx - call sub_904 - -loc_4C3: - add si, 4 - lodsw - xchg ah, al - xor cx, cx - mov dx, cx - mov di, ax - add di, si - and ax, ax - jz short loc_50C - -loc_4D5: - cmp si, di - jz short loc_50C - lodsb - cmp al, 1 - jz short loc_4E4 - cmp al, 2 - jz short loc_4F0 - jmp short loc_50C -; --------------------------------------------------------------------------- - -loc_4E4: - lodsw - xchg ah, al - mov cx, ax - lodsw - xchg ah, al - mov dx, ax - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_4F0: - add si, 3 - lodsb - test byte ptr word_34AD9, 40h - jnz short loc_4D5 - cmp byte ptr word_34AD9+1, 0FFh - -loc_500: - jz short loc_4D5 - mov byte ptr word_34AD9+1, al - or byte ptr word_34AD9, 40h - jmp short loc_4D5 -; --------------------------------------------------------------------------- - -loc_50C: - mov si, di - cmp word_34AD0, 0 - jge short loc_519 - mov word_34AD0, cx - -loc_519: - cmp word_34AD2, 0 - jge short loc_524 - mov word_34AD2, dx - -loc_524: - mov cx, word_34AD0 - mov ax, word_34AD2 - shr cx, 3 - shl ax, 4 - add cx, ax - shl ax, 2 - add cx, ax - -loc_538: - mov word ptr unk_34ADE, cx - -loc_53C: - lodsw - xchg ah, al - mov word_34AD4, ax - mov cx, ax - neg ax - mov word ptr cs:loc_667+1, ax - inc ax - -loc_54B: - mov word ptr cs:loc_606+1, ax - dec ax - add ax, ax - mov word ptr cs:loc_5FB+1, ax - add cx, cx - mov ax, cx - add ax, 160h - mov word ptr aEasy+2, ax - add cx, cx - mov word_34ADC, cx - add ax, cx - mov word ptr aEasy+4, ax - mov word ptr cs:loc_6A2+1, ax - mov word ptr cs:loc_6D5+2, ax - mov word ptr cs:loc_650+2, ax - mov ax, word_34AD0 - and ax, 7 - add ax, word_34AD4 - mov word ptr aHard, ax ; "HARD" - mov cx, ax - lodsw - xchg ah, al - mov word_34AD6, ax - mov word ptr aNormal+5, ax - test bl, 80h - jnz short loc_5A5 - mov cx, 30h ; '0' - mov di, 100h - -loc_59A: - lodsb - shr al, 4 - stosb - loop loc_59A - mov bx, si - jmp short loc_5B3 -; --------------------------------------------------------------------------- - -loc_5A5: - mov bx, si - mov si, 272h - mov di, 100h - mov cx, 0Ch - rep movs word ptr es:[di], word ptr cs:[si] - -loc_5B3: - test byte ptr word_34AD9, 1 - jz short loc_5BD - call sub_BE3 - -loc_5BD: - call sub_8BE - mov dh, 1 - mov di, 160h - xor al, al - call sub_796 - mov cx, word_34AD4 - rep stosw - xor bp, bp - ; Hack (jmp loc_659) - db 0e9h - db 084h - db 000h -; --------------------------------------------------------------------------- - -loc_5D5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5DA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_5F9 - call sub_8D8 - jmp short loc_5F9 -; --------------------------------------------------------------------------- - -loc_5E5: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_5EA: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_604 - call sub_8D8 - jmp short loc_604 -; --------------------------------------------------------------------------- - -loc_5F5: - dec dh - jz short loc_5D5 - -loc_5F9: - add dl, dl - -loc_5FB: - mov si, 0 - jnb short loc_676 - dec dh - jz short loc_5E5 - -loc_604: - add dl, dl - -loc_606: - mov si, 0 - jnb short loc_676 - dec si - dec si - jmp short loc_676 -; --------------------------------------------------------------------------- - -loc_60F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_614: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_65D - call sub_8D8 - jmp short loc_65D -; --------------------------------------------------------------------------- - -loc_61F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_624: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_665 - call sub_8D8 - jmp short loc_665 -; --------------------------------------------------------------------------- - -loc_62F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_634: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_682 - call sub_8D8 - jmp short loc_682 -; --------------------------------------------------------------------------- - -loc_63F: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_644: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_690 - call sub_8D8 - jmp short loc_690 -; --------------------------------------------------------------------------- - -loc_64F: - movsw - -loc_650: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jnz short loc_659 - call sub_930 - -loc_659: - dec dh - jz short loc_60F - -loc_65D: - add dl, dl - jb short loc_5F5 - dec dh - jz short loc_61F - -loc_665: - add dl, dl - -loc_667: - mov si, 0 - jb short loc_676 - mov si, 0FFFCh - mov ax, [di-2] - cmp ah, al - jz short loc_6C1 - -loc_676: - cmp si, bp - mov bp, si - jz short loc_6CC - add si, di - -loc_67E: - dec dh - jz short loc_62F - -loc_682: - add dl, dl - jnb short loc_64F - mov ax, 1 - xor cx, cx - -loc_68B: - inc cx - dec dh - jz short loc_63F - -loc_690: - add dl, dl - jb short loc_68B - -loc_694: - dec dh - jz short loc_6B1 - -loc_698: - add dl, dl - adc ax, ax - loop loc_694 - jb short loc_6FB - -loc_6A0: - mov cx, ax - -loc_6A2: - mov ax, 0 - sub ax, di - shr ax, 1 - cmp cx, ax - jnb short loc_6ED - rep movsw - jmp short loc_659 -; --------------------------------------------------------------------------- - -loc_6B1: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_6B6: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_698 - call sub_8D8 - jmp short loc_698 -; --------------------------------------------------------------------------- - -loc_6C1: - cmp si, bp - mov bp, si - jz short loc_6CC - lea si, [di-2] - jmp short loc_67E -; --------------------------------------------------------------------------- - -loc_6CC: - mov al, [di-1] - -loc_6CF: - call sub_796 - stosw - mov al, ah - -loc_6D5: - ; Hack (cmp di, 0) - db 081h - db 0ffh - db 000h - db 000h - jz short loc_6E8 - -loc_6DB: - dec dh - jz short loc_711 - -loc_6DF: - add dl, dl - jb short loc_6CF - xor bp, bp - jmp loc_659 -; --------------------------------------------------------------------------- - -loc_6E8: - call sub_930 - jmp short loc_6DB -; --------------------------------------------------------------------------- - -loc_6ED: - sub cx, ax - xchg ax, cx - rep movsw - call sub_930 - sub si, word_34ADC - jmp short loc_6A0 -; --------------------------------------------------------------------------- - -loc_6FB: - xor cx, cx - -loc_6FD: - movsw - cmp di, word ptr aEasy+4 - loopne loc_6FD - jnz short loc_6A0 - call sub_930 - sub si, word_34ADC - jcxz short loc_6A0 - jmp short loc_6FD -; --------------------------------------------------------------------------- - -loc_711: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_716: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_6DF - call sub_8D8 - jmp short loc_6DF -sub_3E2 endp - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR sub_796 - -loc_721: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_726: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_785 - call sub_8D8 - jmp short loc_785 -; --------------------------------------------------------------------------- - -loc_731: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_736: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A0 - call sub_8D8 - jmp short loc_7A0 -; --------------------------------------------------------------------------- - -loc_741: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_746: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7A8 - call sub_8D8 - jmp short loc_7A8 -; --------------------------------------------------------------------------- - -loc_751: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_756: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7B3 - call sub_8D8 - jmp short loc_7B3 -; --------------------------------------------------------------------------- - -loc_761: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_766: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7BB - call sub_8D8 - jmp short loc_7BB -; --------------------------------------------------------------------------- - -loc_771: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_776: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7C3 - call sub_8D8 - jmp short loc_7C3 -; --------------------------------------------------------------------------- - -loc_781: - dec dh - jz short loc_721 - -loc_785: - add dl, dl - jb short loc_78C - lodsb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_78C: - mov ax, [si] - xchg ah, al - mov [si], ax - xor ah, ah - jmp short loc_7FB -; END OF FUNCTION CHUNK FOR sub_796 - -; =============== S U B R O U T I N E ======================================= - - -sub_796 proc near - -; FUNCTION CHUNK AT 0721 SIZE 00000075 BYTES - - mov bp, di - xor ah, ah - mov si, ax - dec dh - jz short loc_731 - -loc_7A0: - add dl, dl - jb short loc_781 - dec dh - jz short loc_741 - -loc_7A8: - add dl, dl - mov cx, 1 - jnb short loc_7C7 - dec dh - jz short loc_751 - -loc_7B3: - add dl, dl - jnb short loc_7BF - dec dh - jz short loc_761 - -loc_7BB: - add dl, dl - adc cx, cx - -loc_7BF: - dec dh - jz short loc_771 - -loc_7C3: - add dl, dl - adc cx, cx - -loc_7C7: - dec dh - jz short loc_7DB - -loc_7CB: - add dl, dl - adc cx, cx - add si, cx - std - lodsb - lea di, [si+1] - rep movsb - stosb - jmp short loc_7FB -; --------------------------------------------------------------------------- - -loc_7DB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7E0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_7CB - call sub_8D8 - jmp short loc_7CB -; --------------------------------------------------------------------------- - -loc_7EB: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_7F0: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_803 - call sub_8D8 - jmp short loc_803 -; --------------------------------------------------------------------------- - -loc_7FB: - xor ah, ah - mov si, ax - dec dh - jz short loc_7EB - -loc_803: - add dl, dl - jb short loc_844 - dec dh - jz short loc_85E - -loc_80B: - add dl, dl - mov cx, 1 - jnb short loc_82A - dec dh - jz short loc_86E - -loc_816: - add dl, dl - jnb short loc_822 - dec dh - jz short loc_87E - -loc_81E: - add dl, dl - adc cx, cx - -loc_822: - dec dh - jz short loc_88E - -loc_826: - add dl, dl - adc cx, cx - -loc_82A: - dec dh - jz short loc_89E - -loc_82E: - add dl, dl - adc cx, cx - add si, cx - std - mov ah, al - lodsb - lea di, [si+1] - rep movsb - stosb - xchg ah, al - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_844: - dec dh - jz short loc_8AE - -loc_848: - add dl, dl - jb short loc_852 - mov ah, [si] - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_852: - mov cx, [si] - xchg ch, cl - mov [si], cx - mov ah, cl - mov di, bp - cld - retn -; --------------------------------------------------------------------------- - -loc_85E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_863: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_80B - call sub_8D8 - jmp short loc_80B -; --------------------------------------------------------------------------- - -loc_86E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_873: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_816 - call sub_8D8 - jmp short loc_816 -; --------------------------------------------------------------------------- - -loc_87E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_883: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_81E - call sub_8D8 - jmp short loc_81E -; --------------------------------------------------------------------------- - -loc_88E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_893: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_826 - call sub_8D8 - jmp short loc_826 -; --------------------------------------------------------------------------- - -loc_89E: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8A3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_82E - call sub_8D8 - jmp short loc_82E -; --------------------------------------------------------------------------- - -loc_8AE: - mov dl, [bx] - inc bx - mov dh, 8 - -loc_8B3: - ; Hack (cmp bx, 0) - db 081h - db 0fbh - db 000h - db 000h - jnz short loc_848 - call sub_8D8 - jmp short loc_848 -sub_796 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8BE proc near - xor di, di - mov ax, 1000h - -loc_8C3: - mov cx, 10h - -loc_8C6: - stosb - sub al, 10h - loop loc_8C6 - add al, 10h - dec ah - jnz short loc_8C3 - retn -sub_8BE endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D2 proc near - mov ax, 3D00h - int 21h ; DOS - 2+ - OPEN DISK FILE WITH HANDLE - ; DS:DX -> ASCIZ filename - ; AL = access mode - ; 0 - read - retn -sub_8D2 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8D8 proc near - push ax - push cx - push dx - mov bx, word ptr aEasy ; "EASY" - mov dx, 1F60h - push dx - mov cx, word ptr aNormal+1 - mov ah, 3Fh - int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE - ; BX = file handle, CX = number of bytes to read - ; DS:DX -> buffer - jb short loc_8F2 - pop bx - pop dx - pop cx - pop ax - retn -; --------------------------------------------------------------------------- - -loc_8F2: - call sub_8FB - mov sp, cs:word_2A2 - retn -sub_8D8 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_8FB proc near - mov bx, word ptr aEasy ; "EASY" - mov ah, 3Eh - int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE - ; BX = file handle - retn -sub_8FB endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_904 proc near - cmp ax, 102h - jz short loc_918 - mov ch, 0C0h ; '' - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - retn -; --------------------------------------------------------------------------- - -loc_918: - mov ch, 80h - mov ah, 42h ; 'B' - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 8 - out 68h, al - mov ah, 40h - int 18h ; TRANSFER TO ROM BASIC - ; causes transfer to ROM-based BASIC (IBM-PC) - ; often reboots a compatible; often has no effect at all - mov al, 1 - out 6Ah, al ; PC-98 GDC (6a): - ; - or byte_34ADB, 4 - retn -sub_904 endp - - -; =============== S U B R O U T I N E ======================================= - - -sub_930 proc near - pusha - push es - cmp word ptr unk_34ADE, 7D00h - jl short loc_949 - sub word ptr unk_34ADE, 7D00h - or byte_34ADB, 1 - mov al, 1 - out 0A6h, al - -loc_949: - mov si, word ptr aEasy+4 - mov di, 160h - mov cx, word_34AD4 - sub si, cx - sub si, cx - rep movsw - mov si, di - mov cx, 4 - -loc_95F: - push cx - mov di, word ptr unk_34ADE - mov ax, word_34AD0 - and ax, 7 - jz short loc_9E4 - mov cx, 8 - sub cx, ax - push cx - mov ah, 0FFh - shl ah, cl - not al - xor bx, bx - mov dx, bx - -loc_97C: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_97C - mov cx, 0A800h - mov es, cx - assume es:nothing - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ah - test byte ptr word_34AD9, 40h - jz short loc_9D3 - mov ah, byte ptr word_34AD9+1 - shr ah, 1 - jnb short loc_9BB - not dh - -loc_9BB: - shr ah, 1 - jnb short loc_9C1 - not dl - -loc_9C1: - shr ah, 1 - jnb short loc_9C7 - not bh - -loc_9C7: - shr ah, 1 - jnb short loc_9CD - not bl - -loc_9CD: - or bx, dx - or bl, bh - or al, bl - -loc_9D3: - stosb - xor al, al - out 7Ch, al - pop ax - mov cx, word_34AD4 - sub cx, ax - shr cx, 3 - jmp short loc_9EB -; --------------------------------------------------------------------------- - -loc_9E4: - mov cx, word_34AD4 - shr cx, 3 - -loc_9EB: - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - lodsw - add al, al - adc bl, bl - add ah, ah - adc bl, bl - add al, al - adc bh, bh - add ah, ah - adc bh, bh - add al, al - adc dl, dl - add ah, ah - adc dl, dl - add al, al - adc dh, dh - add ah, ah - adc dh, dh - mov ax, 0A800h - mov es, ax - test byte ptr word_34AD9, 40h - jnz short loc_A97 - mov es:[di], dh - mov es:[di-8000h], dl - mov ah, 0B8h ; '' - mov es, ax - assume es:nothing - mov es:[di], bh - mov ah, 0E0h - mov es, ax - assume es:nothing - mov al, bl - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_A97: - mov ah, byte ptr word_34AD9+1 - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - shr ah, 1 - jnb short loc_AB5 - not dh - -loc_AB5: - shr ah, 1 - jnb short loc_ABB - not dl - -loc_ABB: - shr ah, 1 - jnb short loc_AC1 - not bh - -loc_AC1: - shr ah, 1 - jnb short loc_AC7 - not bl - -loc_AC7: - mov ax, dx - or ax, bx - or al, ah - stosb - dec cx - jz short loc_AD4 - jmp loc_9EB -; --------------------------------------------------------------------------- - -loc_AD4: - xor al, al - out 7Ch, al - mov cx, word ptr aHard ; "HARD" - and cx, 7 - jz short loc_B4F - mov ah, 8 - sub ah, cl - xor bx, bx - mov dx, bx - -loc_AE9: - lodsb - add al, al - adc bl, bl - add al, al - adc bh, bh - add al, al - adc dl, dl - add al, al - adc dh, dh - loop loc_AE9 - mov cl, ah - mov ch, 0FFh - shl ch, cl - shl bx, cl - shl dx, cl - mov ax, 0A800h - mov es, ax - assume es:nothing - mov al, 0C0h ; '' - out 7Ch, al - mov al, dh - out 7Eh, al - mov al, dl - out 7Eh, al - mov al, bh - out 7Eh, al - mov al, bl - out 7Eh, al - mov al, ch - test byte ptr word_34AD9, 40h - jz short loc_B4A - mov ah, byte ptr word_34AD9+1 - shr ah, 1 - jnb short loc_B32 - not dh - -loc_B32: - shr ah, 1 - jnb short loc_B38 - not dl - -loc_B38: - shr ah, 1 - jnb short loc_B3E - not bh - -loc_B3E: - shr ah, 1 - jnb short loc_B44 - not bl - -loc_B44: - or bx, dx - or bl, bh - or al, bl - -loc_B4A: - stosb - xor al, al - out 7Ch, al - -loc_B4F: - pop cx - add word ptr unk_34ADE, 50h ; 'P' - dec word ptr aNormal+5 - jz short loc_B68 - dec cx - jz short loc_B61 - jmp loc_95F -; --------------------------------------------------------------------------- - -loc_B61: - pop es - assume es:nothing - popa - mov di, word ptr aEasy+2 - retn -; --------------------------------------------------------------------------- - -loc_B68: - test byte_34ADB, 1 - jle short loc_B78 - mov al, 0 - out 0A6h, al - and byte_34ADB, 0FDh - -loc_B78: - call sub_8FB - mov sp, cs:word_2A2 - xor ax, ax - retn -sub_930 endp - -; --------------------------------------------------------------------------- - db 2 dup(0), 26h, 0, 4Ch, 0, 72h, 0, 98h, 0, 0BEh, 0, 0E4h - db 0, 0Ah, 1, 30h, 1, 56h, 1, 7Ch, 1, 0A2h, 1, 0C8h, 1 - db 0EEh, 1, 14h, 2, 3Ah, 2, 2 dup(0), 4Bh, 0, 96h, 0, 0E1h - db 0, 2Ch, 1, 77h, 1, 0C2h, 1, 0Dh, 2, 58h, 2, 0A3h, 2 - db 0EEh, 2, 39h, 3, 84h, 3, 0CFh, 3, 1Ah, 4, 65h, 4, 2 dup(0) - db 0Fh, 0, 1Eh, 0, 2Dh, 0, 3Ch, 0, 4Bh, 0, 5Ah, 0, 69h - db 0, 78h, 0, 87h, 0, 96h, 0, 0A5h, 0, 0B4h, 0, 0C3h, 0 - db 0D2h, 0, 0E1h, 0 - -; =============== S U B R O U T I N E ======================================= - - -sub_BE3 proc near - push bx - mov bl, byte_34AD8 - mov bh, 64h ; 'd' - mov di, 150h - xor cx, cx - -loc_BEF: - mov al, cl - mul bl - div bh - stosb - inc cl - cmp cl, 10h - jnz short loc_BEF - mov si, 100h - mov bx, 150h - mov cx, 10h - xor ah, ah - test byte ptr word_34AD9, 10h - jnz short loc_C25 - -loc_C0F: - mov al, ah - out 0A8h, al - lodsb - xlat - out 0ACh, al - lodsb - xlat - out 0AAh, al - lodsb - xlat - out 0AEh, al - inc ah - loop loc_C0F - pop bx - retn -; --------------------------------------------------------------------------- - -loc_C25: - mov al, 10h - sub al, cl - out 0A8h, al - mov dx, 40h - lodsb - add al, al - mov di, ax - add dx, cs:[di+0B83h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BA3h] - lodsb - add al, al - mov di, ax - add dx, cs:[di+0BC3h] - mov al, 7 - sub al, dh - xlat - mov dl, al - shr dl, 1 - sbb al, al - out 0AEh, al - shr dl, 1 - sbb al, al - out 0ACh, al - shr dl, 1 - sbb al, al - out 0AAh, al - loop loc_C25 - pop bx - retn -sub_BE3 endp - -; --------------------------------------------------------------------------- db 0 +include libs/piloadc/piloadc.asm include libs/master.lib/text_clear.asm ; =============== S U B R O U T I N E ======================================= @@ -1821,8 +91,7 @@ arg_2 = word ptr 6 push di xor ax, ax mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_711+1 + mov al, byte ptr es:[712h] inc ax mov dx, ax shl dx, 1 @@ -10028,8 +8297,7 @@ arg_0 = word ptr 6 mov bp, sp xor ax, ax mov es, ax - assume es:seg000 - mov al, byte ptr es:loc_538+3 + mov al, byte ptr es:[053Bh] cbw mov bx, ax mov dx, 62h ; 'b' @@ -15456,7 +13724,7 @@ loc_10BD9: push large 4000h push large [off_38E28] push large [bp+arg_0] - call sub_35A + call _PiLoadL add sp, 12h mov [bp+var_1], al @@ -17041,8 +15309,7 @@ arg_0 = word ptr 6 mov [bp+var_4], ax xor ax, ax mov es, ax - assume es:seg000 - test byte ptr es:loc_54B+2, 4 + test byte ptr es:[054Dh], 4 jnz short loc_1177C mov [bp+var_6], 0 jmp short loc_11781 @@ -18692,8 +16959,7 @@ var_4 = dword ptr -4 call SCOPY@ xor ax, ax mov es, ax - assume es:seg000 - movsx eax, word ptr es:loc_3C8+2 + movsx eax, word ptr es:[03CAh] shl eax, 10h add eax, 102h shld edx, eax, 10h