getscore.c

来自「经典的老游戏digger的源代码.提起digger相信很多人会回忆起曾经为了它挑」· C语言 代码 · 共 43 行

C
43
字号
/* Digger Remastered
   Copyright (c) Andrew Jenner 1998-2004 */

/* GETSCORE.C - retrieve original Digger score table
   Compile with Turbo C 2.01 (http://community.borland.com/museum)
*/

#include <dos.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

void main(int argc,char *argv[])
{
  int dr,r;
  char buffer[512];
  FILE *out;
  if (argc<2) {
    printf("Syntax: GETSCORE <floppy drive letter>\n");
    exit(1);
  }
  dr=toupper(argv[1][0])-'A';
  _DL=dr;
  _BX=(int)buffer;
  _ES=_DS;
  _DH=0;      /* Head 0 */
  _AX=0x201;  /* Interrupt 0x13 function 2 - Read sectors, AL=1 sector */
  _CX=0x2707; /* Track 0x27, sector 7 */
  geninterrupt(0x13);
  r=_AL;
  if (r!=0) {
    printf("Error: Could not read sector (0x%02x)\n",r);
    exit(1);
  }
  out=fopen("digger.sco","wb");
  if (out==NULL) {
    printf("Error: Could not open output file: %s\n",sys_errlist[errno]);
    exit(1);
  }
  fwrite(buffer,512,1,out);
  fclose(out);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?