OSBYTE Calls

Complete OSBYTE directory. Call: JSR &FFF4 (indirected through &20A) with A = call number, X/Y per call. Most are documented in naug-appendix-ab Appendix A (NAUG p443-447).

Many OSBYTEs follow the read/modify/write byte protocol: NEW = (OLD AND Y) EOR X, with the old value returned in X. Read: X=0, Y=&FF. Write: X=val, Y=0.

NAUG page numbers are book pages — they are 8 less than the PDF page numbers in raw/manuals/New_Advanced_User_Guide.pdf (book p171 = PDF p179, etc.). Where a wiki source page is available (chapter ingested), it’s linked.

Calls &00-&1F — actions

Hex#FunctionNAUG pSource
&000Print / identify OS version427(Ch24, pending)
&011Set user flag429(Ch24, pending)
&022Select input stream105, 241(Ch6, pending)
&033Select output stream108, 241(Ch6, pending)
&044Enable/disable cursor editing225(Ch14, pending)
&055Select printer destination422(Ch24, pending)
&066Set printer ignore character423(Ch24, pending)
&077Set RS423 receive baud rate242(Ch15, pending)
&088Set RS423 transmit baud rate242(Ch15, pending)
&099Set flashing-colour mark duration178naug-ch13-video
&0A10Set flashing-colour space duration179naug-ch13-video
&0B11Set keyboard auto-repeat delay224(Ch14, pending)
&0C12Set keyboard auto-repeat rate224(Ch14, pending)
&0D13Disable events121(Ch7, pending)
&0E14Enable events121(Ch7, pending)
&0F15Flush selected buffer class143(Ch9, pending)
&1016Select ADC channel366(Ch20, pending)
&1117Force ADC conversion367(Ch20, pending)
&1218Reset soft function keys227(Ch14, pending)
&1319Wait for vertical sync182naug-ch13-video
&1420Explode character definition RAM (Model B: X = char-group count; Master: parameters ignored, always resets standard exploded font)172naug-ch13-video
&1521Flush specific buffer143(Ch9, pending)
&1622Increment polling semaphore325(Ch17, pending)
&1723Decrement polling semaphore325(Ch17, pending)
&1824Select external sound (Electron)375(Ch21, pending)
&1925Restore default font definitions (Master)173naug-ch13-video

OSBYTEs &1A-&43 (26-67) are unused by the OS.

Calls &44-&6F — actions (sparse)

Hex#FunctionNAUG pSource
&4468Test for sideways RAM159naug-ch12-memory
&4569Sideways RAM allocation160naug-ch12-memory
&6B107Switch internal (cartridge) vs external 1MHz bus (Master); also affects Tube selection413(Ch23, pending)
&6C108Master CPU view of &3000-&7FFF — X=0 main, X=1 shadow. NOT for “direct screen access” — it remaps where the CPU’s reads/writes to that range go, not the display itself157naug-ch12-memory
&6D109Make temporary filing system permanent260(Ch16, pending)

&46-&6A and &6E-&6F unused.

Calls &70-&7F — actions

