Page 1 of 1

Addresses

Posted: Sat Mar 22, 2003 12:08 pm
by Guest
Running DOS.6.2 and using QB.4.5

The following coding will turn CapsLock on:

DEF SEG = 0
POKE &H417, PEEK(&H417) OR &H40
DEF SEG

This turns on bit 6 of &H0417 - but I don't understand how the address &H417 was arrived at.   How can I find out where various other control bytes/bits are stored??

For example, if I want to turn on/off NumLock and ScrollLock how do I determine what address to change??

Re: Addresses

Posted: Sun Mar 23, 2003 12:52 am
by John_Schofield
Hi

This bit was sent to me recently on another thread, for turning num lock on:

DEF SEG = (&H40)
text$ = ""
DO
POKE &H17, (PEEK(&H17) OR &H20)

Not sure about turning it off though!

Re: Addresses

Posted: Wed Mar 26, 2003 11:32 am
by Guest
Thanks a bundle for your response but it doesn't satisfy my thirst for knowledge so if anyone else would like to drop in please do so.

Re: Addresses

Posted: Mon Apr 07, 2003 9:15 am
by Baz
Hi.
I have never realy found a true explanation of useing  DEF SEG and PEEKS & POKES but i will try to explain what I know/learnt by trial and error.
I cant guarentee anything its really just down to experimenting.

Below is a simple sort of prog, i apologise for its bad variable assignments but hope it may help to see what is happening.

Defining the segment &h40
Whilst not essential it helps to shorten hex entries
(if your playing in the upper areas of memory like &HA0000 then it is more usefull)

So useing a DEF SEG of 0 and given the byte we are interested in is at h417 the address of &h417 is used

Useing a DEF SEG of &h40 shortens the address we want to look at to &h17

Running the prog below will show 7 rows of data.
All kinds of things happening although the bit we are interested in will appear on the 2nd line down at ( give you a clue h17).

Pressing numlock, caplock etc should reveal the byte we are interested in.

Changing the DEF SEG to say &HA0000 should reveal what is displayed in the video area although you may have to fine tune the address a little and probably run it from DOS not Windows (not sure what results you might get under windows)
---------------------------------------------------------
DEF SEG = &H40
CLS
DO
LOCATE 1, 1
FOR f = 0 TO 128
x = PEEK(f) AND 255
v$ = HEX$(x): IF LEN(v$) = 1 THEN v2$ = "0" + v$: v$ = v2$
PRINT v$; " ";
d = d + 1: IF d = 16 THEN d = 0: PRINT
NEXT
FOR g = 1 TO 10000: NEXT
LOOP
------------------------------------------------------------------


Hope this helps a little......

Re: Addresses

Posted: Sat May 03, 2003 4:10 am
by Guest
Thanks Baz but what I'm really looking for is how to determine the address I'm looking for. In other words if I'm looking for the byte which turns on/off Capslock how can I find its address?? OK lotsa folks know the addresses but how did they find them to start with?

Thanks again.

Re: Addresses

Posted: Mon May 05, 2003 2:32 pm
by Guest
Try using Google and seach for:

INTERRUPTS and refine it by searching for "RALF BROWN".  (or vice versa)

He has amassed an impressive list of addresses from a variety of mfgs.  Some of which I have never heard of.

Take a look at it, you may find it quite useful.

--MiggyD

PS:     Here's a small example from Mr. Brown regarding the INT 26 (hopefully, it's readable):
---------------------------------------------
INT 26 - DOS - ABSOLUTE DISK WRITE (except DOS 4.0/COMPAQ DOS 3.31 >32M partn)
     AL = drive number (0=A, 1=B, etc)
     DS:BX = Disk Transfer Address (buffer)
     CX = number of sectors to write
     DX = first relative sector to write
Return: CF set on error
         AL = error code issued to INT 24h in low half of DI
         AH = same error codes as for INT 25h
     CF clear if successful
         AL = 00h
Note:      ORIGINAL FLAGS ON STACK!  Must be popped or discarded by adjusting SP
BUG:      DOS 3.1 through 3.3 set the word at ES:[BP+1Eh] to FFFFh if AL is an
     invalid drive number
SeeAlso: INT 25, INT 13/AH=03h
---------------------------------------------
INT 26 - DOS 4.0/COMPAQ DOS 3.31 - ABSOLUTE DISK WRITE (>32M hard-disk partitn)
     AL = drive number (0=A, 1=B, etc)
     CX = FFFFh
     DS:BX -> disk write packet (see below)
Return: same as above
Notes:      partition is potentially >32M (and requires this form of the call) if
       bit 1 of device attribute word in device driver is set
     ORIGINAL FLAGS LEFT ON STACK!  Must be popped or discarded by adj SP
SeeAlso: INT 25, INT 13/AH=03h

Format of disk write packet:
Offset      Size      Description
00h      DWORD      sector number
04h      WORD      number of sectors to read
06h      DWORD      transfer address
---------------------------------------------