Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 5780

8-bit acorn hardware • Re: Master Compact MOS 5.x ADVAL for custom A/D and joystick hardware

$
0
0
This is one of numerous bits of code that I haven't yet investigated as part of my Master MOS disassembly project, but this post made me take a quick look.

The code in MOS 5.10 is $e7de. $024e (adcConversionType) is the value set by OSBYTE 190. As above, if bit 7 set, it does service call $2c, passing the page 2-relative address of the 8-byte ADC results buffer at $2b6.

The switched joystick code looks to poke about at various parts of the ADC results area - didn't look very hard at this. (I think this is all for handling the SWITCHED/PROPORTIONAL/STICK configure settings? - but don't quote me on that. The Compact manual is rubbish, and it's not at all clear to me what any of this stuff actually does.)

OSBYTE $80 reads the values, and that's easier to follow. (Note: on entry to the OSBYTE handlers, C=1, N/Z set as per X.) The actual addresses it reads are as per the LSB/MSB values in this table: (Xin = X on entry to the OSBYTE; INX/&1/ASL are the intermediate values, so you can check my working.)

Code:

| Xin | INX | &1 | ASL |   LSB |   MSB ||-----+-----+----+-----+-------+-------||   1 |   2 |  0 |   0 | 0x2b7 | 0x2b8 ||   2 |   3 |  1 |   2 | 0x2b9 | 0x2ba ||   3 |   4 |  0 |   0 | 0x2b7 | 0x2b8 ||   4 |   5 |  1 |   2 | 0x2b9 | 0x2ba |
Which matches up with the above description: (the layout is quite different from MOS 3.xx)

- $2b6 is unused
- $2b7/$2b8 is ADC channel 1 or 3: the X value
- $2b9/$2ba is ADC channel 2 or 4: the Y value
- $2bb/$2bc are spare
- $2bd is spare too, but it's not mentioned

So it looks like the "coordinates" are actually the actual values to return from ADVAL for channels 1 and 2. (Or channels 3 and 4, for that matter, which it looks like are the same thing...)

--Tom

Statistics: Posted by tom_seddon — Tue Nov 04, 2025 12:03 am



Viewing all articles
Browse latest Browse all 5780

Trending Articles