Hex#FunctionNAUG pSource
&70112Master: select VDU-driver write destination — X=0 default, X=1 main, X=2 shadow (=LYNNE). Controls where MOS character output lands; CRTC display source unaffected.158naug-ch12-memory
&71113Master: select CRTC display source — X=0 default, X=1 main, X=2 shadow. The display half of the interlaced-640x512-style double-buffering pair with &70.158naug-ch12-memory
&72114Master: set shadow state at next mode change (= *SHADOW command). Doesn’t take effect immediately; queued until next VDU 22.159naug-ch12-memory
&73115Blank or restore palette (Electron)181naug-ch13-video
&74116Reset sound system (Electron)375(Ch21, pending)
&75117Read VDU status176naug-ch13-video
&76118Make LEDs reflect keyboard status228(Ch14, pending)
&77119Close *SPOOL/*EXEC files257(Ch16, pending)
&78120Write current keys pressed222(Ch14, pending)
&79121Perform keyboard scan221(Ch14, pending)
&7A122Perform keyboard scan from &10222(Ch14, pending)
&7B123Printer driver going dormant425(Ch24, pending)
&7C124Clear ESCAPE condition147(Ch10, pending)
&7D125Set ESCAPE condition147(Ch10, pending)
&7E126Acknowledge ESCAPE + effects147(Ch10, pending)
&7F127Check for EOF258(Ch16, pending)

Calls &80-&9F — reads / mixed

(Some numbers have two meanings depending on machine — both listed.)

Hex#FunctionNAUG pSource
&80128Read ADC channel365(Ch20, pending)
&80128Read buffer status143(Ch9, pending)
&81129Read key with time limit / read machine type221, 428(Ch14/24, pending)
&82130Read machine high-order address257(Ch16, pending)
&83131Read OSHWM (top of OS RAM)117(Ch6, pending)
&84132Read HIMEM (top of user RAM)157naug-ch12-memory
&85133Read HIMEM for given mode157naug-ch12-memory
&86134Read input cursor position (POS, VPOS)175naug-ch13-video
&87135Read character at text cursor + screen mode174naug-ch13-video
&88136Perform *CODE425(Ch24, pending)
&89137Perform *MOTOR262(Ch16, pending)
&8A138Insert value into buffer144(Ch9, pending)
&8B139Perform *OPT258(Ch16, pending)
&8C140Perform *TAPE262(Ch16, pending)
&8D141Perform *ROM264(Ch17, pending)
&8E142Enter language ROM322(Ch17, pending)
&8F143Issue paged ROM service request322(Ch17, pending)
&90144Perform *TV184naug-ch13-video
&91145Get character from buffer145(Ch9, pending)
&92146Read from FRED (1MHz bus)403(Ch23, pending)
&93147Write to FRED403(Ch23, pending)
&94148Read from JIM403(Ch23, pending)
&95149Write to JIM403(Ch23, pending)
&96150Read from SHEILA403(Ch23, pending)
&97151Write to SHEILA403(Ch23, pending)
&98152Examine buffer status145(Ch9, pending)
&99153Put character into input buffer146(Ch9, pending)
&9A154Write Video ULA control register + OS copy (BBC) / Reset flash cycle (Electron)180naug-ch13-video
&9B155Write Video ULA palette register + OS copy (XOR 7)181naug-ch13-video
&9C156R/W 6850 control register + OS copy244(Ch15, pending)
&9D157Fast Tube BPUT254(Ch18, pending)
&9E158Read from speech processor374(Ch21, pending)
&9F159Write to speech processor374(Ch21, pending)

Calls &A0-&BF — reads / R/W

Hex#FunctionNAUG pSource
&A0160Read VDU variable value183naug-ch13-video
&A1161Read CMOS RAM/EEPROM (Master)356(Ch19, pending)
&A2162Write CMOS RAM/EEPROM (Master)358(Ch19, pending)
&A3163(Reserved for app software)
&A4164Check for 6502 code326(Ch17, pending)
&A5165Read output cursor position (POS, VPOS) (Master)174naug-ch13-video
&A6166Read start address of OS variables (LSB)118(Ch6, pending)
&A7167Read start address of OS variables (MSB)118(Ch6, pending)
&A8168ROM pointer table address (LSB)323(Ch17, pending)
&A9169ROM pointer table address (MSB)323(Ch17, pending)
&AA170ROM info table address (LSB)323(Ch17, pending)
&AB171ROM info table address (MSB)323(Ch17, pending)
&AC172Key translation table address (LSB)223(Ch14, pending)
&AD173Key translation table address (MSB)223(Ch14, pending)
&AE174VDU variables address (LSB)183naug-ch13-video
&AF175VDU variables address (MSB)183naug-ch13-video
&B0176R/W CFS timeout counter249(Ch15, pending)
&B1177R/W input source105(Ch6, pending)
&B2178R/W keyboard semaphore230(Ch14, pending)
&B3179R/W primary OSHWM117(Ch6, pending)
&B4180R/W current OSHWM117(Ch6, pending)
&B5181R/W RS423 mode243(Ch15, pending)
&B6182R character def explosion (B / Electron) OR R/W use printer ignore char (Master)173, 423naug-ch13-video
&B7183R/W cassette/ROM filing system switch263(Ch16, pending)
&B8184Read OS copy of Video ULA control182naug-ch13-video
&B9185Read OS copy of Video ULA palette OR R/W polling semaphore182, 326naug-ch13-video
&BA186R/W active ROM number at last BRK135naug-ch08-interrupts
&BB187R/W BASIC ROM number324(Ch17, pending)
&BC188Read current ADC channel367(Ch20, pending)
&BD189Read max ADC channel367(Ch20, pending)
&BE190R/W ADC conversion type368(Ch20, pending)
&BF191R/W RS423 use flag244(Ch15, pending)

Calls &C0-&DF — R/W state

Hex#FunctionNAUG pSource
&C0192R/W RS423 control flag245(Ch15, pending)
&C1193R/W flash counter180naug-ch13-video
&C2194R/W flash mark duration179naug-ch13-video
&C3195R/W flash space duration179naug-ch13-video
&C4196R/W keyboard auto-repeat delay224(Ch14, pending)
&C5197R/W keyboard auto-repeat rate225(Ch14, pending)
&C6198R/W *EXEC file handle258(Ch16, pending)
&C7199R/W *SPOOL file handle258(Ch16, pending)
&C8200R/W ESCAPE and BREAK effects148, 419(Ch10/Ch24, pending)
&C9201R/W keyboard disable228(Ch14, pending)
&CA202R/W keyboard status229(Ch14, pending)
&CB203R/W RS423 handshake OR R/W Electron ULA IRQ bit mask246, 132naug-ch08-interrupts
&CC204R/W RS423 input suppression OR R/W firm key pointer (Electron)246, 231(Ch15/Ch14, pending)
&CD205R/W cassette/RS423 selection OR R/W firm key string length (Electron)246, 231(Ch15/Ch14, pending)
&CE206R/W Econet OS call interception118(Ch6, pending)
&CF207R/W Econet OSRDCH interception118(Ch6, pending)
&D0208R/W Econet OSWRCH interception118(Ch6, pending)
&D1209R/W speech suppression status373(Ch21, pending)
&D2210R/W sound suppression status373(Ch21, pending)
&D3211R/W BELL channel374(Ch21, pending)
&D4212R/W BELL amplitude/envelope374(Ch21, pending)
&D5213R/W BELL frequency374(Ch21, pending)
&D6214R/W BELL duration374(Ch21, pending)
&D7215R/W OS startup message + !BOOT options419(Ch24, pending)
&D8216R/W soft key string length227(Ch14, pending)
&D9217R/W lines printed since last page176naug-ch13-video
&DA218R/W number of characters in VDU queue168naug-ch13-video
&DB219R/W TAB character231(Ch14, pending)
&DC220R/W ESCAPE character148, 232(Ch10/Ch14, pending)
&DD221R/W character &C0-&CF status226(Ch14, pending)
&DE222R/W character &D0-&DF status226(Ch14, pending)
&DF223R/W character &E0-&EF status226(Ch14, pending)

Calls &E0-&FF — R/W state

Hex#FunctionNAUG pSource
&E0224R/W character &F0-&FF status226(Ch14, pending)
&E1225R/W function key status226(Ch14, pending)
&E2226R/W SHIFT+fn key status226(Ch14, pending)
&E3227R/W CTRL+fn key status226(Ch14, pending)
&E4228R/W CTRL+SHIFT+fn key status226(Ch14, pending)
&E5229R/W ESCAPE key status149(Ch10, pending)
&E6230R/W ESCAPE effects149(Ch10, pending)
&E7231R/W user 6522 VIA IRQ bit mask130naug-ch08-interrupts
&E8232R/W 6850 IRQ bit mask / R/W ext sound semaphore (Electron)131, 247, 375naug-ch08-interrupts
&E9233R/W system 6522 VIA IRQ bit mask131naug-ch08-interrupts
&EA234R/W Tube presence flag347(Ch18, pending)
&EB235R/W speech processor presence flag373(Ch21, pending)
&EC236R/W output stream destination109(Ch6, pending)
&ED237R/W cursor editing status225(Ch14, pending)
&EE238R/W base for numeric keypad230(Ch14, pending)
&EF239R/W shadow state159naug-ch12-memory
&F0240R/W country code428(Ch24, pending)
&F1241R/W user flag429(Ch24, pending)
&F2242R/W OS copy of serial ULA247(Ch15, pending)
&F3243R/W timer switch state353(Ch19, pending)
&F4244R/W soft key consistency flag227(Ch14, pending)
&F5245R/W printer destination422(Ch24, pending)
&F6246R/W printer ignore character423(Ch24, pending)
&F7247R/W BREAK intercept code (JMP)420(Ch24, pending)
&F8248R/W BREAK intercept code (LSB)420(Ch24, pending)
&F9249R/W BREAK intercept code (MSB)420(Ch24, pending)
&FA250R/W VDU shadow memory flag158naug-ch12-memory
&FB251R/W display shadow memory flag159naug-ch12-memory
&FC252R/W current language ROM number324(Ch17, pending)
&FD253R/W last BREAK type420(Ch24, pending)
&FE254R/W shift key effect / R/W available RAM230, 160naug-ch12-memory
&FF255R/W start-up options421(Ch24, pending)

Performance note

OSBYTE round-trip is expensive — JSR + indirect through &20A + dispatch + work + RTS. A single OSBYTE &13 (wait vsync) costs hundreds of cycles overhead before any waiting happens.

For tight raster code: read state via the OSBYTE once, cache the result, then do direct hardware writes inside your loop. E.g. for palette updates, query the OS palette copy once via OSBYTE &B9, then STA &FE21 directly inside the hot loop — the OS shadow goes stale, but you’ll restore it before exiting your routine (or accept the desync if MOS won’t be called again).

See video-ula for the OSBYTE-vs-direct trade-off discussion.

Master Reference Manual functional grouping

master-rm Ch D.2 organises OSBYTEs by functional area rather than by number — a useful complementary index when you know what you want to do but don’t remember the OSBYTE number. The MRM groups:

  • ADC: 16-21, 128-129, 188-190, 217
  • BREAK / reset: 200, 247-249, 253, 255
  • CMOS RAM (Master only): 161 (read), 162 (write)
  • Econet: 206-208
  • ESCAPE: 124-126, 220, 229-230
  • Filing system: 109, 119, 127, 137-141, 164, 176, 183, 198, 199
  • Input/output: 2-3, 15, 21, 138, 145, 152-153, 177, 236
  • Character interpretation: 4, 219, 221-228, 237, 238 (new), 254 (new)
  • Interrupts/events: 13-14, 231-235
  • Keyboard: 11-12, 118, 120, 124-125, 138-139, 145, 178, 196-202, 217-228, 237-238, 254
  • Mode/screen: 19, 25, 75, 112-114, 117, 132-135, 144, 159-160
  • Printer: 5-6, 117, 144, 182, 213
  • RS423: 2-3, 7-8, 15, 21, 152, 157, 181, 191-192, 203-205, 207-208
  • Shadow RAM (B+/Master): 108, 110-114, 250-251
  • Sound: 117-118, 210-216
  • System info: 0-1, 117, 128-135, 164
  • Time/clock: 4-7 (CMOS RTC, Master only via OSWORD &0E/&0F), 158, 165-167
  • Tube: 145-146, 191, 234

Calls marked £ in the MRM are Master-new or have new Master behaviour. The notable Master-new ones are:

  • &14 (20): reset font now ignores params (Model B used X for char count)
  • &16 (22) / &17 (23): increment/decrement ROM-polling semaphore (for service call 21)
  • &6B (107): internal/external 1MHz bus switch
  • &6C (108): main/shadow CPU view of &3000-&7FFF
  • &6D (109): make temporary FS permanent
  • &70 (112): VDU-write target — main/shadow
  • &71 (113): CRTC display source — main/shadow
  • &72 (114): default shadow at next mode (*SHADOW equivalent)
  • &81 (129): extended to return Master-specific machine IDs
  • &84 / &85 (132/133): read top of user RAM (was display RAM start on B/B+)
  • &A1 / &A2 (161/162): CMOS RAM read/write
  • &A4 (164): paged-ROM image validity check (“check whether code at X+Y can be *RUN in the I/O processor”). NOT a CPU-type read despite the misleading short name; X+Y are undefined on return and it raises BRK on failure rather than returning a status. See paged-roms. For NMOS-vs-CMOS detection use the PHX/PLX idiom on 6502.
  • &A5 (165): read output cursor position
  • &B3 (179): ROM-polling semaphore read/write (was OSHWM read/write on B)
  • &B6 (182): read NOIGNORE state (was font-explosion state)
  • &EE (238): numeric keypad base setting
  • &FA / &FB (250/251): read VDU memory write/read areas
  • &FE (254): SHIFT effect on numeric pad (was RAM size on B/B+)

Some of these were repurposed from Model B/B+ — code that uses the old meaning on Master gets unexpected results.


This wiki is curated by Claude following the LLM-Wiki methodology — a human curates source documents, the LLM compiles structured cross-linked markdown. Content may contain errors, omissions, or stale claims. For authoritative information refer to the original source documents in the bbc-documents GitHub archive.