CPU-Z80-Disassembler
view release on metacpan or search on metacpan
t/data/zx48_benchmark.asm view on Meta::CPAN
DEST equ $5C4D ; Address of variable in assignment.
CHANS equ $5C4F ; Address of channel data.
CURCHL equ $5C51 ; Address of information currently being used for
; input and output.
PROG equ $5C53 ; Address of BASIC program.
NXTLIN equ $5C55 ; Address of next line in program.
DATADD equ $5C57 ; Address of terminator of last DATA item.
E_LINE equ $5C59 ; Address of command being typed in.
K_CUR equ $5C5B ; Address of cursor.
CH_ADD equ $5C5D ; Address of the next character to be interpreted:
; the character after the argument of PEEK, or
; the NEWLINE at the end of a POKE statement.
X_PTR equ $5C5F ; Address of the character after the ? marker.
WORKSP equ $5C61 ; Address of temporary work space.
STKBOT equ $5C63 ; Address of bottom of calculator stack.
STKEND equ $5C65 ; Address of start of spare space.
BREG equ $5C67 ; Calculator's b register.
MEM equ $5C68 ; Address of area used for calculator's memory.
; (Usually MEMBOT, but not always.)
FLAGS2 equ $5C6A ; More flags.
DF_SZ equ $5C6B ; The number of lines (including one blank line)
; in the lower part of the screen.
S_TOP equ $5C6C ; The number of the top program line in automatic
; listings.
OLDPPC equ $5C6E ; Line number to which CONTINUE jumps.
OSPCC equ $5C70 ; Number within line of statement to which
; CONTINUE jumps.
FLAGX equ $5C71 ; Various flags.
STRLEN equ $5C72 ; Length of string type destination in assignment.
T_ADDR equ $5C74 ; Address of next item in syntax table (very unlikely
; to be useful).
SEED equ $5C76 ; The seed for RND. This is the variable that is set
; by RANDOMIZE.
FRAMES equ $5C78 ; 3 byte (least significant first), frame counter.
; Incremented every 20ms. See Chapter 18.
FRAMES3 equ $5C7A ; 3rd byte of FRAMES
UDG equ $5C7B ; Address of 1st user defined graphic You can change
; this for instance to save space by having fewer
; user defined graphics.
COORDS equ $5C7D ; x-coordinate of last point plotted.
COORDS_hi equ $5C7E ; y-coordinate of last point plotted.
P_POSN equ $5C7F ; 33 column number of printer position
PR_CC equ $5C80 ; Full address of next position for LPRINT to print at
; (in ZX printer buffer). Legal values 5B00 - 5B1F.
; [Not used in 128K mode or when certain peripherals
; are attached]
ECHO_E equ $5C82 ; 33 column number and 24 line number (in lower half)
; of end of input buffer.
DF_CC equ $5C84 ; Address in display file of PRINT position.
DFCCL equ $5C86 ; Like DF CC for lower part of screen.
S_POSN equ $5C88 ; 33 column number for PRINT position
S_POSN_hi equ $5C89 ; 24 line number for PRINT position.
SPOSNL equ $5C8A ; Like S POSN for lower part
SCR_CT equ $5C8C ; Counts scrolls: it is always 1 more than the number
; of scrolls that will be done before stopping with
; scroll? If you keep poking this with a number
; bigger than 1 (say 255), the screen will scroll
; on and on without asking you.
ATTR_P equ $5C8D ; Permanent current colours, etc (as set up by colour
; statements).
MASK_P equ $5C8E ; Used for transparent colours, etc. Any bit that
; is 1 shows that the corresponding attribute bit
; is taken not from ATTR P, but from what is already
; on the screen.
ATTR_T equ $5C8F ; Temporary current colours, etc (as set up by
; colour items).
MASK_T equ $5C90 ; Like MASK P, but temporary.
P_FLAG equ $5C91 ; More flags.
MEMBOT equ $5C92 ; Calculator's memory area; used to store numbers
; that cannot conveniently be put on
; the calculator stack.
NMIADD equ $5CB0 ; This is the address of a user supplied NMI address
; which is read by the standard ROM when a peripheral
; activates the NMI. Probably intentionally disabled
; so that the effect is to perform a reset if both
; locations hold zero, but do nothing if the locations
; hold a non-zero value. Interface 1's with serial
; number greater than 87315 will initialize these
; locations to 0 and 80 to allow the RS232 "T" channel
; to use a variable line width. 23728 is the current
; print position and 23729 the width - default 80.
RAMTOP equ $5CB2 ; Address of last byte of BASIC system area.
P_RAMT equ $5CB4 ; Address of last byte of physical RAM.
IY0 equ ERR_NR
org $0000
;*****************************************
;** Part 1. RESTART ROUTINES AND TABLES **
;*****************************************
; -----------
; THE 'START'
; -----------
; At switch on, the Z80 chip is in Interrupt Mode 0.
; The Spectrum uses Interrupt Mode 1.
; This location can also be 'called' to reset the machine.
; Typically with PRINT USR 0.
;; START
START:
di ; Disable Interrupts.
xor a ; Signal coming from START.
ld de, $FFFF ; Set pointer to top of possible physical RAM.
jp START_NEW ; Jump forward to common code at START-NEW.
; -------------------
; THE 'ERROR' RESTART
; -------------------
; The error pointer is made to point to the position of the error to enable
; the editor to highlight the error position if it occurred during syntax
; checking. It is used at 37 places in the program. An instruction fetch
; on address $0008 may page in a peripheral ROM such as the Sinclair
; Interface 1 or Disciple Disk Interface. This was not an original design
; concept and not all errors pass through here.
;; ERROR-1
t/data/zx48_benchmark.asm view on Meta::CPAN
; -> this routine evaluates and outputs a colour control and parameter.
; It is called from above and also from PR-ITEM-3 to handle a single embedded
; print item e.g. PRINT PAPER 6; "Hi". In the latter case, the looping for
; multiple items is within the PR-ITEM routine.
; It is quite permissible to send these to any stream.
;; CO-TEMP-3
CO_TEMP_3:
cp $D9 ; is it 'INK' ?
ret c ; return if less.
cp $DF ; compare with 'OUT'
ccf ; Complement Carry Flag
ret c ; return if greater than 'OVER', $DE.
push af ; save the colour token.
rst $20 ; address NEXT-CHAR
pop af ; restore token and continue.
; -> this entry point used by CLASS-07. e.g. the command PAPER 6.
;; CO-TEMP-4
CO_TEMP_4:
sub $C9 ; reduce to control character $10 (INK)
; thru $15 (OVER).
push af ; save control.
call EXPT_1NUM ; routine EXPT-1NUM stacks addressed
; parameter on calculator stack.
pop af ; restore control.
and a ; clear carry
call UNSTACK_Z ; routine UNSTACK-Z returns if checking syntax.
push af ; save again
call FIND_INT1 ; routine FIND-INT1 fetches parameter to A.
ld d, a ; transfer now to D
pop af ; restore control.
rst $10 ; PRINT-A outputs the control to current
; channel.
ld a, d ; transfer parameter to A.
rst $10 ; PRINT-A outputs parameter.
ret ; return. ->
; -------------------------------------------------------------------------
;
; {fl}{br}{ paper }{ ink } The temporary colour attributes
; ___ ___ ___ ___ ___ ___ ___ ___ system variable.
; ATTR_T | | | | | | | | |
; | | | | | | | | |
; 23695 |___|___|___|___|___|___|___|___|
; 7 6 5 4 3 2 1 0
;
;
; {fl}{br}{ paper }{ ink } The temporary mask used for
; ___ ___ ___ ___ ___ ___ ___ ___ transparent colours. Any bit
; MASK_T | | | | | | | | | that is 1 shows that the
; | | | | | | | | | corresponding attribute is
; 23696 |___|___|___|___|___|___|___|___| taken not from ATTR-T but from
; 7 6 5 4 3 2 1 0 what is already on the screen.
;
;
; {paper9 }{ ink9 }{ inv1 }{ over1} The print flags. Even bits are
; ___ ___ ___ ___ ___ ___ ___ ___ temporary flags. The odd bits
; P_FLAG | | | | | | | | | are the permanent flags.
; | p | t | p | t | p | t | p | t |
; 23697 |___|___|___|___|___|___|___|___|
; 7 6 5 4 3 2 1 0
;
; -----------------------------------------------------------------------
; ------------------------------------
; The colour system variable handler.
; ------------------------------------
; This is an exit branch from PO-1-OPER, PO-2-OPER
; A holds control $10 (INK) to $15 (OVER)
; D holds parameter 0-9 for ink/paper 0,1 or 8 for bright/flash,
; 0 or 1 for over/inverse.
;; CO-TEMP-5
CO_TEMP_5:
sub $11 ; reduce range $FF-$04
adc a, $00 ; add in carry if INK
jr z, CO_TEMP_7 ; forward to CO-TEMP-7 with INK and PAPER.
sub $02 ; reduce range $FF-$02
adc a, $00 ; add carry if FLASH
jr z, CO_TEMP_C ; forward to CO-TEMP-C with FLASH and BRIGHT.
cp $01 ; is it 'INVERSE' ?
ld a, d ; fetch parameter for INVERSE/OVER
ld b, $01 ; prepare OVER mask setting bit 0.
jr nz, CO_TEMP_6 ; forward to CO-TEMP-6 if OVER
rlca ; shift bit 0
rlca ; to bit 2
ld b, $04 ; set bit 2 of mask for inverse.
;; CO-TEMP-6
CO_TEMP_6:
ld c, a ; save the A
ld a, d ; re-fetch parameter
cp $02 ; is it less than 2
jr nc, REPORT_K ; to REPORT-K if not 0 or 1.
; 'Invalid colour'.
ld a, c ; restore A
ld hl, P_FLAG ; address system variable P_FLAG
jr CO_CHANGE ; forward to exit via routine CO-CHANGE
; ---
; the branch was here with INK/PAPER and carry set for INK.
( run in 1.554 second using v1.01-cache-2.11-cpan-39bf76dae61 )