OSDN Git Service

funcは将来利用できません エラー対応です
authoryamat0jp <yamat0jp@yahoo.co.jp>
Sat, 3 Nov 2018 13:05:59 +0000 (22:05 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Sat, 3 Nov 2018 13:05:59 +0000 (22:05 +0900)
task , timer を実装・強化

bootpack.pas
func.pas [new file with mode: 0644]
wand.dpr
wand.dproj

index f616f30..68379a3 100644 (file)
@@ -13,18 +13,18 @@ type
     vram: TBytes;
   end;
 
-  TFIFO8 = record
+  TFIFO32 = record
     buf: array of UInt32;
     p, q, size, free, flags: integer;
   end;
 
   TFifo = class
   private
-    fifo: TFIFO8;
+    fifo: TFIFO32;
   public
     constructor Create(size: integer);
     destructor Destroy; override;
-    function Put(data: Byte): integer;
+    function Put(data: integer): integer;
     function Get: SmallInt;
     function Status: integer;
   end;
@@ -46,9 +46,14 @@ type
   end;
 
   TKeyboard = class(TDevice)
+  const
+    cursor_c = COL8_FFFFFF;
   private
     keydata: integer;
+    procedure make_table(const keys1, keys2: array of const);
   public
+    keytable0, keytable1: array [$00 .. $80] of Byte;
+    cursor_x: integer;
     constructor Create(fifo: TFifo; data0: integer);
     procedure inthandler21(var esp: integer); override;
   end;
@@ -154,7 +159,7 @@ begin
   fifo.q := 0;
 end;
 
-function TFifo.Put(data: Byte): integer;
+function TFifo.Put(data: integer): integer;
 begin
   if fifo.free = 0 then
   begin
@@ -423,7 +428,21 @@ begin
   wait_KBC_sendready;
   io_out8(PORT_KEYCMD, KEYCMD_WRITE_MODE);
   wait_KBC_sendready;
-  io_out8(PORT_KEYDAT, KBC_MODE)
+  io_out8(PORT_KEYDAT, KBC_MODE);
+  make_table([0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^',
+    $08, 0, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', $0A, 0,
+    'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0, 0, ']', 'Z', 'X',
+    'C', 'V', 'B', 'N', 'M', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3',
+    '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, $5C, 0, 0, 0, 0, 0, 0, 0, 0, 0, $5C, 0, 0],
+    [0, 0, '!', $22, '#', '$', '%', '&', $27, '(', ')', '~', '=', '~', $08, 0,
+    'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', $0A, 0, 'A',
+    'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0, 0, '}', 'Z', 'X', 'C',
+    'V', 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0',
+    '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, '_', 0, 0, 0, 0, 0, 0, 0, 0, 0, '|', 0, 0]);
 end;
 
 procedure TKeyboard.inthandler21(var esp: integer);
@@ -435,4 +454,14 @@ begin
   fifo.Put(i + keydata);
 end;
 
+procedure TKeyboard.make_table(const keys1, keys2: array of const);
+var
+  i: integer;
+begin
+  for i := 0 to High(keys1) do
+    keytable0[i] := keys1[i].VType;
+  for i := 0 to High(keys2) do
+    keytable1[i] := keys2[i].VType;
+end;
+
 end.
diff --git a/func.pas b/func.pas
new file mode 100644 (file)
index 0000000..7c90614
--- /dev/null
+++ b/func.pas
@@ -0,0 +1,14 @@
+unit func;
+
+interface
+
+procedure farjump(eip, cs: integer);
+
+implementation
+
+procedure farjump(eip, cs: integer);
+begin
+
+end;
+
+end.
index e51288f..c8629ec 100644 (file)
--- a/wand.dpr
+++ b/wand.dpr
@@ -7,7 +7,9 @@ uses
   System.Classes,
   bootpack in 'bootpack.pas',
   asmhead in 'asmhead.pas',
-  graphic in 'graphic.pas';
+  graphic in 'graphic.pas',
+  timer in 'timer.pas',
+  func in 'func.pas';
 
 const
   MEMMAN_ADDR = $003C0000;
@@ -15,6 +17,7 @@ const
 var
   binfo: ^TBOOTINFO = Pointer(ADR_BOOTINFO);
   mouse: TMouse;
+  ctl: TCtl;
   keyboard: TKeyboard;
   i: SmallInt;
   memtest: TMemtest;
@@ -35,7 +38,8 @@ begin
   fifo := TFifo.Create(128);
   keyboard := TKeyboard.Create(fifo, 216);
   mouse := TMouse.Create(fifo, 512);
-  sheet := TShtCtl.Create(binfo^.scrnx,binfo^.scrny);
+  ctl := TCtl.Create(fifo);
+  sheet := TShtCtl.Create(binfo^.scrnx, binfo^.scrny);
   mo := TCursor.Create(16, 16, 99);
   win := TWindow.Create(160, 68, 'Window', -1);
   try
@@ -67,23 +71,31 @@ begin
     while True do
     begin
       io_cli;
-      if fifo.Status + fifo.Status = 0 then
+      if fifo.Status = 0 then
         io_stihlt
       else
       begin
-        if fifo.Status <> 0 then
-        begin
-          i := fifo.Get;
-          io_sti;
-          // sprintf
-          sheet.screen.boxfill8(COL8_008484, 0, 16, 15, 31);
-          sheet.screen.putfonts8_asc_sht(0, 16, s);
-          sheet.refresh(0, 16, 16, 32);
-        end
-        else if fifo.Status <> 0 then
+        i := fifo.Get;
+        io_sti;
+        if (i >= 256) and (i <= 511) then
+          with keyboard do
+          begin
+            if i >= $54 + 256 then
+              if (keytable0[i - 256] <> 0) and (cursor_x < 144) then
+              begin
+                s[1] := Char(keytable0[i - 256]);
+                win.putfonts8_asc_sht(cursor_x, 28, s);
+                inc(cursor_x, 8);
+              end;
+            if (i <= 256 + $0E) and (cursor_x > 8) then
+            begin
+              win.putfonts8_asc_sht(cursor_x, 28, ' ');
+              dec(cursor_x, 8);
+            end;
+            win.boxfill8(cursor_c, cursor_x, 28, cursor_x + 8, 44);
+          end
+        else if (i >= 512) and (i <= 711) then
         begin
-          i := fifo.Get;
-          io_sti;
           if mouse.decode(i) <> 0 then
           begin
             // sprontf
@@ -102,16 +114,23 @@ begin
               mx := 0;
             if my < 0 then
               my := 0;
-            if mx > binfo^.scrnx - 1 then
-              mx := binfo^.scrnx - 1;
-            if my > binfo^.scrny - 1 then
-              my := binfo^.scrny - 1;
+            if mx > sheet.screen.bxsize - 1 then
+              mx := sheet.screen.bxsize - 1;
+            if my > sheet.screen.bysize - 1 then
+              my := sheet.screen.bysize - 1;
             // sprintf
             sheet.screen.boxfill8(COL8_008484, 0, 0, 78, 15);
             sheet.screen.putfonts8_asc_sht(0, 0, s);
             sheet.refresh(0, 0, 80, 16);
             sheet.slide(mo, mx, my);
           end;
+          if fifo.Status <> 0 then
+          begin
+            i := fifo.Get;
+            io_sti;
+            sheet.screen.putfonts8_asc_sht(0, 64, '10sec');
+            sheet.refresh(0, 64, 56, 80);
+          end;
           sheet.refresh(0, 0, 80, 16);
         end;
       end;
index f100e08..56195f6 100644 (file)
         <DCCReference Include="bootpack.pas"/>
         <DCCReference Include="asmhead.pas"/>
         <DCCReference Include="graphic.pas"/>
+        <DCCReference Include="timer.pas"/>
+        <DCCReference Include="func.pas"/>
         <RcItem Include="hankaku.bin">
             <ContainerId>ResourceItem</ContainerId>
             <ResourceType>RCDATA</ResourceType>
                         <Operation>1</Operation>
                     </Platform>
                 </DeployClass>
-                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSDevice" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
             </Deployment>
             <Platforms>
                 <Platform value="Android">False</Platform>