Hier ist eine PLOT-Routine, die von BASIC aus mit CALL PLOT(x%, y%, F%) aufgerufen wird. Dabei wird PLOT auf den Anfang der Routine gesetzt ($C000 bzw. 49152), x% und y% sind die X- und Y-Koordinaten des zu setzenden Punktes und F% ist 1, wenn der Punkt gesetzt, und 0, wenn der Punkt gelöscht werden soll.
Code: Alles auswählen
;----------------------------------------------------
; Project: test1.zdsp
; Main File: test1.asm
; Date: 22.12.2014 21:05:17
;
; Created with zDevStudio - Z80 Development Studio.
;
;----------------------------------------------------
; PLOT - Joyce Graphics
; call from BASIC:
;   CALL PLOT (x%,y%,F%)
; Byte References
B_F8	equ	0F8h	;  'x'+128  -8
B_07	equ	07h	;  7
; Word References
ROLLER	equ	0B600h  ; Adresse des Roller RAMs
; Label References
XBIOS	equ	0FC5Ah	; XBIOS-Adresse
; Program
	ORG	&HC000
PLOT    ld	a,(bc)          ; Farbe -> A
	ld	(FARBE),a
	ld	c,(hl)          ; x low byte -> c
	inc	hl
	ld	b,(hl)          ; x high byte -> b
	ld	hl,719
	and	a               ; clear carry bit
	sbc	hl,bc           ; horizontal overflow test
	ret	c               ; x too large: exit
	ld	(KOORDX),bc     ; save x
	ex	de,hl
	ld	e,(hl)          ; y low byte -> e
	inc	hl
	ld	d,(hl)          ; y high byte -> d (should be 0)
	ld	a,d
	and	a               ; set zero bit
	ret	nz              ; vertical overflow test
	sub	e
	dec	a
	ld	e,a
	ld	(KOORDY),de     ; -y -> KOORDY
	di
	ld	(SAVESP),sp
	ld	sp,STACK
	ld	bc,W_C036
	call	XBIOS
        dw      000E9h
	ld	sp,(SAVESP)
	ei
	ret
W_C036	ld	hl,(KOORDY)
	add	hl,hl
	ld	de,ROLLER
	add	hl,de
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	ld	a,e
	and	B_F8
	sla	a
	rl	d
	ld	b,a
	ld	a,e
	and	B_07
	or	b
	ld	e,a
	ld	hl,(KOORDX)
	ld	b,l
	ld	a,l
	and	B_F8
	ld	l,a
	ex	de,hl
	add	hl,de
	ld	a,b
	and	B_07
	inc	a
	ld	b,a
	xor	a
	scf
L_C05F	rra
	djnz	L_C05F
	ld	b,a
	ld	a,(FARBE)
	and	a
	jr	nz,L_C06E
	ld	a,b
	cpl
	and	(hl)
	ld	(hl),a
	ret
L_C06E	dec	a
	ld	a,b
	jr	nz,L_C075
	or	(hl)
	ld	(hl),a
	ret
L_C075	xor	(hl)
	ld	(hl),a
	ret
KOORDX	dw      0
KOORDY  dw      0
FARBE   dw      1
SAVESP  dw      0
STKEND  dw      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
STACK   dw      0


