Repository navigation
ZX Spectrum Next: network play through its own Wi-Fi #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
58648b3
5672aca
2cb7c1f
68652f6
a6c66e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| * top, so it must not touch the game's memory above C000h; the game passes | ||
| * data through its staging buffer below C000h. */ | ||
| #include <stdint.h> | ||
| #include <string.h> | ||
| #include "tcp.h" | ||
|
|
||
| const char bank6_signature[4] = {'B', 'N', 'B', '6'}; /* checked by the game before the first call */ | ||
|
|
@@ -43,12 +44,56 @@ static uint8_t esp01_machine(void) __naked { | |
| ret | ||
| __endasm; | ||
| } | ||
|
|
||
| /* Is this a ZX Spectrum Next (or a Next core on another FPGA board)? Its | ||
| * ESP Wi-Fi module sits behind a UART at the same ports, 133Bh/143Bh, which | ||
| * the eLeMeNt's follows. Told by nextreg 7Fh, a user register: written | ||
| * through 243Bh/253Bh, it reads back on a Next only (a 128K, +2 or +3 | ||
| * decodes neither port: A1 = 1, A0 = 1). Its value is kept. A ZX Printer | ||
| * decodes them (A2 = 0) and starts its motor on 5Ah: on a machine that is | ||
| * not a Next, 04h stops it again. -> L = 1 */ | ||
| static uint8_t next_machine(void) __naked { | ||
| __asm | ||
| ld bc,0x243b ; nextreg select: 7Fh, user register 0 | ||
| ld a,0x7f | ||
| out (c),a | ||
| inc b ; 253Bh: its value | ||
| in e,(c) | ||
| ld a,0x5a | ||
| out (c),a | ||
| in a,(c) | ||
| cp 0x5a | ||
| jr nz,nm_no | ||
| ld a,0xa5 | ||
| out (c),a | ||
| in a,(c) | ||
| out (c),e ; the user value back | ||
| cp 0xa5 | ||
| jr nz,nm_no | ||
| ld hl,1 | ||
| ret | ||
| nm_no: | ||
| ld a,4 ; not a Next: a ZX Printer on these ports, motor off | ||
| out (c),a | ||
| ld hl,0 | ||
| ret | ||
| __endasm; | ||
| } | ||
| extern uint8_t esp_next; /* tcp_esp01_at.c: the Next's UART and reset, not the ZXi's */ | ||
| #endif | ||
|
|
||
| /* the game's tcp_present, through bank6_entries.h */ | ||
| /* the game's tcp_present, through bank6_entries.h; the machine's name for | ||
| * the relay goes above the game's staging buffer (NET_PLATFORM_AT, 5DAAh: | ||
| * the game reads it there when it opens a room) */ | ||
| #define PF_AT ((char *)0x5daa) | ||
| uint8_t bank6_present(void) { | ||
| #ifdef BANK6_ESP01 | ||
| if (!esp01_machine()) return 0; | ||
| strcpy(PF_AT, "&pf=element-zx-128k"); | ||
| if (esp01_machine()) esp_next = 0; | ||
| else if (next_machine()) { esp_next = 1; strcpy(PF_AT, "&pf=zx-spectrum-next"); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| else return 0; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| #else | ||
| PF_AT[0] = 0; /* the Spectranet test build: no name (the machine is unknown) */ | ||
| #endif | ||
| return tcp_present(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.