Skip to content

Instantly share code, notes, and snippets.

@mk2s
Last active October 2, 2024 14:49
Show Gist options
  • Save mk2s/304ff3c41f860ad33306a9cedca6e3ae to your computer and use it in GitHub Desktop.
Save mk2s/304ff3c41f860ad33306a9cedca6e3ae to your computer and use it in GitHub Desktop.
px8 code snippet to read a byte from slave space
; code snippet to read a byte from slave space
.org 9900h
ld a, 0c0h
ld (0f358h), a
ld hl, retaddr
push hl
ld hl, (1)
ld de, 72H ; bios slave command
add hl, de
ld de, packet
jp (hl)
retaddr: ld c, a
ld a, 0
ld (0f358h), a
ld a,c
ret
packet: dw sendsv
dw 3
dw rcvsv
dw 2
sendsv: db 0 ; read
db 0f0h ; hi
db 00h ; lo
rcvsv: db 0
db 0
@mk2s
Copy link
Author

mk2s commented Oct 2, 2024

this works with https://www.asm80.com/#px8sl-z80-lst to assemble
10 CLEAR, &H9900:BDOS=&H9900 20 FOR I=0 TO 40:READ X:POKE BDOS+I,X:NEXT 25 OPEN "o",#1,"px86303a.txt" 30 FOR I=0 TO 255 40 PRINT I:PRINT #1,HEX$(&HF000+I*16);":"; 50 H=((&HF000+I*16)AND &HFF00)\256 60 IF H<0 THEN H=H+256 80 POKE &H9925,H 90 FOR J=0 TO 15 100 POKE &H9926, (I*16+J) MOD 256 110 CALL BDOS 120 IF PEEK(&H9927)<>0 THEN ERROR 21 130 PRINT #1,HEX$(PEEK(&H9928));" "; 140 NEXT J 150 PRINT #1,:NEXT I 155 CLOSE #1 160 DATA &h3e, &hc0, &h32, &h58, &hf3, &h21, &h14, &h99 170 DATA &he5, &h2a, &h01, &h00, &h11, &h72, &h00, &h19 180 DATA &h11, &h1c, &h99, &he9, &h4f, &h3e, &h00, &h32 190 DATA &h58, &hf3, &h79, &hc9, &h24, &h99, &h03, &h00 200 DATA &h27, &h99, &h02, &h00, &h00, &hf0, &h02, &h00 210 DATA &h00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment