EMS info

 BBS: Inland Empire Archive
Date: 04-02-92 (08:53)             Number: 196
From: MATT HART                    Refer#: NONE
  To: JAMES VAHN                    Recvd: NO  
Subj: EMS info                       Conf: (2) Quik_Bas
 JV> mov di,offset buffer
 JV> mov ax,5900h
 JV> int 67h
 JV> for i=buffer to i+9
 JV>  print peek(i);
 JV> next i

 JV> or something along those lines.  BTW- Howcum nobody has written an ASM
 JV> .lib yet?  Impossible?

Here's a little assembly routine I did for test purposes -
not really what you are talking about, but it makes looking
at the contents of a memory location very simple.

; PRINTMEM.ASM  Matt Hart
;
; Place the contents of memory into a string.
; DECLARE SUB PrintMem(Strg$, BYVAL Segment%, BYVAL Offset%)
;
; Set Strg$ = SPACE$(NumBytesToRead)

.MODEL MEDIUM,BASIC
.CODE

PrintMem PROC USES DS ES SI DI, Strg:Word, SegNum:Word, OffNum:Word
    MOV     AX,SegNum       ; Segment into AX
    MOV     SI,OffNum       ; Offset into SI

    MOV     BX,Strg         ; Addr of Strg Descriptor into BX
    MOV     DI,[BX+2]       ; Addr of Strg's first byte into DI
    MOV     CX,[BX]         ; Length of Strg into CX

    MOV     DX,DS           ; DS into DX - can't do MOV ES,DS directly
    MOV     ES,DX           ; ES:DI is now destination
    MOV     DS,AX           ; DS:SI is now source, CX has num bytes

    REP     MOVSB           ; Move DS:SI into ES:DI for CX times

    RET                     ; Back to BASIC
PrintMem ENDP
END

The BYVAL keyword is important - it makes getting the value
of those variables easier.  You can either put the BYVAL in
the DECLARE SUB or use it in the call:

     Strg$ = SPACE$(1024)
     Segment = VARSEG(Strg$)       ' Dgroup
     Offset = 0                    ' Starting position
     CALL PrintMem(Strg$, BYVAL Segment, BYVAL Offset)
     PRINT Strg$

That would print the first 1K of the contents of Dgroup.


'XRS 5.0 Offline Reader/Editor'  Matt E. Hart, QB Guru

---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET