CPU-Z80-Disassembler

 view release on metacpan or  search on metacpan

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


; proceed with multi-dimensioned string arrays in runtime.

        EX      DE,HL           ; save pointer to dimensions in DE

        RST     18H             ; GET-CHAR looks at the BASIC line
        CP      $28             ; is character '(' ?
        JR      NZ,L2A20        ; to REPORT-3 if not
                                ; 'Subscript wrong'

        EX      DE,HL           ; dimensions pointer to HL to synchronize
                                ; with next instruction.

; runtime numeric arrays path rejoins here.

;; SV-PTR
L29C0:  EX      DE,HL           ; save dimension pointer in DE
        JR      L29E7           ; forward to SV-COUNT with true no of dims 
                                ; in B. As there is no initial comma the 
                                ; loop is entered at the midpoint.

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


; proceed with multi-dimensioned string arrays in runtime.

        ex de,hl                ; save pointer to dimensions in DE

        rst 0x18                ; GET-CHAR looks at the BASIC line
        cp 0x28                 ; is character '(' ?
        jr nz,REPORT_3          ; to REPORT-3 if not
                                ; 'Subscript wrong'

        ex de,hl                ; dimensions pointer to HL to synchronize
                                ; with next instruction.

; runtime numeric arrays path rejoins here.

;; SV-PTR
SV_PTR:
        ex de,hl                ; save dimension pointer in DE
        jr SV_COUNT             ; forward to SV-COUNT with true no of dims
                                ; in B. As there is no initial comma the
                                ; loop is entered at the midpoint.

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


; proceed with multi-dimensioned string arrays in runtime.

        ex de, hl               ; save pointer to dimensions in DE

        rst $18                 ; GET-CHAR looks at the BASIC line
        cp $28                  ; is character '(' ?
        jr nz, REPORT_3         ; to REPORT-3 if not
                                ; 'Subscript wrong'

        ex de, hl               ; dimensions pointer to HL to synchronize
                                ; with next instruction.

; runtime numeric arrays path rejoins here.

;; SV-PTR

SV_PTR:
        ex de, hl               ; save dimension pointer in DE
        jr SV_COUNT             ; forward to SV-COUNT with true no of dims
                                ; in B. As there is no initial comma the

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

        inc a                   ; (4) increment.
        jp m, NMI_RET           ; (10/10) jump, if minus, to NMI-RET as this is
                                ; part of a test to see if the NMI
                                ; generation is working or an intermediate
                                ; value for the ascending negated blank
                                ; line counter.
                                ; 
        jr z, NMI_CONT          ; (12) forward to NMI-CONT
                                ; when line count has incremented to zero.
                                ; 
; Note. the synchronizing NMI when A increments from zero to one takes this
; 7 clock cycle route making 39 clock cycles in all.

;; NMI-RET

NMI_RET:
        ex af, af'              ; (4)  switch out the incremented line counter
                                ; or test result $80
        ret                     ; (10) return to User application for a while.
                                ; 

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

        push de                 ; (11) ***
        push hl                 ; (11) ****
                                ; 
;   the next set-up procedure is only really applicable when the top set of
;   blank lines have been generated.

        ld hl, (D_FILE)         ; (16) fetch start of Display File from D_FILE
                                ; points to the HALT at beginning.
        set 7, h                ; (8) point to upper 32K 'echo display file'
                                ; 
        halt                    ; (1) HALT synchronizes with NMI.
                                ; Used with special hardware connected to the
                                ; Z80 HALT and WAIT lines to take 1 clock cycle.
                                ; 
; ----------------------------------------------------------------------------
;   the NMI has been generated - start counting. The cathode ray is at the RH
;   side of the TV.
;   First the NMI servicing, similar to CALL            =  17 clock cycles.
;   Then the time taken by the NMI for zero-to-one path =  39 cycles
;   The HALT above                                      =  01 cycles.
;   The two instructions below                          =  19 cycles.

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

        ld h, a                 ; (4)  set H to zero
        ld (FRAMES), hl         ; (16) update system variable FRAMES
        ret nc                  ; (11/5) return if FRAMES is in use by PAUSE
                                ; command.
                                ; 
