This is an old revision of the document!


Bally On-Board ROM Subroutines

SR# Location? Arguments Name Function
00 007B none INTPC Initiates multiple subroutine calls.
02 0279 none XINTC/EXIT Performs an ending function for multiple subroutine calls.
04 0634 L,H RCALL Jumps immediately to location specified by HL.
06 007D L,H MCALL “CALL” for subroutines. Nests a multiple subroutine call. HL specifies data location.
08 0B79 none MRET “RET” for subroutines. Performs a POP AF and POP HL. (Aborts a nest.)
10 0ACA L,H MJUMP “JP” for subroutines. A logical nested subroutine jump. Execution of subroutines starts over at location HL.
12 00A4 B SUCK Performs a SACRED register load according to B.
14 018B none ACTINT Interrupt Service Routine. Executes SR16 on 4FD5–4FD8 and SR0200 every interrupt.
16 0480 C DECCTS Checks locations 4FD5–4FDC according to bits of C (Bit 0 = 4FD5).
18 050A IXl,IXh,A,L,H BMUSIC Sound Generator. Enter with IX pointing to a work area, HL pointing to parameter string. Sound parameters are in sets.
20 05FE non EMUSIC Stops all sound output. Sets (4FEA) and (4FF9) to 00. Outputs 00 to port 18, 8 times.
22 03CF D,B,A SETOUT Outputs D to port 0A, B to port 09, A to port 0E.
24 01DB L,H Output color specifications.
26 0AF4 E,D,C,B,A Stores A in BC bytes starting at location DE.
28 06B4 E,D,C,B,A Display Solid Color in 4000 area.
30 0704 IXl,IXh,L,H Load A with (IX+00), D with (IX+0B), E with (IX+06), set bit 6 in (IX+01) and execute SR32, 34, 36, and 38.
32 0711 E,D,A,L,H Enter with HL pointing to first of four bytes of data. Increment E (horizontal dot number) by (HL) and increment D (vertical dot number) by (HL+1). Execute SR34, 36, and 38 with HL incremented by 2.
34 071B E,D,A,L,H Pick up C (# bytes/horizontal line) from (HL) and B (number of horizontal lines) from (HL+1). Execute SR36 and 38 with HL incremented by 2.
36 071F E,D,C,B,A,L,H Calculate CRT index from V/H dot number in DE by executing SR56. Index (0000 area) returned in DE. Execute SR38.
38 0722 E,D,C,B,A,L,H Move CRT data. Moves C bytes of data from location HL to location DE.
40 0783 IXl,IXh,E,D
42 07A4 E,D,B,L,H Display solid color.
44 03B9 E,D,C,B,L,H Move CRT Data. Moves C bytes of data from HL to DE+2.
46 07B3 E,D,L,H Move data to CRT.
48 026A E,D,C,B,L,H Block moves. Moves C bytes from (HL+DE) to (HL). Increments HL by DE and repeats B times.
50 07E7 E,D,C,A Character display subroutine. See routine 52.
52 07CA E,D,C,L,H String display routine.
54 0BF1 E,D,C,L,H Display BCD numbers at location HL.
56 0AFC A Same as SR58 except DE is not forced to 4000 area and resultant A is output to port 0C.
58 0B01 A Calculate display buffer address.
60 0658 IXl,IXh,C,L,H
62 0635 IXl,IXh,L,H
64 0ACF none Gets ASCII calculator key code to A. (Table at 0ADB). Expects raw key number in B on entry.
66 01AC E,D Gets player inputs.
68 060E L,H Jump Table. Used for input devices. Expects device number in A on entry. HL points to table. Entries are in 3's; last entry denoted by word 0 >= C0.
70 060D L,H Same routine as SR68, but uses B (normally device input value)
72 01BA none Blank TV screen. Wait for any switch input and re-enable TV screen.
74 0C9C E,D,L,H MENU Menu display routine. DE = address of message for top of screen (e.g. SELECT GAME). HL points to first linked list of menu specifications.
76 0D00 C,B,A,L,H Option selection routine. DE = address of OPTION (usually name of game) to be displayed at top of screen. Routine displays ENTER followed by message pointed to by BC, then calls SR78 for input of number of digits specified by A. Digits are stored at HL.
78 0D36 E,D,C,B,L,H Get OPTION/MENU selection user inputs.
80 001B B Waits for B interrupts then returns.
82 0BD2 E,D,C Display time at 4FEE and 4FED in 3×5 characters.
84 OC1B L,H UP-TIMER. Increments a user's 6-digit BCD number pointed to by HL.
86 0B7C L,H Gets BCD digit C from string starting at location HL and places it in A. Digit 0 is LSD of location HL.
88 0B96 L,H Replace BCD digit C in number starting at location HL with contents of 4 LSB of A. LSD of location HL is LSD of number and is accessed with C = 0.
90 0BB2 L,H Jump table index. Gets contents of HL+A*2 to DE. Saves DE and HL in SACRED DE and HL.
92 0BC3 L,H Data table index. Increments HL by A. Gets (HL) to SACRED A and HL to SACRED HL.
94 0B51 E,D,C,B,L,H Performs an LDIR.
96 0DAE B,L,H Insert BCD digit in A at LSD of location HL. Ripple left B locations. (If B is odd, it is forced to next higher even number, 62D max.)
98 0321 E,D,B,L,H ADD. DE = address of addend, HL = address of Augend, B = number of locations to add. Sum is left at (DE).
100 031F E,D,B,L,H SUBTRACT. DE = address of minuend, HL = address of subtrahend, B = number of locations to subtract. Difference is left at (DE).
102 02DE E,D,B,L,H MULTIPLY DE = address of multiplicand, HL = address of multiplier, B = number of locations to multiply. Product is left at (DE).
104 0284 E,D,B,L,H DIVIDE De = address of divisor, HL = address of dividend, B = number of locations in number. Quotient left at [DE??].
106 0364 B,L,H Toggles bit 7 of location (HL+B-1).
108 0341 E,D,B Perform 10s complement on BCD string if string is negative.
110 036E E,D,B,L,H Performs a BCD addition of B locations adding HL locations to DE locations. Returns with SACRED F carry set if last digit was 99. Sum is left at location (DE).
112 0329 E,D,B Checks location (DE+B-1). If less than 50H, returns. If greater than or equal to 50H, performs 10s complement of B location's long number starting at DE. Leaves bit 7 = 1 in location (DE+B-1).
114 0356 E,D,B Checks bit 7 of location (DE+B-1); if clear, returns. If set, loads location (DE+B-1) with 00 and increments SACRED C.
116 034C B,L,H Performs a 10s complement conversion of B bytes of BCD data starting at location HL.
118 037F A RANGED Random number generator.
120 0C46 none GAME OVER.
122 036C A,L,H Performs a LD (HL),A.
124 0023 E,D,L,H Executes a LD (HL),DE
126 0240 E,D,C,L,H Joystick manipulation.
0200 Timer subroutine. Executed every interrupt by SR14 (ACTINT). If user has interrupts and does not call SR14 (ACTINT) during interrupts, they should call 0200 during their interrupt service routine.
0203 Decrements location specified by HL.