TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: BARRY BLOCK
date: 1997-04-05 06:25:00
subject: peekpoke.asm 2/3

        call    K2
        pop     ax
        add     dx,     ax              ;add low nibble to hi nibble
        mov     ax,     dx
        stosb                           ;storage till all collected w/o error
        loop    K1
        pop     ax                      ;clear error marker off stack
        mov     es,     [_seg]
        mov     di,     [oset]
        mov     cx,     [siz]
        mov     si,     o pok
        rep     movsb                   ;bytes written to ram
        jmp     quit
;-------
K2:     lodsb
        mov     dl,     al
        call    ValCh
        jnc     ret
        cmp     al,     13
        jne     Err3
        ret
;-------
Err3:   pop     dx                      ;error. reset stack
        cmp     dx,     -1              ;stack marker
        jne     Err3
        jmp     short   Usage
;-------------------------------------------------------------------------
Option:                                 ;peek or poke
        call    SkipSpace               ;loop past spaces on commandline
        cmp     al,     '?'
        je      L2
L1:     cmp     al,     '='
        jne     Err
L2:     mov     di,     o opt
        stosb
        ret
;----------------------------------------
SkipSpace:                              ;shared routine
        lodsb
        cmp     al,     13              ;end of commandline?
        je      Err
        cmp     al,     32              ;space? tab? etc. then skip it.
        jbe     SkipSpace
        ret
;-------
Err:    stc                             ;Error. return w/ carry flag set
        ret
;-----------------------------------------------------------------------
Size:                                   ;Byte, Word or Doubleword
        call    SkipSpace
        or      al,     20h
        mov     dl,     1               ;convert to # of bytes to process
        cmp     al,     'b'
        je      S1
        inc     dl                      ;convert to # of bytes to process
        cmp     al,     'w'
        je      S1
        shl     dl,     1               ;convert to # of bytes to process
        cmp     al,     'd'
        jne     Err
S1:     xor     ah,     ah
        mov     al,     dl
        mov     di,     o siz           ;store siz
        stosw
        ret
;---------------------------------------------------------------------------
Address:                                ;get segment:offset from commandline
        mov     si,     80h
        cmp     b[si],  0
        je      Err
        xor     bx,     bx              ;flag. Doing seg or offset?
A0:     jmp     short   GetNum          ;read commandline
                                        ;ascii bytes to number words on stack
A1:     inc     bx
        cmp     al,':'
        je      AddNum                  ;add stack words
        cmp     al,' '
        je      AddNum                  ;add stack words
        jne     Err2                    ;syntax error
A2:     cmp     bx,     1
        jne     A3
        mov     di,     o _seg
        stosw                           ;segment is stored
        jmp     short   A0
A3:     mov     di,     o oset
        stosw                           ;segment offset is stored
        ret
;---------------------------------------
GetNum: call    SkipSpace
--- Terminate 4.00/Pro
---------------
* Origin: EBO-BBS A'dam +31-20-6002828 (2:280/901.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.