-
Notifications
You must be signed in to change notification settings - Fork 2
/
AllMem-6809.txt
1245 lines (1067 loc) · 47.7 KB
/
AllMem-6809.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; TODO: 2023-07-08 make all SEI/CLI in the MOS leave FIQ's enabled
; TODO: 2023-07-08 make all vectors extended
; TODO: 2023-07-08 reuse original vector area for per-rom workspace?
Breaking Changes 9/7/2023
=========================
## Rom Select Register
To support different hardware where the ROM select register is not at FE30, a
new OS call OSROMSEL has been added at FFFA on entry the B register contains
the ROM to be selected, the previous ROM is returned in B.
## TODO: JGH has moved things around?
The addresses of the non-MOS1.2 routines seem to have moved around in Client09
since the 6809 mos was started, look at harmonizing?
API Changes for 6809
======================================
These are rough notes of API changes made for the Chipkit and Beeb6809 MOS.
This is a work in progress and all information is subject to change.
This is in no particular order!
INTERRUPTS
==========
The 6809 has 3 hardware interrupt levels compared to the 6502's 2. The MOS is set up to use two
of the 6809 interrupt levels IRQ and FIRQ and these roughly map to the 6502's IRQ and NMI usage.
The 6809 NMI is left for debugging only or future hardware expansion.
The 6809 FIRQ is a better fit for the existing functions of the 6502 NMIs (fast data transfers) as
the NMI on the 6809 stacks the whole machine state. Also, it is desirable to have a proper debug
button that halts the machine even in interrupt routines.
On NoICE builds of the MOS the NMI vector is handled by NoICE and used as a debug button. On other
MOS builds the NMI handler executes JMP [NMI9V] (this replaces the old IND3V)
Enabling and reenabling interrupts.
Care should be taken when disabling interrupts. In general in user code the CLI/SEI pseudo
instructions are acceptable (which map as below). However, it should be noted that this will not
disable FIRQs
pseudo 6809 eq. Comments
====== =========== ============
CLI ANDCC #$EF enable IRQs
SEI ORCC #$10 disable IRQs
Where it is imperative the all interrupts be stopped then it is recommended to use a sequence such
as:
PSHS CC ; save FIRQ/IRQ status
ORCC #$50 ; disable FIRQs/IRQs
... do whatever ....
PULS CC ; restore IRQs/FIRQs to previous state
This will restore FIRQs to their original state, however it should be noted that if a transfer
using FIRQs was in processed halting them like this would probably corrupt the transfer.
In general FIRQ status should only be changed by code that has claimed "NMIs" using the OS service
calls.
FIRQs should always be disabled before relinquishing the NMI vector.
In the rest of this document where NMIs are mentioned it these should be taken to mean FIRQs!
SWI, SWI2, SWI3
===============
SWI
---
On NoICE MOS builds the SWI instruction is used with the NoICE debugger as a breakpoint instruction
on non-NoICE MOS builds the SWI instruction executes JMP [SWI9V] vector (replaces the old IND1V)
which by default calls an RTI stub.
SWI2
----
This instruction executes JMP [SW29V] which defaults to an RTI. This may be replaced in application
code. However, this is not recommended as it may be used for OS calls and task switching in a later
version of the MOS.
SWI3
----
This instruction is used to replace the 6502 BRK function and in the MOS will cause the current
error handler to be called. By convention the SWI3 instruction is followed by a single byte
containing and error code and then followed by a zero-terminated error message string.
Mos funnies
-----------
- BAUD rate is set to 9600 by default (ULA default=&52) - this to allow HOSTFS
to boot at 19,200
Unimplmented MOS calls
----------------------
Unimplmented MOS calls in NOICE builds will print a message to the serial port and then execute
a SWI instruction (see below) to enter the debugger, on NOICE builds the message will be printed
with regular VDU, then a CWAI instruction will be executed to halt until an NMI occurs. In most
circumstances the system should be reset, however a button rigged to NMI can be used to continue
execution, so long as the NMI vector contains an RTI or a NoICE MOS ROM is in use.
Note: That this is the _real_ NMI vector not the $D00 vector! (See Interrupt vectors)
API notes
---------
SWIx
====
SWI instruction - this is used by the NOICE debugger (in builds that support it
in other builds it will cause a jump via the IND1V vector at $0230 the default
action is RTI)
SWI2 instruction - this will jump via the IND2V vector at $0232 - the default
action is RTI)
SWI3 instruction - this is used in place of the 6502 BRK instruction - this
needs some working around as it is a multi-byte instruction. However, the
single byte SWI is more useful as a debugging tool.
OSFILE ?JGH? - I'm still not convinced by all this some calls are BE some LE
======
A is same as 6502
X is pointer to block
all addresses have swapped endianness in the control block
Extended vectors
================
These are in the form:
rom addr (hi)
rom addr (lo)
rom #
OSGBPB
======
Entire block is little endian - (implemented in HOSTFS)
OSWORD
======
Enter A = cmd, X=pointer to block
0 - X+0 => string pointer is big-endian
Unknown OSWORDs sent via service call 8, A is at $EF, X at $F0 (big endian)
On entry to mos routines X is at $F0 (zp_mos_OSWORD_Y) and X is set to full 16 bits
VDU 19,L,16,R,G,B => set colour L to R,G,B also set flash
VDU 19,L,17,R,G,B => set colour L's flash to R,G,B
GSINIT/GSREAD => X is a straight pointer to the string rather than offset from ($F2)
SYSVIA latches
--------------
Q7,6 - keyboard shift/caps LEDs
Q5 - keyboard cassette motor LED
Q3 - kbd_EN
Q0 - SND_nWE
Acorn 6809 MOS entry points
---------------------------
OSRDRM $FF9B Get byte from ROM, pointer in X, rom # in Y
PRSTRING $FFC5 Print text at X terminated with $00.
Returns A=$00, X=>byte after terminating $00 so multiple
strings can be called by multiple calls to PRSTRING.
MINE=FF98
OSINIT $FFBF Initialise error handler and other environment settings.
On entry, A=0 to become the current program
A=$FF to just read the current settings
Returns X=>BRKV, Y=>ESCFLG, DP=>Direct Page, D=corrupted.
This must be called by application code as part of its
startup, before writing anything to memory. Before making
this call, code does not known where BRKV and ESCFLG are,
as they can be anywhere in memory.
ERRJMP $FFBC Generate an inline error. Can be used when not possible to
generate an error with SWI. Entered with the address of the
error block on the stack.
CLICOM $FFB9 Enter Supervisor *command prompt.
PRTEXT $FFB3 Print inline text terminated with $00. Execution continues
after the $00 terminator. On return, A=$00 and X corrupted.
USERINT $FFB0 Pass on FIRQs if not Tube FIRQ.
PR2HEX $FFAD Print X as 16-bit hex. On return A/B is corrupted.
PRHEX $FFAA Print A as 8-bit hex. On return A is corrupted.
OSQUIT $FFA7 Quit current process, A=return value. Returns to any
calling process. By default, returns to the Supervisor.
SCANHEX $FFA1 Scan line at X for hex number.
Returns Y=number, X=>terminating character, D corrupted.
; TODO: ASK ?JGH? !
FSCV $021E FS Control.
Entry
A => Action code
X => Pointer / parmas, where params are not a pointer 6502 X is hi, Y is low part of 6809 X
Exit
A => return val
X => returned data
Service calls
On entry B contains rom #, Y corrupted/corruptible, X is parameter
- 1 - X = page # (not address) (TODO: change to address?)
- 2 - X = page # (not address) (TODO: change to address?)
- 3 - X(low) = 0 for exec !BOOT (hi always 0)
- 4 - X = command pointer
- 9 - 16 bit X points to command tail
-0C - X(low) = FS # (hi always 0)
-25 - X = pointer to buffer for FS info
zp_mos_OSBW_Y&X swapped for endiannedss
OSBYTE
0 - returns version #17 and string = "OS 1.29"
FSCV vector string/pointer in X
USERV vector string/pointer in X
@-same as JGH "technical.txt" as of 27/5/2017
OSWRCH
- preserves B,W,U
OSWORD
X = block pointer instead of X,Y - @
OSCLI, pointer in X
System Memory Map for the BBC B, B+, Electron, Master 128, ET and Compact
=========================================================================
Compiled by Jon Ripley
Updated by J.G.Harston
Update: 18-Jun-2016
A complete list of BBC computer operating system memory use. Some memory
locations have different uses on different machines and these these
differences are described. Unless otherwise stated, 'BBC' includes BBC
A,B,B+ and 'Master' includes Master 128, Master ET and Master Compact.
Page &00 (0) - Zero Page Workspace
==================================
&0000-&008F Language workspace
&0090-&009F Econet private workspace
&00A0-&00A7 Current NMI owner's workspace
&00A8-&00AF Transient command space
&00B0-&00BF Filing system scratch space
&00C0-&00CF Filing system workspace
&00D0-&00E1 VDU workspace
&00E2-&00E3 CFS/RFS private workspace
&00E4-&00FF General MOS workspace
Econet Workspace at &0090 to &009F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0090-6 = appears to be unused Master:
&0097 = b7=respond to Escape &0097
&0098 = b7=need to release Tube &0098 = b7=respond to Escape
&0099 = &0099 = b7=need to release Tube
&009A/B => Current NetTx control block
&009C/D => NetRx control blocks
&009E/F => General NFS workspace
NMI Workspace at &00A0-&00A7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&00A0 Conventionally used to store previous NMI owner ID
Filing System Workspace at &00B0-&00CF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When CFS/RFS is the current filing system it uses the workspace as follows
--------------------------------------------------------------------------
&00B0-&B3 load address or start address
&00B4-&B7 exec address or end address or current block number
&00B6-&B7 or next block number
&00B8-&B9 => error to print or execute
&00BA current block flag
&00BB current options, set from half of &E3
&00BC offset into current block or CRC being loaded
&00BD b7=last byte from block
&00BE-&BF CRC workspace
&00C0 Buffer flag
&00C1 Checksum result
&00C2 Progress flag
&00=done/idle, &01=looking for header, &02=
&03=fetching header block, &04=fetching data block
&05=fetching CRC
&00C3 Current file handle during *MOTOR call
&00C4 temp
&00C6 Baud rate to write to serial port, 5=300, 6=1200
&00C7 Interblock flag, 6 for save, *OPT3 for bput
&00C8/&C9 => OSFILE control block
&00CA OR'd with &C6 to write to serial control register
&00CB CRC bit counter
&00CC-&CD file size
&00CE-&CF unused (high word of file size)
VDU Workspace at &00D0 to &00E1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&00D0 VDU Status as read by OSBYTE &75
Bit 0 - Printer output status
1 - Scrolling disabled
2 - Paged mode selected
3 - Software scroll
4 - Shadow screen mode - Master series only
5 - VDU 5 enabled
6 - Cursor split status
7 - VDU disable status
&00D1 Graphics pixel mask
&00D2 Text colour OR mask
&00D3 Text colour EOR mask
&00D4 Graphics colour OR mask
&00D5 Graphics colour EOR mask
&00D6-&00D7 Graphics character cell
&00D8-&00D9 Top scan line
&00DA-&00DF Temporary workspace
&00E0-&00E1 BBC, Electron: Row multiplication
Master: General Workspace
CFS/RFS Workspace at &00E2-&E3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&00E2 Cassette/RFS filing system status
Bit 0 - Input file open
1 - Output file open
2 - BBC/Electron: Unused, Master: 0=TAPE300, 1=TAPE1200
3 - Set if cataloging
4 - Unused
5 - Unused
6 - At end of file
7 - End of file warning given
&00E3 CFS/RFS filing system options
Bit 0-3 Options used for BGET/BPUT
Bit 4-7 Options used for LOAD/SAVE
General MOS workspace at &00E4-&00FF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&00E4 GSREAD quote flag
&00E5 GSREAD character accumulator
&00E6 General OS workspace
&00E7 Auto repeat countdown timer
&00E8-&00E9 Input buffer pointer for OSWORD 0
&00EA RS423 timeout counter, unused if no RS423
&00EB CFS/RFS 'critical' flag, b7=1 if CFS/RFS being used for BGET/BPUT
&00EC Internal key number (last)
&00ED Internal key number (first)
&00EE Internal key number of character to be ignored by OSBYTE &79,
also the 1MHz bus paging register RAM copy
&00EF OSBYTE/OSWORD A reg value
&00F0 OSBYTE/OSWORD X reg value
&00F1 OSBYTE/OSWORD Y reg value
&00F2-&00F3 OS Text pointer (eg star commands and filenames)
&00F4 Currently selected ROM
&00F5 Current PHROM or RFS ROM number
&00F6-&00F7 PHROM/RFSROM/OSRDSC pointer
&00F8-&00F9 BBC, Electron: Unused
Master: Soft key expansion pointer
&00FA-&00FB General OS workspace, used by buffer access code in interrupts
&00FC Interrupt Temp A reg store
&00FD-&00FE Error message pointer, initially set to language version string
&00FF Escape flag (bit 7)
Page &01 (1) - Hardware Stack
=============================
&0100-&01FF 6502 Hardware Stack
&0100- Error message buffer, used by most sideways ROMs to store
error messages
&0128- Used by the Tube host code to store OSWORD parameter blocks
Page &02 (2) - General MOS workspace
====================================
&0200-&0235 Vectors
&0236-&028F OSBYTE variables
&0290-&02ED MOS variables
&02E2-&02FF MOS OSFILE control block for *LOAD, *SAVE, *CREATE, *DELETE
MOS Vectors at &0200 to &0235
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0200/1 USERV - User vector, called by *LINE, *CODE, OSWORD >=&E0
&0202/3 BRKV - The BRK vector ; 6809 SWI3 vector (used as BRK)
&0204/5 IRQ1V - Main interrupt vector ; 6809 IRQ
&0206/7 IRQ2V - Secondary interrupt vector
&0208/9 CLIV - Command Line Interpreter vector
&020A/B BYTEV - OSBYTE (*FX) calls
&020C/D WORDV - OSWORD calls
&020E/F WRCHV - Send character to current output stream
&0210/1 RDCHV - Wait for a character from current input stream
&0212/3 FILEV - Operate on a whole file, eg loading/saving/delete/etc
&0214/5 ARGSV - Read/Write arguments on an open file
&0216/7 BGETV - Read a byte from an open file
&0218/9 BPUTV - Write a byte to an open file
&021A/B GBPBV - Read/Write block of data from/to open file or device
&021C/D FINDV - Open or close a file
&021E/F FSCV - Various filing system control calls
&0220/1 EVNTV - Event handler
&0222/3 UPTV - User Print vector
&0224/5 NETV - Network Print vector
&0226/7 VDUV - Unrecognised VDU commands
&0228/9 KEYV - Read the keyboard
&022A/B INSV - Insert characters into a buffer
&022C/D REMV - Remove characters from a buffer
&022E/F CNPV - Count or Purge a buffer
&0230/1 IND1V - Spare
&0232/3 IND2V - Spare
&0234/5 IND3V - Spare
Main MOS (OSBYTE) variables at &0236-&028F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0236/7 fx166/7 &A6/7 Address of OS variables
&0238/9 fx168/9 &A8/9 Address of extended vector table
&023A/B fx170/1 &AA/B Address of ROM info table
&023C/D fx172/3 &AC/D Address of key translation table
&023E/F fx174/5 &AE/F Address of VDU variables
&0240 fx176 &B0 CFS timeout counter, decremented every frame flyback
&0241 fx177 &B1 Currently selected input stream set with FX2
&0242 fx178 &B2 BBC, Master: Keyboard semaphore
Electron: undefined
&0243 fx179 &B3 Primary OSHWM
&0244 fx180 &B4 Current OSHWM
&0245 fx181 &B5 RS423 mode
&0246 fx182 &B6 BBC, Electron: Character definition explosion status
Master: Printer ignore character status
&0247 fx183 &B7 CFS/RFS switch
&0248 fx184 &B8 BBC, Master: RAM copy of VIDPROC control register
Election: undefined
&0249 fx185 &B9 BBC, Master: RAM copy of VIDPROC palette register
Electron: ROM polling semaphore
&024A fx186 &BA ROM active last BRK
&024B fx187 &BB BASIC ROM number
&024C fx188 &BC Current ADC Channel
&024D fx189 &BD Maximum ADC Channel number
&024E fx190 &BE ADC conversion type/accuracy
&024F fx191 &BF RS423 use flag
&0250 fx192 &C0 RAM copy of RS423 control register
&0251 fx193 &C1 Flashing colour countdown timer
&0252 fx194 &C2 Flashing colour space period count set by FX9
&0253 fx195 &C3 Flashing colour mark period count set by FX10
&0254 fx196 &C4 Keyboard auto-repeat delay set by FX11
&0255 fx197 &C5 Keyboard auto-repeat period set by FX12
&0256 fx198 &C6 *EXEC file handle
&0257 fx199 &C7 *SPOOL file handle
&0258 fx200 &C8 ESCAPE, BREAK effect
&0259 fx201 &C9 Keyboard disable
&025A fx202 &CA Keyboard status byte
&025B fx203 &CB BBC, Master: Serial input buffer extent
Election: ULA interupt mask
&025C fx204 &CC BBC, Master: Serial input supression flag
Electron: Firm key pointer
&025D fx205 &CD BBC, Master: Serial/cassette selection flag
Electron: Firm key string length
&025E fx206 &CE Econet OSBYTE/OSWORD intercept flag
&025F fx207 &CF Econet OSRDCH intercept flag
&0260 fx208 &D0 Econet OSWRCH intercept flag
&0261 fx209 &D1 Speech suppression status
&0262 fx210 &D2 Sound suppression status
&0263 fx211 &D3 BELL channel number
&0264 fx212 &D4 BELL envelope number/amplitude
&0265 fx213 &D5 BELL frequency
&0266 fx214 &D6 BELL duration
&0267 fx215 &D7 Startup display and BOOT error options
&0268 fx216 &D8 Soft key string length
&0269 fx217 &D9 Screen lines since last page
&026A fx218 &DA 256-number of items in VDU queue
&026B fx219 &DB BBC, Master: TAB key character
Electron: external sound flag
&026C fx220 &DC ESCAPE character
&026D fx221 &DD Char &C0-&CF buffer insert interpretation
&026E fx222 &DE Char &D0-&DF buffer insert interpretation
&026F fx223 &DF Char &E0-&EF buffer insert interpretation
&0270 fx224 &E0 Char &F0-&FF buffer insert interpretation
&0271 fx225 &E1 Char &80-&8F buffer insert interpretation (FKey)
&0272 fx226 &E2 Char &90-&9F buffer insert interpretation (Sh+FKey)
&0273 fx227 &E3 Char &A0-&AF buffer insert interpretation (Ct+FKey)
&0274 fx228 &E4 Char &B0-&BF buffer insert interpretation (Ct+Sh+FKey)
&0275 fx229 &E5 ESCAPE key action
&0276 fx230 &E6 ESCAPE effects
&0277 fx231 &E7 BBC, Master: User 6522 VIA IRQ mask
Electron: Reserved for 6522 expansion IRQ mask
&0278 fx232 &E8 BBC, Master: 6850 ACIA IRQ bit mask
Electron: Sound semaphore
&0279 fx233 &E9 BBC, Master: System 6522 VIA IRQ mask
Electron: Soft key pointer
&027A fx234 &EA Tube presence flag
&027B fx235 &EB Speech processor presence flag
&027C fx236 &EC Output stream character destination, set with FX3
&027D fx237 &ED Cursor key status, set with FX4
&027E fx238 &EE BBC, Electron: unused
Master: Base value for numeric keypad
&027F fx239 &EF Shadow RAM flag
The value 0 indicates no shadow screen or shadow screen not selected
1 indicates Electron Master RAM Turbo mode
128 indicates Electron Master RAM 64K mode
&0280 fx240 &F0 Country code
&0281 fx241 &F1 User flag location, set with FX1
&0282 fx242 &F2 BBC, Master: RAM copy of SERPROC control register
Electron: RAM copy of ULA miscellaneous register
&0283 fx243 &F3 Timer switch state
&0284 fx244 &F4 Soft key consistancy flag
&0285 fx245 &F5 Printer destination, set with FX5
&0286 fx246 &F6 Printer ignore character, set with FX6
&0287 fx247 &F7 Break Intercept Vector JMP
&0288 fx248 &F8 Break Intercept Vector address low byte
&0289 fx249 &F9 Break Intercept Vector address high byte
&028A fx250 &FA BBC, Electron: unused, unless shadow screen present
BBC/Elk+shadow screen, Master: Memory used by VDU
drivers, set with FX112
&028B fx251 &FB BBC, Electron: unused, unless shadow screen present
BBC/Elk+shadow screen, Master: Memory displayed by VDU
hardware, set with FX113
&028C fx252 &FC Current language ROM
&028D fx253 &FD Last BREAK type
&028E fx254 &FE Available RAM BBC: &40 or &80, Electron: &00
Master: Numeric keypad SHIFT key effect
&028F fx255 &FF Startup options
Misc OS workspace at &0290-&02FF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BBC/Master: Electron:
&0290 VDU vertical adjust, *TV first parameter &0290 unused
&0291 Interlace toggle flag, *TV second parameter
&0292-&0296 TIME value 1, high byte...low byte &0291-&0295 TIME value 1
&0297-&029B TIME value 2, high byte...low byte &0296-&029A TIME value 2
&029C-&02A0 OSWORD 3/4 Countdown interval timer value &029B-&029F OSWORD 3/4 timer
&02A1-&02B0 Paged ROM type table &02A0-&02AF Paged ROM type table
&02B1-&02B2 INKEY countdown timer &02B0-&02B1 INKEY countdown timer
&02B3 OSWORD 0 maximum line length &02B2 OSWORD 0 max length
&02B4 OSWORD 0 minimum character &02B3 OSWORD 0 min char
&02B5 OSWORD 0 maximum character &02B4 OSWORD 0 max char
Analogue Conversion workspace at &02B6-&02BE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&02B6 Channel 1 ADC value low
&02B7 Channel 2 ADC value low
&02B8 Channel 3 ADC value low
&02B9 Channel 4 ADC value low
&02BA Channel 1 ADC value high
&02BB Channel 2 ADC value high
&02BC Channel 3 ADC value high
&02BD Channel 4 ADC value high
&02BE Last ADC channel converted
Various MOS variables at &02BF-&02CE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&02BF-&02C8 MOS Event enable flags &02B5-&02BE MOS Event enable flags
&02C9 Soft key expansion pointer &02BF First autorepeat count
&02C0 Keyboard
&02C1 Keyboard
&02C2 Keyboard
&02C3 Buffer busy flags
&02CC Buffer start indexes
&02D5 Buffer end indexes
BBC: Master:
&02CA First auto repeat count &02C9 First auto repeat count
&02CB-&02CD Two key rollover workspace &02CA-&02CD Two key rollover workspace
&02CE Sound semaphore &02CD Sound semaphore
MOS Buffer Handler variables at &02CF-&02E9
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BBC: Master:
&02CF-&02D7 Buffer busy flags &02CE-&02D6 Buffer busy flags
&02D8-&02E0 Buffer start indexes &02D7-&02DF Buffer start indexes
&02E1-&02E9 Buffer end indexes &02E0-&02E8 Buffer end indexes
CFS/RFS Opened input file info at &02EA-&02ED Electron:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &02DE-F Block size
&02E0 Block flag
&02E1 Last input character
&02E2-&02F3 OSFILE control block
&02F4 ULA
&02F5 unused
&02F6 unused
BBC: Master:
&02EA-&02EB Block size &02E9-&02EA Block size
&02EC Block flag &02EB Block flag
&02ED Last input character &02EC Last input character
&02FF unused
MOS OSFILE control block for *LOAD, *SAVE, *CREATE and *DELETE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&02EE-FF OSFILE control block, BBC
&02E2-F3 OSFILE control block, Electron
&02ED-FE OSFILE control block, Master
Electron Analogue Conversion workspace at &02B6-&02BE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&02F7 Last channel converted
&02F8 Electron ADC channel 1 low
&02F9 Electron ADC channel 2 low
&02FA Electron ADC channel 3 low
&02FB Electron ADC channel 4 low
&02FC Electron ADC channel 1 high
&02FD Electron ADC channel 2 high
&02FE Electron ADC channel 3 high
&02FF Electron ADC channel 4 high
Page &03 (3) - VDU, CFS, Keyboard buffer
========================================
&0300-&037F VDU variables
&0380-&03DF CFS/RFS workspace
&03E0-&03FF Keyboard buffer
VDU Variables at &0300-&037F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0300/1 Current graphics window left column in pixels
&0302/3 Current graphics window bottom row in pixels
&0304/5 Current graphics window right column in pixels
&0306/7 Current graphics window top row in pixels
&0308 Current text window left hand column
&0309 Current text window bottom row
&030A Current text window right hand column
&030B Current text window top column
&030C-F Current graphics origin in external coordinates
&0310-3 Current graphics cursor in external coordinates
&0314-7 Old graphics cursor in internal coordinates (DB: was incorrectly? marked as external coords)
&0318 Current text cursor X
&0319 Current text cursor Y
&031A Line withing current graphics cell of graphics cursor
&031B Graphics workspace/VDU queue
&031F-&0323 VDU queue
&0324-&0327 Current graphics cursor in internal coordinates
&0328-&032F Bitmap read from screen by OSBYTE 135
&0330-&0349 Graphics workspace
&034A-&034B Text cursor address for 6845
&034C-&034D Text window width in bytes
&034E High byte of bottom of screen memory
&034F Bytes per character for current mode
&0350-&0351 Screen display start address for 6845
&0352-&0353 Bytes per screen row
&0354 Screen memory size high byte
&0355 Current screen mode
&0356 Memory map type
0 - 20K mode
1 - 16K mode
2 - 10K mode
3 - 8K mode
4 - 1K mode
&0357 Foreground text colour
&0358 Background text colour
&0359 Foreground graphics colour
&035A Background graphics colour
&035B Foreground plot mode
&035C Background plot mode
&035D-&035E General VDU jump vector
&035F Cursor start register previous setting
&0360 Number logical colours -1
&0361 Pixels per byte -1 (zero if text only mode)
&0362 Leftmost pixel colour mask
&0363 Rightmost pixel colour mask
&0364 Text input cursor X
&0365 Text input cursor Y
BBC, Electron: Master:
&0366 Teletext output cursor character VDU 23,16 setting
&0367 Font explosion flags, b1=224-255 VDU 23,6 dot pattern
in RAM, b7=32-63 in RAM
&0368 Font location, characters 32-63 Current dot pattern state
&0369 Font location, characters 64-95 Colour plotting ECF pattern
number or zero
&036A Font location, characters 96-127 Graphics foreground ECF
pattern number or zero
&036B Font location, characters 128-159 Graphics background ECF
pattern number or zero
&036C Font location, characters 160-191 b7 set when cursor off
righthand edge of screen
&036D Font location, characters 192-223 Graphics foreground colour
&036E Font location, characters 224-225 Graphics background colour
&036F-&037E Palette for colours 0 to 15
&037F Unused - used by some Shadow RAM systems
CFS/RFS workspace at &0380-&03DF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0380-&039C BPUT file header:
&0380-&038B Filename
&038C-&038F Load address
&0390-&0393 Exec address
&0394-&0395 Block number
&0396-&0397 Block length
&0398 Block flag
&0399-&039C RFS address field
&039D BPUT buffer offset
&039E BGET buffer offset
&039F-&03A3 Unused
&03A4 BBC: GXR flag byte
&03A5-&03A6 Unused
&03A7-&03B1 BGET filename
&03B2-&03D0 Most recent block header read:
&03B2-&03BD Filename
&03BE-&02C1 Load address
&03C2-&03C5 Exec address
&03C6-&03C7 Block number
&03C8-&03C9 Block length
&03CA Block flag
&03CB-&03CE RFS address field
&03CF-&03D0 Checksum
&03D1 Sequential block gap, set by *OPT 3. Set to &19 on Reset
&03D2-&03DC Filename being searched
&03DD-&03DE Next BGET block number
&03DF Copy of last block flags read
NullKBD, SoftRTC workspace at &03D0-&03DF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&03D0-&03D9 NullKBD intercept if no keyboard present
&03DA-&03DC TIME backup over Break
&03DD b0-b5=BCD day of month, b6-b7=set if date valid
&03DE b0-b4=BCD month, b5-b7=day of week
&03DF BCD year, if >&7F year is 19xx, else year is 20xx
Keyboard input buffer at &03E0-&03FF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Page &04 (4) to &07 (7) - Current Language Workspace
====================================================
This memory is allocated to the current language.
Page &08 (8) - SOUND, Printer, Envelope buffers
===============================================
&0800-&083F Sound workspace
&0840-&087F Sound buffers
&0880-&08BF Printer buffer
&08C0-&08FF Envelope buffers
Sound workspace at &0800-&083F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0800-&0803 Unused
&0804-&0807 Sound queue occupancy flag
&0808-&080B Current amplitude
&080C-&080F Number of amplitude phases processed
&0810-&0813 Absolute pitch value
&0814-&0817 Number of pitch phases processed
&0818-&081B Number of steps to process
&081C-&081F Duration
&0820-&0823 Interval multiplier
&0824-&0827 Envelope number/auto repeat parameter
&0828-&082B Length of remaining note interval
&082C-&082F Sunc hold parameter
&0830-&0833 Sound chip current pitch setting
&0834-&0837 Pitch deviation
&0838 Number of channels required for sync
&0839 Current amplitide step
&083A Current target amplitude
&083B Number of channels on hold for sync
&083C-&083F Sound parameter calculation workspace
&083D Low order frequency parameter as sent to the sound generator
&083E High order frequency parameter as sent to the sound generator
&083F
Sound buffers at &0840-&087F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0840-&084F Sound channel 0 buffer
&0850-&085F Sound channel 1 buffer
&0860-&086F Sound channel 2 buffer
&0870-&087F Sound channel 3 buffer
Printer buffer at &0880-&08BF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Envelope buffer at &08C0-&08FF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&08C0-&08FF ENVELOPES 1 to 4
&08C0-&08CC Definition of ENVELOPE 1
&08CD-&08CF Spare
&08D0-&08DC Definition of ENVELOPE 2
&08DD-&08DF Spare
&08E0-&08EC Definition of ENVELOPE 3
&08ED-&08EF Spare
&08F0-&08FC Definition of ENVELOPE 4
&08FD-&08FF Spare
Page &09 (9) - Envelope, Serial output, Speech, transient command buffer
========================================================================
&0900-&09BF RS423 output buffer
&09C0-&09FF Speech buffer
&0900-&09FF CFS/RFS BPUT sequential output buffer (nb, *not* used by SAVE)
&0900-&09BF ENVELOPES 5 to 16
&0900-&090C Definition of ENVELOPE 5
&090D-&090F Spare
&0910-&091C Definition of ENVELOPE 6
&091D-&091F Spare
&0920-&092C Definition of ENVELOPE 7
&092D-&092F Spare
&0930-&093C Definition of ENVELOPE 8
&093D-&093F Spare
&0940-&094C Definition of ENVELOPE 9
&094D-&094F Spare
&0950-&095C Definition of ENVELOPE 10
&095D-&095F Spare
&0960-&096C Definition of ENVELOPE 11
&096D-&096F Spare
&0970-&097C Definition of ENVELOPE 12
&097D-&097F Spare
&0980-&098C Definition of ENVELOPE 13
&098D-&098F Spare
&0990-&099C Definition of ENVELOPE 14
&099D-&099F Spare
&09A0-&09AC Definition of ENVELOPE 15
&09AD-&09AF Spare
&09B0-&09BC Definition of ENVELOPE 16
&09BD-&09BF Spare
Page &0A (10) - Serial input, transient command buffer
======================================================
&0A00-&0AFF Cassette/RS423 input buffer (nb: *not* used by LOAD)
Page &0B (11) - Soft key, Econet workspace
==========================================
BBC, Electron: Soft key definitions at &0B00-&0BFF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0B00-&0B10 Soft key pointers
&0B11-&0BFF Soft key definitions
Master: Econet workspace at &0B00-&0BFF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0B01 Station number
&0B02 File server station number
&0B03 File server network number
&0B18 Print server type string
Page &0C (12) - Character definitions, Econet workspace
=======================================================
&0C00-&0CFF BBC, Electron: Font for ASCII 128-159
&0C00-&0CFF Master: Econet workspace
Page &0D (13) - NMI and ROM workspace
=====================================
&0D00-&0D5F NMI handler code and workspace
&0D60-&0D67 Econet workspace
&0D68-&0D7F Econet workspace/Electron expansion workspace
&0D80-&0D91 Econet over other hardware workspace
&0D92-&0D9E Mouse/trackerball workspace
&0D9F-&0DEF Extended vector table
&0DF0-&0DFF Sideways ROMs private workspace address high bytes
NMI handler code and workspace at &0D00-&0D5F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To use the NMI workspace you MUST claim it with service call 12 by calling
OSBYTE 143,12,255 and then save the old NMI owner's ID returned in Y. The
usual place to store the old ID is at &00A0 in the NMI owner's zero page
workspace. If you are just using the workspace and not using hardware NMIs
you MUST put a RTI instruction at &0D00 to return any spurious NMIs.
If you receive service call 12 when you own the NMI workspace you MUST
relinquish it and stop using it. There is no mechanism to refuse to
relinquish the NMI workspace.
Econet uses &0D20-&0D5F for:
----------------------------
&0D20-&0D26 Scout/Acknowledge packet
&0D20 Destination Station
&0D21 Destination Network
&0D22 Source Station (ie, this station)
&0D23 Source Network
&0D24 Control Byte
&0D25 Port
&0D3D-&0D44 Received scout
&0D3D Station
&0D3E Network
&0D3F Control Byte
&0D40 Port
&0D41-4 Remote Address
&0D41-8 Broadcast data
&0D49
&0D4A &40 if receiving a broadcast
&0D51 Saved System VIA setting
&0D52
&0D58-&0D5B Saved RemoteAddress during RemoteCall
&0D5C
&0D5D
&0D5E
&0D5F
Econet workspace at &0D60-&0D68
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D60
&0D61
&0D62 b7=Transmission in progress
&0D63 Protection mask
&0D64 b7=Rx at &00C0, b2=Halted
&0D65 Saved protection mask
&0D66 b7=Econet using NMI code
&0D67 b7=Tube present
Master Econet workspace at &0D68-&0D7F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D68
&0D69
&0D6A
&0D6B
&0D6C Event &FE flags
&0D6D
&0D6E
&0D6F
&0D70
&0D71 Machine Type
&0D72
Electron Expansion workspace &0D68-&0D6B
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D68 Port active flags
&0D69 Serial port control register, RAM copy
&0D6A Serial port interupt mask
&0D6B ROMSTROBE at &FC73, RAM copy
Electron ROM manager workspace &0D6C-&0D7F
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D6C-&0D6F ROM manager workspace
&0D70-&0D7F ROM manager workspace
Spare at &0D80-&0D91
~~~~~~~~~~~~~~~~~~~~
&0D80-&0D91 Econet over other hardware workspace
Mouse/trackerball workspace at &0D92-&0D9E
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D92-&0D93
&0D94-&0D95
&0D96-&0D97
&0D98
&0D99-&0D9A Old IRQ1V
&0D9B-&0D9C Old BYTEV
&0D9D-&0D9E Old WORDV
Most mouse/trackerball software stores the state in XIRQ1V and XIRQ2V:
&0DA5 Mouse/trackerball status
&0DA6-&0DA7 Mouse/trackerball X position
&0DA8-&0DA9 Mouse/trackerball Y position
&0DAA Mouse/trackerball speed
Extended vector table at &0D9F-&0DEF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&0D9F-&0DA1 XUSERV address, ROM number
&0DA2-&0DA4 XBRKV address, ROM number
&0DA5-&0DA7 XIRQ1V address, ROM number, also mouse/trackerball state
&0DA8-&0DAA XIRQ2V address, ROM number, also mouse/trackerball state
&0DAB-&0DAD XCLIV address, ROM number
&0DAE-&0DB0 XBYTEV address, ROM number
&0DB1-&0DB3 XWORDV address, ROM number
&0DB4-&0DB6 XWRCHV address, ROM number
&0DB7-&0DB9 XRDCHV address, ROM number
&0DBA-&0DBC XFILEV address, ROM number
&0DBD-&0DBF XARGSV address, ROM number
&0DC0-&0DC2 XBGETV address, ROM number
&0DC3-&0DC5 XBPUTV address, ROM number
&0DC6-&0DC8 XGBPBV address, ROM number
&0DC9-&0DCB XFINDV address, ROM number
&0DCC-&0DCE XFSCV address, ROM number
&0DCF-&0DD1 XEVNTV address, ROM number
&0DD2-&0DD4 XUPTV address, ROM number
&0DD5-&0DD7 XNETV address, ROM number
&0DD8-&0DDA XVDUV address, ROM number
&0DDB-&0DDD XKEYV address, ROM number
&0DDE-&0DE0 XINSV address, ROM number
&0DE1-&0DE3 XREMV address, ROM number
&0DE4-&0DE6 XCNPV address, ROM number
&0DE7-&0DE9 XIND1V address, ROM number
&0DEA-&0DEC XIND2V address, ROM number
&0DED-&0DEF XIND3V address, ROM number
&0DF0-&0DFF Sideways ROMs private workspace address high bytes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ROM x has a single workspace byte at location &DF0+x. It is conventional
to use this as the high byte of the address of that ROM's private
workspace, with b7 being used to disable the ROM if set. If b7 is set,
implying workspace at &8000-&FFFF (ie, in ROM), then the ROM is
disabled. As the low workspace always starts at &0E00 some ROMs use the