OSDN Git Service

capslock等対応
authoryamat0jp <yamat0jp@yahoo.co.jp>
Wed, 7 Nov 2018 08:03:55 +0000 (17:03 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Wed, 7 Nov 2018 08:03:55 +0000 (17:03 +0900)
pic object

bootpack.pas
wand.dpr
wand.dproj

index 61d1405..bf7aa8a 100644 (file)
@@ -25,7 +25,7 @@ const
 
 type
   TBOOTINFO = record
-    cyls, legs, vmode, reserve: Int8;
+    cyls, leds, vmode, reserve: Int8;
     scrnx, scrny: Int16;
     vram: TBytes;
   end;
@@ -180,6 +180,17 @@ type
     function memfree(mem: TMEMMAN; addr, size: Cardinal): integer;
   end;
 
+  TDesk = class
+  public
+    constructor Create;
+  end;
+
+  TPic = class
+  public
+    constructor Create;
+    procedure inthandler27(var esp: integer);
+  end;
+
   TSheet = class
   private const
     table: array [0 .. 14, 0 .. 2] of Byte = (($00, $00, $00), ($FF, $00, $00),
@@ -228,9 +239,9 @@ type
 
   TConsole = class(TWindow)
   private
-    fifo: TFifo;
     ctl: TCtl;
   public
+    fifo: TFifo;
     constructor Create(xsize, ysize: integer; title: string; act: integer);
     destructor Destroy; override;
   end;
@@ -877,6 +888,7 @@ var
   x: Boolean;
   j: integer;
 begin
+  x := false;
   for i := 0 to High(task) do
   begin
     s := task[i];
@@ -989,8 +1001,9 @@ procedure TShtCtl.refresh(obj: TSheet);
 var
   arect: TRect;
 begin
-  arect:=obj.clip;
-  refresh(arect.Left+obj.vx0,arect.Top+obj.vy0,arect.Right+obj.vx0,arect.Bottom+obj.vy0);
+  arect := obj.clip;
+  refresh(arect.Left + obj.vx0, arect.top + obj.vy0, arect.Right + obj.vx0,
+    arect.Bottom + obj.vy0);
 end;
 
 procedure TShtCtl.refreshmap(arect: TRect);
@@ -1340,7 +1353,7 @@ end;
 
 constructor TConsole.Create(xsize, ysize: integer; title: string; act: integer);
 var
-  i, c: integer;
+  i: integer;
   s: TTask;
   str: string;
 begin
@@ -1383,6 +1396,15 @@ begin
         clip := rect(cursor_x, 28, cursor_x + 8, 44);
         refresh := true;
       end;
+      case i of
+        2:
+          cursor_c := COL8_FFFFFF;
+        3:
+          begin
+            boxfill8(COL8_000000, cursor_x, 28, cursor_x + 7, 43);
+            cursor_c := -1;
+          end;
+      end;
       if (i >= 256) and (i <= 511) then
         if i = 8 + 256 then
         begin
@@ -1399,6 +1421,8 @@ begin
           putfonts8_asc(cursor_x, 28, 1, str);
           inc(cursor_x, 8);
         end;
+      if cursor_c >= 0 then
+        boxfill8(cursor_c, cursor_x, 28, cursor_x + 7, 43);
       boxfill8(cursor_c, cursor_x, 28, cursor_x + 7, 43);
       refresh := true;
     end;
@@ -1430,4 +1454,37 @@ begin
   end;
 end;
 
+{ TPic }
+
+constructor TPic.Create;
+begin
+  io_out8(PIC0_IMR, $FF);
+  io_out8(PIC1_IMR, $FF);
+
+  io_out8(PIC0_ICW1, $11);
+  io_out8(PIC0_ICW2, $20);
+  io_out8(PIC0_ICW3, 1 shl 2);
+  io_out8(PIC0_ICW4, $01);
+
+  io_out8(PIC1_ICW1, $11);
+  io_out8(PIC1_ICW2, $28);
+  io_out8(PIC1_ICW3, 2);
+  io_out8(PIC1_ICW4, $01);
+
+  io_out8(PIC0_IMR, $FB);
+  io_out8(PIC1_IMR, $FF);
+end;
+
+procedure TPic.inthandler27(var esp: integer);
+begin
+  io_out8(PIC0_OCW2, $67);
+end;
+
+{ TDesk }
+
+constructor TDesk.Create;
+begin
+
+end;
+
 end.
index 571504e..5b21a3a 100644 (file)
--- a/wand.dpr
+++ b/wand.dpr
@@ -11,30 +11,36 @@ uses
 
 const
   MEMMAN_ADDR = $003C0000;
+  KEYCMD_LED = $ED;
 
 var
   binfo: ^TBOOTINFO = Pointer(ADR_BOOTINFO);
   mouse: TMouse;
   ctl: TCtl;
   keyboard: TKeyboard;
-  key_to: integer;
-  i: SmallInt;
+  key_to, key_shift, key_leds, keycmd_wait: integer;
+  i: integer;
   memtest: TMemtest;
   memtotal: Cardinal;
   memman: ^TMEMMAN = Pointer(MEMMAN_ADDR);
   mem: TMem;
+  pic: TPic;
   sheet: TShtCtl;
   mo, win, cons: TSheet;
   s: string;
-  fifo: TFifo;
+  fifo, keycmd: TFifo;
   mx, my: integer;
 
 begin
+  key_leds := (binfo^.leds shr 4) and 7;
+  keycmd_wait := -1;
+  pic := TPic.Create;
   {
     TAsmhead.Init;
     TAsmhead.Boot;
   }
   fifo := TFifo.Create(128);
+  keycmd := TFifo.Create(32);
   keyboard := TKeyboard.Create(fifo, 216);
   key_to := 0;
   mouse := TMouse.Create(fifo, 512);
@@ -67,11 +73,18 @@ begin
     sheet.slide(win, 80, 72);
     sheet.updown(mo, 1);
     sheet.updown(win, 2);
-    // sprintf
     sheet.screen.putfonts8_asc_sht(0, 32, s);
     sheet.refresh(0, 0, 80, 16);
+    keycmd.Put(KEYCMD_LED);
+    keycmd.Put(key_leds);
     while True do
     begin
+      if (keycmd.Status > 0) and (keycmd_wait < 0) then
+      begin
+        keycmd_wait := keycmd.Get;
+        keyboard.wait_KBC_sendready;
+        io_out8(TKeyboard.PORT_KEYDAT, keycmd_wait);
+      end;
       io_cli;
       if fifo.Status = 0 then
         io_stihlt
@@ -100,16 +113,20 @@ begin
               key_to := 1;
               sheet.updown(win, 0);
               sheet.updown(cons, 1);
+              cons.cursor_c:=-1;
+              (cons as TConsole).fifo.Put(2);
             end
             else
             begin
               key_to := 0;
               sheet.updown(win, 1);
               sheet.updown(cons, 0);
+              cons.cursor_c:=COL8_000000;
+              TConsole(cons).fifo.Put(3);
             end;
           end;
-          win.clip:=Rect(0,0,win.bxsize,21);
-          cons.clip:=Rect(0,0,cons.bxsize,21);
+          win.clip := Rect(0, 0, win.bxsize, 21);
+          cons.clip := Rect(0, 0, cons.bxsize, 21);
           sheet.refresh(win);
           sheet.refresh(cons);
           case i of
@@ -123,20 +140,20 @@ begin
               ;
             256 + $3A:
               begin
-                key_leds = key_leds * key_leds * key_leds * key_leds;
-                fifo.Put(KEYCMD_LED);
-                fifo.Put(key_leds);
+                key_leds := key_leds * key_leds * key_leds * key_leds;
+                keycmd.Put(KEYCMD_LED);
+                keycmd.Put(key_leds);
               end;
             256 + $45:
               begin
                 key_leds := key_leds * key_leds;
-                fifo.Put(KEYCMD_LED);
-                fifo.Put(key_leds);
+                keycmd.Put(KEYCMD_LED);
+                keycmd.Put(key_leds);
               end;
             256 + $46:
               begin
-                fifo.Put(KEYCMD_LED);
-                fifo.Put(key_leds);
+                keycmd.Put(KEYCMD_LED);
+                keycmd.Put(key_leds);
               end;
             256 + $FA:
               keycmd_wait := -1;
@@ -148,7 +165,7 @@ begin
           end;
           win.boxfill8(win.cursor_c, win.cursor_x, 28, win.cursor_x + 8, 44);
         end
-        else if (i >= 512) and (i <= 711) then
+        else if (i >= 512) and (i <= 767) then
         begin
           if mouse.decode(i) <> 0 then
           begin
@@ -172,7 +189,6 @@ begin
               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);
@@ -186,11 +202,17 @@ begin
             sheet.refresh(0, 64, 56, 80);
           end;
           sheet.refresh(0, 0, 80, 16);
+        end
+        else if i <= 1 then
+        begin
+
         end;
       end;
     end;
   finally
+    pic.Free;
     fifo.Free;
+    keycmd.Free;
     sheet.Free;
     win.Free;
     mo.Free;
index b41bb96..fa98425 100644 (file)
                 <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
             </Deployment>
             <Platforms>
                 <Platform value="Android">False</Platform>