Quote from: TFM on 26. March 2025, 21:22:36Das ist doch Z80-Code, gibt's den Source dazu? Dann sollte man es 'einfach' auf den CPC umsetzen können.![]()
org &8000
; diese routine gibt zu jedem plot x,y wert
; 1. die screenadresse &C000 - &FFFF zurück
; 2. das aktuelle byte an der dieser addresse
; 3. ein poke an die gewünschte addresse kann direkt über die variable erfolgen
;
scr_get_mode equ &BC11
scr_prev_line equ &BC29
start_scr_adr equ &FF80 ; start is bottom left for 0,0
call scr_get_mode
ld (mode),a
ld a,(&B6A3)
;get y from ix
ld h,(ix+1)
ld l,(ix+0)
ld de,2
call div_2
ld hl,start_scr_adr
;get screenaddres for y 0-399
repeat push bc
push de
push af
call scr_prev_line ;hl hold now the prev line in this case &FF80-
pop af
pop de
pop bc
;ld (hl),a ; write pixel to screen
;ld (scr_adr),hl
dec c
jr nz, repeat
;djnz repeat
ld (hight),hl
;add the x to these 0-639
;ld hl,320
ld h,(ix+3)
ld l,(ix+2)
ld e,8
call div_2
ld hl,(hight)
add hl,bc
ld (scr_adr),hl
ld a,(hl)
ld (pixel),a
ex de,hl
ld l,(ix+6)
ld h,(ix+7)
ld (hl),e
inc hl
ld (hl),d
ld l,(ix+4)
ld h,(ix+5)
ld (hl),a
ret
div_2
;ld de,2
Divide: ; this routine performs the operation BC=HL/E
ld a,e ; checking the divisor; returning if it is zero
or a ; from this time on the carry is cleared
ret z
ld bc,-1 ; BC is used to accumulate the result
ld d,0 ; clearing D, so DE holds the divisor
DivLoop: ; subtracting DE from HL until the first overflow
sbc hl,de ; since the carry is zero, SBC works as if it was a SUB
inc bc ; note that this instruction does not alter the flags
jr nc,DivLoop ; no carry means that there was no overflow
ret
hight dw 0
with dw 0
scr_adr dw 0
mode db &0
pixel db 0
1 MEMORY &7FFF
2 LOAD"scradr.bin",&8000
4 scradr%=&FF80
5 pixel%=0
10 x%=320:y%=200
20 BORDER 0: GRAPHICS PEN 1
30 MODE 2: PLOT x%,y%
40 PRINT "Hex :"+HEX$(x%,4),+HEX$(y%,4)
50 IF INKEY(0)=0 THEN y%=y%+2:GOSUB 110
60 IF INKEY(1)=0 THEN x%=x%+2:GOSUB 110
70 IF INKEY(2)=0 THEN y%=y%-2:GOSUB 110
80 IF INKEY(8)=0 THEN x%=x%-2:GOSUB 110
90 IF INKEY(9)=0 THEN LOCATE 1,1:PRINT "Hex:"+HEX$(x%,4),+HEX$(y%,4)
100 GOTO 50
110 IF TEST(x%,y%)=1 THEN LOCATE 20,1:PRINT "Hex :"+HEX$(x%,4),+HEX$(y%,4)
111 CALL &8000,@scradr%,@pixel%,x%,y%
112 LOCATE 40,1:PRINT HEX$(scradr%,4);" ";BIN$(pixel%,8)
120 PLOT x%,y%
130 RETURN
; playing with &BC1D SCR_DOT_POSITION
; emtry
; HL = holds Y -Cordinate of the dot
; DE = holds X -Coordinate of the dot
; exit
; HL hols the memoryaddresse of the dot
; should be between &C000 and &FFFF
; call &8000,x,y,@n%
; @n% holds now the memoryaddresse of the dot pixel
;
; entrys on ix n,y,x
; so this would be
scr_dot_pos equ &BC1D
gra_plot_absolute equ &BBEA
org &8000
ld h,(ix+3) ; highbyte of y
ld l,(ix+2) ; lowbyte of y
ld d,(ix+5) ; highbyte of x
ld e,(ix+4) ; lowbyte of x
call gra_plot_absolute
ld h,(ix+3) ; highbyte of y
ld l,(ix+2) ; lowbyte of y
ld d,(ix+5) ; highbyte of x
ld e,(ix+4) ; lowbyte of x
call scr_dot_pos ; call the firmware scr_dot_position
ex de,hl ; store hl to de
ld h,(ix+1) ; memory location of n highbyte
ld l,(ix+0) ; memory location of n lowbyte
ld (hl),d
inc hl
ld (hl),e
ret