Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Other OS
View previous topic :: View next topic  
Author Message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1468
Location: Loughborough

PostPosted: Thu Apr 22, 2010 7:34 pm    Post subject: The MikeOS KB I/O project assembly routines... Reply with quote

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:

; 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...
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Other OS All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast