CPU-Z80-Disassembler

 view release on metacpan or  search on metacpan

t/data/zx48_base.asm  view on Meta::CPAN

; -------------------
; This routine extracts a line number, at an address that has previously
; been found using LINE-ADDR, and it is entered at LINE-NO. If it encounters
; the program 'end-marker' then the previous line is used and if that
; should also be unacceptable then zero is used as it must be a direct
; command. The program end-marker is the variables end-marker $80, or
; if variables exist, then the first character of any variable name.

;; LINE-ZERO
LINE_ZERO:
        defb 0x00, 0x00         ; dummy line number used for direct commands


;; LINE-NO-A
LINE_NO_A:
        ex de,hl                ; fetch the previous line to HL and set
        ld de,LINE_ZERO         ; DE to LINE-ZERO should HL also fail.

; -> The Entry Point.

;; LINE-NO
LINE_NO:
        ld a,(hl)               ; fetch the high byte - max $2F
        and 0xC0                ; mask off the invalid bits.
        jr nz,LINE_NO_A         ; to LINE-NO-A if an end-marker.

        ld d,(hl)               ; reload the high byte.
        inc hl                  ; advance address.
        ld e,(hl)               ; pick up the low byte.
        ret                     ; return from here.

; -------------------
; Handle reserve room
; -------------------
; This is a continuation of the restart BC-SPACES

;; RESERVE
RESERVE:
        ld hl,(0x5C63)          ; STKBOT first location of calculator stack
        dec hl                  ; make one less than new location
        call MAKE_ROOM          ; routine MAKE-ROOM creates the room.
        inc hl                  ; address the first new location
        inc hl                  ; advance to second
        pop bc                  ; restore old WORKSP
        ld (0x5C61),bc          ; system variable WORKSP was perhaps
                                ; changed by POINTERS routine.
        pop bc                  ; restore count for return value.
        ex de,hl                ; switch. DE = location after first new space
        inc hl                  ; HL now location after new space
        ret                     ; return.

; ---------------------------
; Clear various editing areas
; ---------------------------
; This routine sets the editing area, workspace and calculator stack
; to their minimum configurations as at initialization and indeed this
; routine could have been relied on to perform that task.
; This routine uses HL only and returns with that register holding
; WORKSP/STKBOT/STKEND though no use is made of this. The routines also
; reset MEM to its usual place in the systems variable area should it
; have been relocated to a FOR-NEXT variable. The main entry point
; SET-MIN is called at the start of the MAIN-EXEC loop and prior to
; displaying an error.

;; SET-MIN
SET_MIN:
        ld hl,(0x5C59)          ; fetch E_LINE
        ld (hl),0x0D            ; insert carriage return
        ld (0x5C5B),hl          ; make K_CUR keyboard cursor point there.
        inc hl                  ; next location
        ld (hl),0x80            ; holds end-marker $80
        inc hl                  ; next location becomes
        ld (0x5C61),hl          ; start of WORKSP

; This entry point is used prior to input and prior to the execution,
; or parsing, of each statement.

;; SET-WORK
SET_WORK:
        ld hl,(0x5C61)          ; fetch WORKSP value
        ld (0x5C63),hl          ; and place in STKBOT

; This entry point is used to move the stack back to its normal place
; after temporary relocation during line entry and also from ERROR-3

;; SET-STK
SET_STK:
        ld hl,(0x5C63)          ; fetch STKBOT value
        ld (0x5C65),hl          ; and place in STKEND.

        push hl                 ; perhaps an obsolete entry point.
        ld hl,0x5C92            ; normal location of MEM-0
        ld (0x5C68),hl          ; is restored to system variable MEM.
        pop hl                  ; saved value not required.
        ret                     ; return.

; ------------------
; Reclaim edit-line?
; ------------------
; This seems to be legacy code from the ZX80/ZX81 as it is 
; not used in this ROM.
; That task, in fact, is performed here by the dual-area routine CLEAR-SP.
; This routine is designed to deal with something that is known to be in the
; edit buffer and not workspace.
; On entry, HL must point to the end of the something to be deleted.

;; REC-EDIT
REC_EDIT:
        ld de,(0x5C59)          ; fetch start of edit line from E_LINE.
        jp RECLAIM_1            ; jump forward to RECLAIM-1.

; --------------------------
; The Table INDEXING routine
; --------------------------
; This routine is used to search two-byte hash tables for a character
; held in C, returning the address of the following offset byte.
; if it is known that the character is in the table e.g. for priorities,
; then the table requires no zero end-marker. If this is not known at the
; outset then a zero end-marker is required and carry is set to signal
; success.

;; INDEXER-1
INDEXER_1:
        inc hl                  ; address the next pair of values.

; -> The Entry Point.

;; INDEXER
INDEXER:
        ld a,(hl)               ; fetch the first byte of pair
        and a                   ; is it the end-marker ?
        ret z                   ; return with carry reset if so.

        cp c                    ; is it the required character ?
        inc hl                  ; address next location.
        jr nz,INDEXER_1         ; back to INDEXER-1 if no match.

        scf                     ; else set the carry flag.
        ret                     ; return with carry set

; --------------------------------
; The Channel and Streams Routines
; --------------------------------
; A channel is an input/output route to a hardware device

t/data/zx48_base.asm  view on Meta::CPAN

        defb %00000000

; $7C - Character: '|'          CHR$(124)

        defb %00000000
        defb %00001000
        defb %00001000
        defb %00001000
        defb %00001000
        defb %00001000
        defb %00001000
        defb %00000000

; $7D - Character: '}'          CHR$(125)

        defb %00000000
        defb %01110000
        defb %00010000
        defb %00001100
        defb %00010000
        defb %00010000
        defb %01110000
        defb %00000000

; $7E - Character: '~'          CHR$(126)

        defb %00000000
        defb %00010100
        defb %00101000
        defb %00000000
        defb %00000000
        defb %00000000
        defb %00000000
        defb %00000000

; $7F - Character: ' © '        CHR$(127)

        defb %00111100
        defb %01000010
        defb %10011001
        defb %10100001
        defb %10100001
        defb %10011001
        defb %01000010
        defb %00111100


;#end                            ; generic cross-assembler directive 

; Acknowledgements
; -----------------
; Sean Irvine               for default list of section headings
; Dr. Ian Logan             for labels and functional disassembly.
; Dr. Frank O'Hara          for labels and functional disassembly.
;
; Credits
; -------
; Alex Pallero Gonzales     for corrections.
; Mike Dailly               for comments.
; Alvin Albrecht            for comments.
; Andy Styles               for full relocatability implementation and testing.                    testing.
; Andrew Owen               for ZASM compatibility and format improvements.

;   For other assemblers you may have to add directives like these near the 
;   beginning - see accompanying documentation.
;   ZASM (MacOs) cross-assembler directives. (uncomment by removing ';' )
;   #target rom           ; declare target file format as binary.
;   #code   0,$4000       ; declare code segment.
;   Also see notes at Address Labels 0609 and 1CA5 if your assembler has 
;   trouble with expressions.
;
;   Note. The Sinclair Interface 1 ROM written by Dr. Ian Logan and Martin 
;   Brennan calls numerous routines in this ROM.  
;   Non-standard entry points have a label beginning with X. 




( run in 0.887 second using v1.01-cache-2.11-cpan-71847e10f99 )