Debian Codegraph @

mednafen/wswan/wstech24.txt

raw
1 ___ ___ _
2 / | \ ___ __/ \__ ___ ___ /\__
3 \ / \ // __>\_ _// __|/ __\/ \
4 \_____/_\__ \ \_/ \___|\___/\_/\_/
5 \____/ 2.4 - 26.12.2003
6
7 1. ABOUT
8 WStech doc v2.4 made by Judge and Dox
9 Special thanks to -anonymous- contributor for some usefull info.
10
11 For more info please visit http://www.pocketdomain.net
12
13 Comments/updates/infos please send to [email protected]
14
15 What's new in version 2.4:
16
17 - corect info about Sprite Table, BG Map and FG Map locations
18 (ports $04 and $07 - section 10)
19 Special thanks to mika-n
20
21 2. CPU
22
23 Bandai SPGY-1001 ASWAN 9850KK003
24 NEC V30 MZ - fast version of V30 with internal pipeline (16 bytes prefatch buffer) running at 3.072 MHz.
25 V30 MZ is aprox 4 times faster than V30.
26 The V30MZ performs pipeline processing internally, performing instruction fetch (prefetch), instruction decode, and
27 instruction execution in parallel. For this reason, it is difficult to determine what part of the program is currently being
28 executed by monitoring the output of the address bus for the instruction code fetch.
29 If there are conditional branch instructions, even in case branching does not occur, the address of the branch
30 destination is prefetched (only one time), so that further monitoring of the program is difficult.
31 The V30MZ has 8 prefetch queues (16 bytes).
32
33 There are a few other differences between V30MZ and V30 cpu (unsupported opcodes , different flag handling after mul/div).
34
35 Timing:
36
37 Hblank : 256 CPU cycles
38 Vblank : 159 Hblank = 159*256/3072000 = 75.47Hz
39
40
41 3. MEMORY
42
43 20 bit addressing space = 1 Megabyte. Memory is splitted into 64KB blocks (segments/banks).
44
45 Segments:
46
47 0 - RAM - 16 KB (WS) / 64 KB (WSC) internal RAM (see below)
48
49 1 - SRAM (cart) SRAM is BSI device BS62LV256TC - 256K(32Kx8) Static RAM - TSOP 0 - 70 c, 70 ns (http://www.bsi.com.tw/product/bs62lv256.pdf)
50
51 2 - ROM Bank (initial bank = last)
52 3 - ROM Bank (lnitial bank = last)
53
54 4 - ROM Bank (initial bank = last - 11)
55 5 - ROM Bank (initial bank = last - 10)
56 6 - ROM Bank (initial bank = last - 9)
57 7 - ROM Bank (initial bank = last - 8)
58 8 - ROM Bank (initial bank = last - 7)
59 9 - ROM Bank (initial bank = last - 6)
60 A - ROM Bank (initial bank = last - 5)
61 B - ROM Bank (initial bank = last - 4)
62 C - ROM Bank (initial bank = last - 3)
63 D - ROM Bank (initial bank = last - 2)
64 E - ROM Bank (initial bank = last - 1)
65 F - ROM Bank (initial bank = last)
66
67 Segments 2-$F are switchable using ports :
68
69 $C2 - Segment 2 (value written to port is ROM Bank number ($FF means last ROM bank (last 64 kbytes of ROM file) , $FE = last - 1 .. etc)
70 $C3 - Segment 3 (same as above)
71 $C0 - Segments 4-$F - bits 0,1,2 and 3 of port $C0 are bits 4,5,6 and 7 of ROM bank number in segments 4-$F . Bits 0-3
72 are taken form segment number ( for example , IO[$C0]=$4E -> segment 9 contains ROM bank $E9).
73
74 RAM Map :
75
76 $0000 - $1FFF WS/WSC
77 $2000 - $3FFF 4 Col Tiles WS/WSC
78 -------------
79 $4000 - $7FFF 16 Col Tiles Bank 0 WSC only
80 $8000 - $BFFF 16 Col Tiles Bank 1 WSC only
81 $C000 - $FDFF WSC only
82 $FE00 - $FFFF Palettes (WSC) WSC only
83
84 Some games required initialized (?) part of RAM, for example:
85
86 $75AC = $41 = "A"
87 $75AD = $5F = "_"
88 $75AE = $43 = "C"
89 $75AF = $31 = "1"
90 $75B0 = $6E = "n"
91 $75B1 = $5F = "_"
92 $75B2 = $63 = "c"
93 $75B3 = $31 = "1"
94
95 4. VIDEO
96
97 Screen size - 224 x 144 pixels (28 x 18 tiles)
98 Tile size - 8 x 8 dots , 16 bytes/tile (4 col modes) or 32 bytes/tile (16 col modes)
99 Map size - 256 x 256 pixels (32 x 32 tiles)
100 Layers - Two layers - Background and Foreground (top layer)
101 Maps locations - Selectable using port $07
102 Tiles locations - Fixed, two banks - one at $4000 , second at $8000
103 Map format - Each position in the map is defined by one word:
104 bits 0 - 8 - Tile number (0-511)
105 bits 9 - 12 - Palette number (0-15)
106 bit 13 - WS = unused / WSC = tile bank
107 bit 14 - Horizontal flip
108 bit 15 - Vertical flip
109 Tile formats - Depends on video mode (port $60)
110 Sprites - Max 128 sprites , limited to max 32 on scanline
111 sprite format:
112 byte 0,1 - bits
113 0 - 8 - Tile number (0-511)
114 9 - 11 - Palette number (0-7) + 8 -> (8-15)
115 12 - Sprite window clipping on/off
116 13 - Priority with respect to the layers
117 0 - appear between the 2 background and foreground layers
118 1 - appear on top of both layers
119 14 - Horizontal flip
120 15 - Vertical flip
121 byte 2 - Y position on the screen
122 byte 3 - X position on the screen
123
124 Sprite table is buffered durning frame display.
125 Probably up to scanline 140 (1238-144?)
126
127 Colors - Wonderswan (Mono) is capable of showing 16 shades of gray(only 8 can be selected at any one time)
128 These 8 shades form a pool from which the palette definition can select shades. There are 16 palettes.
129 All 16 palettes are used by BG and FG layers , the last 8 are used also by sprites.
130 Which 8 colors are used for palette generation is defined by ports 1C and 1E- port 1C
131 defines palette colors 0 - 3, port 1E defines 4 - 7. Each palette selection is 4 bits in
132 size:
133 1C : 11110000
134 1D : 33332222
135 1E : 55554444
136 1F : 77776666
137
138 (where color 15 is the darkest one)
139
140 Ports 20 - 3E are used to define the palettes themselves.
141 20 : x111x000 - palette #0
142 21 : x333x222
143
144 In color video modes each color is defined using one word,
145 where bits:
146 0 - 3 Blue
147 4 - 7 Green
148 8 - 11 Red
149 12 - 14 unused
150 Color palettes are stored in the RAM (segment 0) , at address $FE00
151
152 Scrolling - Each of layers can be scrolled horizontal or vertical using ports $10 - $13
153
154 Transparency - Wonderswan - if bit 3 on palette number is set - color 0 of that palette is transparent
155 Wonderswan color - color 0 of each palette is transparent
156 Windows - There are two windows - rectangular areas for disabling /enabling FG layer (FG window) or sprites(Sprite window)
157
158 5. SOUND
159
160 4 Audio channels.
161 Each channel can play short samples ( 4 bit , 16 bytes ( 32 sampels = 2 samples in byte (bits 0-3 and 4-7))
162 with selectable frequency = 3,072 *10e6 / ((2048 - N) x 32 ) Hz , where N = 11 bit value.
163 Location of that samples is unknown.
164
165 Volume of each audio channle is controlled by writing two 4 bit values ( for left/right output
166 channel) into ports $88 - $8B. Master volume is controlled by port $91
167 (2 bit value = first 'used' bit in master volume output (11 bit wide) , D/A converter can
168 read only 8 bits , starting from bit set in port $91 , for example if first 'used' bit
169 is set to 2 , D/A using bits 2,3,4,5,6,7,8,9 for audio output)
170
171 Additional (selectable) functions :
172 - channel 2 - voice - can play 8 bit samples writing frequently data to ch2 volume I/O port
173 - channel 3 - sweep - two parameters:
174 - step = 2.667 x (N + 1) ms , where N = 5 bit value
175 - value - signed byte (-128 - 127)
176 - channel 4 - noise - 7 selectable noise generators (probably I/O port $8E)
177
178 For detailed info please check ports $80 - $91 in section I/O Ports.
179
180 There's also Audio DMA (please chec ports $4a - $52).
181 Transfer rate is 12KHz (HBlank).
182 I/O ports $4A-$4B and $4E-$4F are autupdated durning data transfer .
183
184 6. ROM HEADER
185
186 Header taking last 10 bytes of each ROM file.
187 Bytes :
188 0 - Developer ID
189 1 - Minimum support system
190 00 - WS Mono
191 01 - WS Color
192 2 - Cart ID number for developer defined at byte 0
193 3 - ??
194 4 - ROM Size
195 01 - ?
196 02 - 4Mbit
197 03 - 8Mbit
198 04 - 16Mbit
199 05 - ?
200 06 - 32Mbit
201 07 - ?
202 08 - 64Mbit
203 09 - 128Mbit
204 5 - SRAM/EEPROM Size
205 00 - 0k
206 01 - 64k SRAM
207 02 - 256k SRAM
208 03 - 1M SRAM (Taikyoku Igo Heisei Kiin)
209 04 - 2M SRAM (WonderWitch)
210 10 - 1k EEPROM
211 20 - 16k EEPROM
212 50 - 8k EEPROM
213 6 - Additional capabilities(?)
214 - bit 0 - 1 - vertical position , 1 - horizontal position
215 - bit 2 - always 1
216
217 7 - 1 - RTC (Real Time Clock)
218 8,9 - Checksum = sum of all ROM bytes except two last ones ( where checksum is stored)
219
220 7. INTERRUPTS
221 The Wonderswan CPU recognizes 7 interrupts from the hardware, these are:
222 7 - HBlank Timer
223 6 - VBlank
224 5 - VBlank Timer
225 4 - Drawing line detection
226 3 - Serial Recieve
227 2 - RTC Alarm (cartridge)
228 1 - Key press
229 0 - Serial Send
230
231 Whether the CPU should indeed take action when one of these interrupts come in
232 is determined by port B2. The above mentioned interrupts correspond with the bit
233 numbers of port B2. When an interrupt occurs the corresponding bit of port B6 gets
234 set to 1 and, if enabled, an interrupt to the CPU is generated. This bit of port B6
235 will have to be cleared through code when the interrupt has been handled.
236
237 Example:
238 The Wonderswan is set to react to VBlank begin interrupts. Then bit 7 of B6 is set high
239 and keeps the interrupt line high until the CPU is able to take action upon this interrupt.
240 A typical VBlank interrupt routine is as follows:
241 <push registers>
242 <do some useful work>
243 out B6,40
244 <pop registers>
245 iret
246
247 The mentioned interrupts do not correspond with the same interrupt numbers for the vectors
248 in the vector table. The base for the actual interrupt numbers is set through port B0. If B0
249 is set to 20h then a VBlank begin interrupt routine must be set at vector 26h. (Base is 20h
250 and VBlank begin interrupt is 6)
251
252 8. CONTROLS - It's easy to check buttons status reading/writing port $B5(see below).
253 There's required some delay between writing and reading port $B5 ( few NOP-s)
254
255 9. Internal EEPROM Communication(?) and 'owner' info structure
256 I/O Ports in range 0xBA -0xBE seems to be used for serial reading of internal
257 WS EEPROM (for example - 'owner' info).
258
259 0xBA (Word) - Data
260 0xBC (Word) - Address (calculated probably Modulo EEPROM size (unknown))
261 0xBE (Byte) - Communication (?)
262 bit 4 set before reading data
263 bit 1 set by hardware , when data is ready to read
264
265 Example :
266
267 mov ax, $1B9
268 out $BC, ax
269 mov al, $10
270 out $BE, al
271 xor dx, dx
272 miniloop:
273 inc dx
274 cmp dl, 32
275 jnc bad_data
276 in al, $BE
277 and al, 1
278 jz miniloop
279 in ax, $BA ; Month and Day of birth
280
281
282 'Owner' info structure :
283
284 - Name - 16 bytes ( 0 = Space, 1 = '0' ... 0xA = '9', 0xB = 'A'... )
285 - Year of birth - 2 bytes (BCD)
286 - Month of birth - 1 byte (BCD)
287 - Day of birth - 1 byte (BCD)
288 - Sex - 1 byte (1 - male , 2 - female)
289 - Blood - 1 byte (1 - A, 2 - B, 3 - 0, 4 - AB)
290
291
292 Struct size - 22 bytes = 11 reads,
293 Address range = 0x1B0 - 0x1BA
294
295 10. I/O PORTS (port number /initial value / description)
296
297 - $00 - $00 - Display control
298 bit 0 - background layer on/off
299 bit 1 - foreground layer on/off
300 bit 2 - sprites on/off
301 bit 3 - sprite window on/off (window coords defined in ports $0C - $0F)
302 bit 4,5 - fg win inside on/off (window coords defined in ports $08 - $0B)
303 Meaning of bits 4 and 5 :
304 5 4
305 ---
306 0 0 FG layer is displayed inside and outside FG window area
307 0 1 ??
308 1 0 FG layer is displayed only inside window
309 1 1 FG layer is displayed outside window
310 - $01 - $00 - Determines the background color
311 bit 0-3 - background color
312 bit 4-7 - background palette (WSC only)
313 - $02 - ??? - Current Line (0 - 158) (159 ???)
314 - $03 - $BB - Line compare (for drawning line detection interrupt)
315 - $04 - $00 - Determines the base address for the sprite table.
316 To get the address of the table, shift this value left 9 times
317 and clear MSB. (bits 0..5 are effective to determines the base,
318 bits 6,7 are unknown)
319 0 0xxxxxx0 00000000
320 (Sprite Attribute Table Base can move from $00000-$07E00 with 512 bytes step)
321 - $05 - $00 - Determines the number of the sprite to start drawing with
322 - $06 - $00 - Determines the number of the sprite to stop drawing.
323 - $07 - $26 - Determines the location of the foreground and background screens in RAM.
324 Format:
325 bits 7-0 : ?fff?bbb
326 bit 7 - Unknown
327 bits 6-4 - Determines foreground location (address is 00fff000 00000000)
328 bit 3-? - Unknown
329 bits 2-0 - Determines background location (address is 00bbb000 00000000)
330 Back Ground Tile Map Base can move from $00000-$03800 (2048 bytes step)
331 - $08 - $FE - x0 of FG window (x0,y0) = top left corner, (x1,y1) = bottom right corner
332 - $09 - $DE - y0 of FG window
333 - $0A - $F9 - x1 of FG window
334 - $0B - $FB - y1 of FG window
335 - $0C - $DB - x0 of SPR window
336 - $0D - $D7 - y0 of SPR window
337 - $0E - $7F - x1 of SPR window
338 - $0F - $F5 - y1 of SPR window
339 - $10 - $00 - Background layer X scroll register
340 - $11 - $00 - Background layer Y scroll register
341 - $12 - $00 - Foreground layer X scroll register
342 - $13 - $00 - Foreground layer Y scroll register
343 - $14 - $01 - LCD Control (???)
344 bit 0 - 1 - LCD on
345 0 - LCD off
346 - $15 - $00 - LCD Icons
347 bit 0 - LCD Sleep
348 bit 1 - Vertical Position
349 bit 2 - Horizontal Position
350 bit 3 - Dot 1
351 bit 4 - Dot 2
352 bit 5 - Dot 3
353 bit 6 - Not Used ?
354 bit 7 - Not Used ?
355 - $16 - $9E - ???
356 - $17 - $9B - ???
357 - $18 - $00 - ???
358 - $19 - $00 - ???
359 - $1A - $00 - ???
360 - $1B - $00 - ???
361 - $1C - $99 - PALCOL10
362 - $1D - $FD - PALCOL32
363 - $1E - $B7 - PALCOL54
364 - $1F - $DF - PALCOL76
365 - $20 - $30 - PAL00
366 - $21 - $57 - PAL01
367 - $22 - $75 - PAL10
368 - $23 - $76 - PAL11
369 - $24 - $15 - PAL20
370 - $25 - $73 - PAL21
371 - $26 - $77 - PAL30
372 - $27 - $77 - PAL31
373 - $28 - $20 - PAL40
374 - $29 - $75 - PAL41
375 - $2A - $50 - PAL50
376 - $2B - $36 - PAL51
377 - $2C - $70 - PAL60
378 - $2D - $67 - PAL61
379 - $2E - $50 - PAL70
380 - $2F - $77 - PAL70
381 - $30 - $57 - PAL00
382 - $31 - $54 - PAL01
383 - $32 - $75 - PAL10
384 - $33 - $77 - PAL11
385 - $34 - $75 - PAL20
386 - $35 - $17 - PAL21
387 - $36 - $37 - PAL30
388 - $37 - $73 - PAL31
389 - $38 - $50 - PAL40
390 - $39 - $57 - PAL41
391 - $3A - $60 - PAL50
392 - $3B - $77 - PAL51
393 - $3C - $70 - PAL60
394 - $3D - $77 - PAL61
395 - $3E - $10 - PAL70
396 - $3F - $73 - PAL70
397 - $40 - $00 - DMA (?) copy source address
398 - $41 - $00 - ^^^
399 - $42 - $00 - copy source bank
400 - $43 - $00 - copy destination bank
401 - $44 - $00 - copy destination address
402 - $45 - $00 - ^^^
403 - $46 - $00 - size of copied data (in bytes)
404 - $47 - $00 - ^^^
405 - $48 - $00 - bit 7 = 1 -> copy start
406 (bit 7=0 when data transfer is finished)
407 DMA(?) isn't immediate and not stopping
408 the main cpu operations (like gbc GDMA)
409 ports $40-$48 are updated durning copy process
410 - $49 - $00 - ???
411
412 - $4A - $00 - sound DMA source address
413 - $4B - $00 - ^^^
414 - $4C - $00 - DMA source memory segment bank
415 - $4D - $00 - ???
416 - $4E - $00 - DMA transfer size (in bytes)
417 - $4F - $00 - ^^^
418 - $50 - $00 - ???
419 - $51 - $00 - ???
420 - $52 - $00 - bit 7 = 1 -> DMA start
421 - $53 - $00 - ???
422 - $54 - $00 - ???
423 - $55 - $00 - ???
424 - $56 - $00 - ???
425 - $57 - $00 - ???
426 - $58 - $00 - ???
427 - $59 - $00 - ???
428 - $5A - $00 - ???
429 - $5B - $00 - ???
430 - $5C - $00 - ???
431 - $5D - $00 - ???
432 - $5E - $00 - ???
433 - $5F - $00 - ???
434 - $60 - $0A - video mode
435 Meaning of bits 5-7:
436 765
437 ---
438 111 16 col/tile 'packed' mode - tiles like in Genesis, 16 col/tile
439 110 16 col/tile 'layered' mode - tiles like in GameGear, 16 col/tile
440 010 4 col/tile - the same as mono (below) but using color palettes, 4 cols/tile, one tile = 16 bytes, WSC only
441 000 4 col/tile mono - tiles like in GameBoy,
442 [bit 7 = 16/4 color/tile , bit 6 - color/mono mode, bit 5 - 'packed' mode on/off]
443 - $61 - $00 - ???
444 - $62 - $00 - ???
445 - $63 - $00 - ???
446 - $64 - $00 - ???
447 - $65 - $00 - ???
448 - $66 - $00 - ???
449 - $67 - $00 - ???
450 - $68 - $00 - ???
451 - $69 - $00 - ???
452 - $6A - $00 - ???
453 - $6B - $0F - ???
454 - $6C - $00 - ???
455 - $6D - $00 - ???
456 - $6E - $00 - ???
457 - $6F - $00 - ???
458 - $70 - $00 - ???
459 - $71 - $00 - ???
460 - $72 - $00 - ???
461 - $73 - $00 - ???
462 - $74 - $00 - ???
463 - $75 - $00 - ???
464 - $76 - $00 - ???
465 - $77 - $00 - ???
466 - $78 - $00 - ???
467 - $79 - $00 - ???
468 - $7A - $00 - ???
469 - $7B - $00 - ???
470 - $7C - $00 - ???
471 - $7D - $00 - ???
472 - $7E - $00 - ???
473 - $7F - $00 - ???
474 - $80 - $00 - Audio 1 Freq
475 - $81 - $00 - ^^^
476 - $82 - $00 - Audio 2 Freq
477 - $83 - $00 - ^^^
478 - $84 - $00 - Audio 3 Freq
479 - $85 - $00 - ^^^
480 - $86 - $00 - Audio 4 Freq
481 - $87 - $00 - ^^^
482 - $88 - $00 - Audio 1 volume
483 - $89 - $00 - Audio 2 volume
484 - $8A - $00 - Audio 3 volume
485 - $8B - $00 - Audio 4 volume
486 - $8C - $00 - ?? Sweep value
487 - $8D - $1F - ?? Sweep step
488 - $8E - $00 - Noise control
489 Bits :
490 0 - Noise generator type
491 1 - ^^^
492 2 - ^^^
493 3 - Reset
494 4 - Enable
495 5 - ???
496 6 - ???
497 7 - ???
498 - $8F - $00 - Sample location
499 To get the address of samples, shift this value left 6 times.
500 0 00xxxxxx xx000000
501 - $90 - $00 - Audio control
502 Bits:
503 0 - Audio 1 on/off
504 1 - Audio 2 on/off
505 2 - Audio 3 on/off
506 3 - Audio 4 on/off
507 4 - ???
508 5 - Audio 2 Voice
509 6 - Audio 3 Sweep
510 7 - Audio 4 Noise
511 - $91 - $00 - Audio Output
512 Bits :
513 0 - Mono
514 1 - Output Volume
515 2 - ^^^
516 3 - External Stereo
517 4 - ???
518 5 - ???
519 6 - ???
520 7 - External Speaker (set by hardware)
521 - $92 - $00 - Noise Counter Shift Register (15 bits)
522 - $93 - $00 - ^^^
523 - $94 - $00 - Volume (4 bit)
524 - $95 - $00 - ???
525 - $96 - $00 - ???
526 - $97 - $00 - ???
527 - $98 - $00 - ???
528 - $99 - $00 - ???
529 - $9A - $00 - ???
530 - $9B - $00 - ???
531 - $9C - $00 - ???
532 - $9D - $00 - ???
533 - $9E - $03 - ???
534 - $9F - $00 - ???
535 - $A0 - $87 - Hardware type
536 bit 1 - 1 - color
537 0 - mono
538 - $A1 - $00 - ???
539 - $A2 - $0C - Timer Control
540 bit 0 - Hblank Timer on/off
541 bit 1 - Hblank Timer Mode
542 0 - One Shot
543 1 - Auto Preset
544 bit 2 - Vblank Timer(1/75s) on/off
545 bit 3 - Vblank Timer Mode
546 0 - One Shot
547 1 - Auto Preset
548 - $A3 - $00 - ???
549 - $A4 - $00 - Hblank Timer 'frequency'
550 0 = no HBLANK Interrupt
551 n = HBLANK Interrupt every n lines (???)
552 - $A5 - $00 - ^^^
553 - $A6 - $4F - Vblank Timer 'frequency'
554 - $A7 - $FF - ^^^
555 - $A8 - $00 - Hblank Counter - 1/12000s
556 - $A9 - $00 - Hblank Counter - 1/(12000>>8)s
557 - $AA - $00 - Vblank Counter - 1/75s
558 - $AB - $00 - Vblank Counter - 1/(75>>8)s
559 - $AC - $00 - ???
560 - $AD - $00 - ???
561 - $AE - $00 - ???
562 - $AF - $00 - ???
563 - $B0 - $00 - Interrupt Base
564 - $B1 - $DB - Communication byte
565 - $B2 - $00 - Interrupt enable
566 bit 7 - HBlank Timer
567 bit 6 - VBlank begin
568 bit 5 - VBlank Timer
569 bit 4 - Drawing line detection
570 bit 3 - Serial receive
571 bit 2 - RTC Alarm
572 bit 1 - Key press
573 bit 0 - Serial transmit
574 - $B3 - $00 - Communication direction
575 bit 7 - Recieve data interrupt generation
576 bit 6 - Connection Speed
577 0 - 9600 bps
578 1 - 38400 bps
579 bit 5 - Send data interrupt generation
580 bit 4 - ???
581 bit 3 - ???
582 bit 2 - Send Complete
583 bit 1 - Error
584 bit 0 - Recieve Complete
585
586 write $00-$7f = read $00
587 write $80-$bf = read $84
588 write $c0-$cf = read $c4
589 - $B4 - $00 - ???
590 - $B5 - $40 - Controls
591 bits 4-7 : read/write - Select line of inputs to read
592 0001 - read vertical cursors
593 0010 - read hozizontal cursors
594 0100 - read buttons
595 bits 0-3 : read only - Read the current state of the input lines (positive logic) after having written 10h,20h, or 40h.
596 Meaning of the bits when reading cursors:
597 bit 0 - cursor up
598 bit 1 - cursor right
599 bit 2 - cursor down
600 bit 3 - cursor left
601 Meaning of the bits when reading buttons:
602 bit 0 - ???
603 bit 1 - START
604 bit 2 - A
605 bit 3 - B
606 - $B6 - $00 - Interrupt Acknowledge
607 bit 7 - HBlank Timer
608 bit 6 - VBlank begin
609 bit 5 - VBlank Timer
610 bit 4 - Drawing line detection
611 bit 3 - Serial receive
612 bit 2 - RTC Alarm
613 bit 1 - Key press
614 bit 0 - Serial transmit
615 - $B7 - $00 - ???
616 - $B8 - $00 - ???
617 - $B9 - $00 - ???
618 - $BA - $01 - Internal EEPROM (?) Data
619 - $BB - $00 - ^^^
620 - $BC - $42 - Internal EEPROM (?) Address (calculated probably Modulo EEPROM (1kbit?) size (mirroring for read/write))
621 - $BD - $00 - ^^^
622 - $BE - $83 - Internal EEPROM (?) Command
623 bit 7 - Initialize ?
624 bit 6 - Protect ?
625 bit 5 - Write
626 bit 4 - Read
627 bit 3 - ???
628 bit 2 - ???
629 bit 1 - Write Complete (Read only)
630 bit 0 - Read Complete (Read only)
631 - $BF - $00 - ???
632 - $C0 - $2F - ROM Bank Base Selector for segments 4-$F
633 - $C1 - $3F - SRAM Bank selector (???)
634 - $C2 - $FF - BNK2SLCT - ROM Bank selector for segment 2
635 - $C3 - $FF - BNK3SLCT - ROM Bank selector for segment 3
636 - $C4 - $00 - EEPROM Data
637 - $C5 - $00 - ^^^
638 - $C6 - $00 - 1kbit EEPROM (16bit*64) :
639 - bits 0-5 - address
640 - bits 6-7 - command :
641 0 - Extended Comand Address bits 4-5
642 0 - Write Disable
643 1 - Write All
644 2 - Erase All
645 3 - Write Enable
646 1 - Write
647 2 - Read
648 3 - Erase
649 - 16 kbit EEPROM (16bit*1024) - bits 0-7 - address (low)
650 - $C7 - $00 - 1kbit EEPROM (16bit*64) :
651 bit 0 - Start
652 - 16 kbit EEPROM (16bit*1024) :
653 - bits 0-1 - address (high)
654 - bits 2-3 - command :
655 0 - Extended Comand Address bits 0-1
656 0 - Write Disable
657 1 - Write All
658 2 - Erase All
659 3 - Write Enable
660 1 - Write
661 2 - Read
662 3 - Erase
663 - bit 4 - Start
664 - $C8 - $D1 - EEPROM Command :
665 bit 7 - Initialize ???
666 bit 6 - Protect ???
667 bit 5 - Write
668 bit 4 - Read
669 bit 3 - ???
670 bit 2 - ???
671 bit 1 - Write Complete (Read only)
672 bit 0 - Read Complete (Read only)
673 - $C9 - $D1 - ???
674 - $CA - $D1 - RTC Command
675 Write :
676 - $10 - Reset
677 - $12 - ??? Alarm ???
678 - $13 - ???
679 - $14 - Set Time
680 - $15 - Get Time
681 Read:
682 - bit 7 - Ack [HACK = 1]
683 - $CB - $D1 - RTC Data
684 Write :
685 Sometimes $40 , and wait for bit 7 = 1
686 After Command ($CA):
687 - $14 - 7 writes (all BCD):
688 - Year ( + 2000)
689 - Month
690 - Day
691 - Day Of Week
692 - Hour
693 - Min
694 - Sec
695 Read
696 After Command ($CA) :
697 - $13 - bit 7 - Ack [HACK = 1]
698 - $15 - 7 reads (all BCD)
699 - Year ( + 2000)
700 - Month
701 - Day
702 - Day Of Week
703 - Hour
704 - Min
705 - Sec
706 - $CC - $D1 - ???
707 - $CD - $D1 - ???
708 - $CE - $D1 - ???
709 - $CF - $D1 - ???
710 - $D0 - $D1 - ???
711 - $D1 - $D1 - ???
712 - $D2 - $D1 - ???
713 - $D3 - $D1 - ???
714 - $D4 - $D1 - ???
715 - $D5 - $D1 - ???
716 - $D6 - $D1 - ???
717 - $D7 - $D1 - ???
718 - $D8 - $D1 - ???
719 - $D9 - $D1 - ???
720 - $DA - $D1 - ???
721 - $DB - $D1 - ???
722 - $DC - $D1 - ???
723 - $DD - $D1 - ???
724 - $DE - $D1 - ???
725 - $DF - $D1 - ???
726 - $E0 - $D1 - ???
727 - $E1 - $D1 - ???
728 - $E2 - $D1 - ???
729 - $E3 - $D1 - ???
730 - $E4 - $D1 - ???
731 - $E5 - $D1 - ???
732 - $E6 - $D1 - ???
733 - $E7 - $D1 - ???
734 - $E8 - $D1 - ???
735 - $E9 - $D1 - ???
736 - $EA - $D1 - ???
737 - $EB - $D1 - ???
738 - $EC - $D1 - ???
739 - $ED - $D1 - ???
740 - $EE - $D1 - ???
741 - $EF - $D1 - ???
742 - $F0 - $D1 - ???
743 - $F1 - $D1 - ???
744 - $F2 - $D1 - ???
745 - $F3 - $D1 - ???
746 - $F4 - $D1 - ???
747 - $F5 - $D1 - ???
748 - $F6 - $D1 - ???
749 - $F7 - $D1 - ???
750 - $F8 - $D1 - ???
751 - $F9 - $D1 - ???
752 - $FA - $D1 - ???
753 - $FB - $D1 - ???
754 - $FC - $D1 - ???
755 - $FD - $D1 - ???
756 - $FE - $D1 - ???
757 - $FF - $D1 - ???