;; DISPLAY-2

DISPLAY_2:
        call KEYBOARD           ; routine KEYBOARD gets the key row in H and
                                ; the column in L. Reading the ports also starts
                                ; the TV frame synchronization pulse. (VSYNC)
                                ; 
        ld bc, (LAST_K)         ; fetch the last key values read from LAST_K
        ld (LAST_K), hl         ; update LAST_K with new values.
                                ; 
        ld a, b                 ; load A with previous column - will be $FF if
                                ; there was no key.
        add a, $02              ; adding two will set carry if no previous key.
                                ; 
        sbc hl, bc              ; subtract with the carry the two key values.
                                ; 

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

                                ; 
        ld b, (hl)              ; fetch value of DEBOUNCE to B
        ld a, e                 ; transfer column value
        cp $FE                  ; 
        sbc a, a                ; 
        ld b, $1F               ; 
        or (hl)                 ; 
        and b                   ; 
        rra                     ; 
        ld (hl), a              ; 
        out ($FF), a            ; end the TV frame synchronization pulse.
                                ; 
        ld hl, (D_FILE)         ; (12) set HL to the Display File from D_FILE
        set 7, h                ; (8) set bit 15 to address the echo display.
                                ; 
        call DISPLAY_3          ; (17) routine DISPLAY-3 displays the top set
                                ; of blank lines.
                                ; 
; ---------------------
; THE 'VIDEO-1' ROUTINE
; ---------------------

t/data/zx81.ctl  view on Meta::CPAN

	:;     line counter.
	:;

006B:C
006B 2802       jr z, $006F	:C
	:; (12) forward to NMI-CONT
	:;      when line count has incremented to zero.
	:;

006D:C
	:#; Note. the synchronizing NMI when A increments from zero to one takes this
	:#; 7 clock cycle route making 39 clock cycles in all.
	:#
	:#;; NMI-RET
006D 08         ex af, af'	:C NMI_RET
	:; (4)  switch out the incremented line counter
	:;      or test result $80

006E:C
006E C9         ret	:C
	:; (10) return to User application for a while.

t/data/zx81.ctl  view on Meta::CPAN

	:; (16) fetch start of Display File from D_FILE
	:;      points to the HALT at beginning.

0077:C
0077 CBFC       set 7, h	:C
	:; (8) point to upper 32K 'echo display file'
	:;

0079:C
0079 76         halt	:C
	:; (1) HALT synchronizes with NMI.  
	:; Used with special hardware connected to the
	:; Z80 HALT and WAIT lines to take 1 clock cycle.
	:;

007A:C
	:#; ----------------------------------------------------------------------------
	:#;   the NMI has been generated - start counting. The cathode ray is at the RH 
	:#;   side of the TV.
	:#;   First the NMI servicing, similar to CALL            =  17 clock cycles.
	:#;   Then the time taken by the NMI for zero-to-one path =  39 cycles

t/data/zx81.ctl  view on Meta::CPAN

023D D0         ret nc	:C
	:; (11/5) return if FRAMES is in use by PAUSE 
	:; command.
	:;

023E:C
	:#;; DISPLAY-2
023E CDBB02     call $02BB	:C DISPLAY_2
	:; routine KEYBOARD gets the key row in H and 
	:; the column in L. Reading the ports also starts
	:; the TV frame synchronization pulse. (VSYNC)
	:;

0241:C
0241 ED4B2540   ld bc, ($4025)	:C
	:; fetch the last key values read from LAST_K

0245:C
0245 222540     ld ($4025), hl	:C
	:; update LAST_K with new values.
	:;

t/data/zx81.ctl  view on Meta::CPAN

0275 1F         rra	:C
	:;

0276:C
0276 77         ld (hl), a	:C
	:;
	:;

0277:C
0277 D3FF       out ($FF), a	:C
	:; end the TV frame synchronization pulse.
	:;

0279:C
0279 2A0C40     ld hl, ($400C)	:C
	:; (12) set HL to the Display File from D_FILE

