A83: ZASMLOAD questions


[Prev][Next][Index][Thread]

A83: ZASMLOAD questions




OK, I have some questions about the functioning of ZASMLOAD.
I've pasted the source code here; my questions appear with a series of 
characters preceding them   >-->


    include squish.inc
    include tokens.inc
    include memequ.inc >--> What's this include file do?

;
;   input : 'Ans' contanis a string with the name of the ASM program to 
load
;
;
    org     9327h
;
    call    _zeroop1
    ld      a,tans
    ld      (op1+1),a
    call    _findsym
    jp      c,_errundefined  ; error if not there
;
;   de = ptr to data
;
    and     1fh
    cp      strngobj
    jp      nz,_errsyntax
;
    ld      hl,op1
    ld      (hl),progobj
    inc     hl
    ld      a,(de)           ; get size of name
    ld      c,a
    ld      b,0
    inc     de
    inc     de               ; (de) = 1st byte of prog name
    ex      de,hl
    ldir                     ; name to op1
;
;   op1 = name of asm prog to load
;
    call    _chkfindsym      ; look up
    jp      c,_errundefined
;
    ex      de,hl
    call    _ldhlind         ; HL = SIZE of prog to load
    PUSH    HL
    ld      de,insert_start-9327h

>--> Ok, insert_start-9327h would be an offset from the beginning
>--> of the program.  But, why insert_start?  What's special
>--> about that label?

    or      a
    sbc     hl,de            ; hl = amount to insert
    push    hl
    CALL    _ERRNOTENOUGHMEM   ; ERROR IF NOT ENOUGH MEM

>--> I don't grasp the logic of these last 4 lines at all.

;
    POP     HL               ; amount to insert
    push    hl
;
    LD      DE,insert_start   ; START OF INSERT
    CALL    _INSERTMEM        ; INSERT MEM, ADJUST PTRS

>--> How does _INSERTMEM work?

    POP     HL               ; AMOUNT INSERTTED
    push    hl
;
    ld      de,(usermem_offset)
    add     hl,de                       ; new total insertted
    LD      (USERMEM_OFFSET),HL   ; SAVE AMOUNT SO CAN CLEAN UP LATER

>--> What is USERMEM_OFFSET?

;
    pop     hl
    ld      de,insert_start
    add     hl,de            ; loader here
    jp      (hl)
;
insert_start:

>--> And here's that label again!  Why is it important?

    call    _chkfindsym      ; look up
    jp      c,_errundefined
;
    ex      de,hl
    inc     hl
    inc     hl               ; start of asm compiled
    ld      de,9327h
    pop     bc               ; # bytes
    ldir                     ; copy asm
    jp      9327h


Thanks guys.  I'm sure I'll come up with more later.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: