The MikeOS KB I/O project assembly routines...

Help and discussion about non-Linux operating systems

Moderators: ChrisThornett, LXF moderators

The MikeOS KB I/O project assembly routines...

Postby Bazza » Thu Apr 22, 2010 6:34 pm

Hi all...

As promised the assembler code to use a modified KB as I/O
inside MikeOS and running from a netbook... :-O
Notice I have kept these as separate subroutines rather than
a single piece of code which would of course be smaller in
compiled size...

Code: Select all
; CAPSLOCK ON/OFF sub-routines for MikeOS.
; Original copyright, (C)2010, B.Walker, G0LCU.
; For use with MikeBASIC and issued as Public Domain.

; CAPSLOCK.ASM, Version 0.00.10, assembly code.

; Assembled under MS-DOS using the AD86 combination.
; The binary is 48 bytes in size.

;CAPSON:
   pushf         ;Store flags and all of the used
   push   ax      ;registers.
   push   dx      ;
   push   ds      ;
   mov   dx,0040h   ;Point to the SEGMENT to access
   mov   ds,dx      ;the REAL time BYTE KB storage.
   mov   al,[0017h]   ;Move the BYTE value from memory
            ;into the AL register.
   or   al,040h      ;SET the required bit, (bit 6),
            ;to a ~1~.
            ;NOTE, change this value for NUMLOCK!
   mov   [0017h],al   ;Replace the modified byte back
            ;into the memory location.
   int   9      ;Now execute the necessary interrupt.
   pop   ds      ;Restore the registers back to
   pop   dx      ;their original values...
   pop   ax      ;
   popf         ;And the flags too.
   ret         ;Return to the calling routine.

;CAPSOFF:
   pushf         ;Store flags and all of the used
   push   ax      ;registers.
   push   dx      ;
   push   ds      ;
   mov   dx,0040h   ;Point to the SEGMENT to access
   mov   ds,dx      ;the REAL time BYTE KB storage.
   mov   al,[0017h]   ;Move the BYTE value from memory
            ;into the AL register.
   and   al,0bfh      ;RESET the required bit, (bit 6),
            ;to a ~0~, keeping all other bits intact.
            ;NOTE, change this value for NUMLOCK!
   mov   [0017h],al   ;Replace the modified byte back
            ;into the memory location.
   int   9      ;Now execute the necessary interrupt.
   pop   ds      ;Restore the registers back to
   pop   dx      ;their original values...
   pop   ax      ;
   popf         ;And the flags too.
   ret         ;Return to the calling routine.

; CAPSLOCK.ASM assembly code end.

; KBFALGS.ASM, Version 0.00.10.

; Keyboard flags memory location in "real time" READ only mode.
; Issued as PD for MikeOS and LXF.
; To work in conjuction with MikeBASIC.

; Keyoard HW modification, (C)2010, B.Walker, G0LCU.
; 8088 CPU instruction set compatible.
; Assembled under MS-DOS using AD86 combination,

;KBFLAGS:
   pushf         ;Push all used registers
   push   ax      ;and flags.
   push   dx      ;
   push   ds      ;
   mov   dx,0040h   ;Point to the SEGMENT 0x0040h.
   mov   ds,dx      ;Do it.
   mov   al,[0017h]   ;Read the memory offset 0x0017h
            ;and place into the al register.
   pop   ds      ;Pop these two registers back.
   pop   dx      ;
   mov   [store],al   ;Move the value in the registsr
            ;~AL~ into a known MikeOS memory
            ;location.
   pop   ax      ;Now pop the ~AX~ register back
   popf         ;and the flags.
   ret         ;Return back to calling routine.
store   db   0c3h      ;The keyboard flags stored for
            ;my usage...
; END of flags read routine.


I have not given an explanation here as this will be part of
the project for MikeOS, but I suspect that there is enough
info inside the code...

For more information Google "segment:offset 0040:0017"...
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Return to Other OS

Who is online

Users browsing this forum: Bing [Bot] and 1 guest