027C:C
027C CBFC       set 7, h	:C
	:; (8) set bit 15 to address the echo display.
	:;

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

        INC     A               ; (4) increment.
        JP      M,L006D         ; (10/10) jump, if minus, to NMI-RET as this is
                                ;     part of a test to see if the NMI 
                                ;     generation is working or an intermediate 
                                ;     value for the ascending negated blank 
                                ;     line counter.

        JR      Z,L006F         ; (12) forward to NMI-CONT
                                ;      when line count has incremented to zero.

; Note. the synchronizing NMI when A increments from zero to one takes this
; 7 clock cycle route making 39 clock cycles in all.

;; NMI-RET
L006D:  EX      AF,AF'          ; (4)  switch out the incremented line counter
                                ;      or test result $80
        RET                     ; (10) return to User application for a while.

; ---

;   This branch is taken when the 55 (or 31) lines have been drawn.

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

        PUSH    DE              ; (11) ***
        PUSH    HL              ; (11) ****

;   the next set-up procedure is only really applicable when the top set of 
;   blank lines have been generated.

        LD      HL,($400C)      ; (16) fetch start of Display File from D_FILE
                                ;      points to the HALT at beginning.
        SET     7,H             ; (8) point to upper 32K 'echo display file'

        HALT                    ; (1) HALT synchronizes with NMI.  
                                ; Used with special hardware connected to the
                                ; Z80 HALT and WAIT lines to take 1 clock cycle.

; ----------------------------------------------------------------------------
;   the NMI has been generated - start counting. The cathode ray is at the RH 
;   side of the TV.
;   First the NMI servicing, similar to CALL            =  17 clock cycles.
;   Then the time taken by the NMI for zero-to-one path =  39 cycles
;   The HALT above                                      =  01 cycles.
;   The two instructions below                          =  19 cycles.

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


;; OVER-NC
L0239:  LD      H,A             ; (4)  set H to zero
        LD      ($4034),HL      ; (16) update system variable FRAMES 
        RET     NC              ; (11/5) return if FRAMES is in use by PAUSE 
                                ; command.

;; DISPLAY-2
L023E:  CALL    L02BB           ; routine KEYBOARD gets the key row in H and 
                                ; the column in L. Reading the ports also starts
                                ; the TV frame synchronization pulse. (VSYNC)

        LD      BC,($4025)      ; fetch the last key values read from LAST_K
        LD      ($4025),HL      ; update LAST_K with new values.

        LD      A,B             ; load A with previous column - will be $FF if
                                ; there was no key.
        ADD     A,$02           ; adding two will set carry if no previous key.

        SBC     HL,BC           ; subtract with the carry the two key values.

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

        LD      B,(HL)          ; fetch value of DEBOUNCE to B
        LD      A,E             ; transfer column value
        CP      $FE             ;
        SBC     A,A             ;
        LD      B,$1F           ;
        OR      (HL)            ;
        AND     B               ;
        RRA                     ;
        LD      (HL),A          ;

        OUT     ($FF),A         ; end the TV frame synchronization pulse.

        LD      HL,($400C)      ; (12) set HL to the Display File from D_FILE
        SET     7,H             ; (8) set bit 15 to address the echo display.

        CALL    L0292           ; (17) routine DISPLAY-3 displays the top set 
                                ; of blank lines.

; ---------------------
; THE 'VIDEO-1' ROUTINE
; ---------------------

t/dis_zx81.t  view on Meta::CPAN

	my $num = scalar(split(/,/, $def_args));
	my($new_addr, $bytes_str) = get_bytes_str($addr, $num * $size, $ctl_from);
	
	push @$ctl_to, sprintf("%-31s", x4($addr).'-'.x4($new_addr-1).' '.$bytes_str)." :".
			($size == 1 ? 'B' : 'W')."\n";
	
	if (defined $comment) {
		push @$ctl_to, (" " x 32).":;$comment\n";
	}
	
	# synchronize code after bytes
	isa_ok my $dis = CPU::Z80::Disassembler->new(), 'CPU::Z80::Disassembler';
	$dis->memory->load_file($rom_file, $new_addr, $new_addr);
	$dis->write_dump($ctl_file."2");
	@$ctl_from = path($ctl_file."2")->lines;
	unlink $ctl_file."2";
	
	return $new_addr;
}

sub consume_code {



( run in 1.375 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )