Last changed: 2003-07-22
bank0: 0387h
Switches banks to bank 0, continues at 0408h in new bank.
bank01: 0383h
Switches banks from bank 2 to bank 0, bank 3 to bank 1, continues at
0408h in new bank.
bank02: 037Fh
Switches banks from bank 1 to bank 0, bank 3 to bank 2, continues at
0408h in new bank.
bank3: 038Bh
Switches banks to bank 3, continues at 0408h in new bank.
bitclear: 0280h (G7000 only)
Clears a bit in a VDC or external RAM bit field.
This routine is not available on the Videopac+ G7400.
| Input | A=bit number |
| | R1=pointer to end of bit field |
| Output | A=old bit |
| | R1=pointer to byte containing bit |
| | R2=bit mask |
| Alters | None |
| First used | Chapter about bit fields |
bitset: 028Ah (G7000 only)
Sets a bit in a VDC or external RAM bit field.
This routine is not available on the Videopac+ G7400.
| Input | A=bit number |
| | R1=pointer to end of bit field |
| Output | A=old bit |
| | R1=pointer to byte containing bit |
| | R2=bit mask |
| Alters | None |
| First used | Chapter about bit fields |
bittest: 026Ah (G7000 only)
Tests, if a bit is set in VDC or external RAM bit field.
This routine is not available on the Videopac+ G7400.
| Input | A=bit number |
| | R1=pointer to end of bit field |
| Output | A=bit |
| | R1=pointer to byte containing bit |
| | R2=bit mask |
| Alters | None |
| First used | Chapter about bit fields |
calcchar23: 014Bh
Calculates which bytes to put into character control register offset 2
and 3.
clearchar: 016Bh
Clears all characters.
decodejoystick: 03B1h
Converts the delta x/y from getjoystick into a direction.
divide: 03CFh
Calculates R4=R2/R3, R5=R2%R3.
doclock: 01B0h
Updates the clock display if necessary.
| Input | R4=y |
| | R6=color (both must be the same as in initclock) |
| Output | None |
| Alters | A, R0, R1, R2, R5, R6, P1, table |
| First used | Chapter about clock routines |
extramenable: 00ECh
Enables the external RAM, disables the VDC.
getjoystick: 038Fh
Gets the joystick position.
gfxoff: 011Ch
Turns the graphics off, so you can change the VDC registers.
gfxon: 0127h
Turns the graphics on, you should not change VDC registers any more.
init: 00F1h
Initialises VDC, internal and external RAM.
initclock: 023Ah
Initialises quad0/1 to display a clock.
irq: 0009h
Begin of IRQ routine.
| Input | None |
| Output | if VSYNC: | RB0 active, VDC enabled |
| | | R5=old A |
| | | R6=old P1 |
| | | jmp 406h |
| | if not VSYNC: | retr |
| Alters | A, R0, P1 when VSYNC |
| First used | Chapter about "HELLO WORLD" |
irqend: 0014h
Restores the old state before the interrupt and does a retr.
multiply: 03DDh
Multiplies R2 and R3.
nibblemixer: 02A4h (G7000 only)
Mixes a nibble using a ROM table at 02B3h with selectable maximum.
This routine is not available on the Videopac+ G7400.
parsesnd: 04bh
Parse one sound opcode, part of sound irq handler.
playsound: 01A2h
Tells the IRQ routines to start playing one of the built-in tunes.
| Input | A=pointer to tune in page 3 |
| Output | None |
| Alters | A, interrupt enable |
| First used | Chapter about sound |
| 028h | tune_beep_error | An error occurred |
| 02Eh | tune_explode | Something explodes |
| 03Ch | tune_alarm | Something went wrong |
| 04Ah | tune_select | Tune from "SELECT GAME" |
| 056h | tune_keyclick | The keyboard click |
| 05Ah | tune_buzz | A short buzzing sound |
| 05Eh | tune_select2 | tune_select backwards |
| 06Ah | tune_shoot | A shot followed by an explosion |
pluscmd: 0288h (G7400 only)
Send a command to the Videopac+ G7400.
The command byte
| 000h | plus_cmd_brow | Set the y position, set x position to 0 |
| 020h | plus_cmd_loady | Set the y position |
| 040h | plus_cmd_loadx | Set the x position |
| 060h | plus_cmd_incc | Advance cursor position |
| 080h | plus_cmd_loadm | Set read/write mode |
| 0A0h | plus_cmd_loadr | Set the Videopac+ G7400 display mode |
| 0C0h | plus_cmd_loady0 | Choose which line is displayed as second line, useful for scrolling |
The register M
| 000h | plus_loadm_wr | Normal write, advance cursor |
| 020h | plus_loadm_rd | Normal read, advance cursor |
| 040h | plus_loadm_wrni | Write without moving cursor |
| 060h | plus_loadm_rdni | Read without moving cursor |
| 080h | plus_loadm_wrsl | Write slice, for redefining chars |
| 0A0h | plus_loadm_rdsl | Read slice, for redefining chars |
plusdata: 028Ch (G7400 only)
Send data to the Videopac+ G7400.
The parallel attributes
| 080h | col_patr_blck | Enable block gfx, set background color |
| 040h | col_patr_invrt | Invert the current char |
| 020h | col_patr_dwdth | Double the width of the current char |
| 010h | col_patr_dhght | Double the height of the current char |
| 008h | col_patr_stable | Do not blink |
| 000h-007h | plus_col_color | Foreground color |
The serial attributes
| 080h | col_satr_enable | Enable serial attributes |
| 004h | col_satr_line | Underline chars |
| 002h | col_satr_box | Draw in boxed mode |
| 001h | col_satr_conc | Draw concealed chars |
plusenable: 02A1h (G7400 only)
Enables the Videopac+ G7400 graphics, disables the external RAM and VDC.
plushide: 0296h (G7400 only)
Hides all Videopac+ G7400 graphics.
plusloadr: 0283h (G7400 only)
Send the command plus_cmd_loadr to the Videopac+, handles 50/60Hz.
The register R
| 080h | plus_loadr_blnk | Enable blink mode |
| 040h | plus_loadr_tt | 50 or 60 Hz, handled by BIOS |
| 020h | plus_loadr_tl | Monitor mode, always 0 for VP+ G7400 |
| 010h | plus_loadr_crsr | Show cursor |
| 008h | plus_loadr_srow | Display first line (called service row) |
| 004h | plus_loadr_conc | Hide concealed chars |
| 002h | plus_loadr_box | Enable box mode |
| 001h | plus_loadr_dspl | Enable display of other lines |
plusmode: 0299h (G7400 only)
Sets the Videopac+ G7400 display parameters.
plusready: 027Dh (G7400 only)
Polls the busy flag of the EF9340/41, waits until it is ready.
plusselectgame: 02C2h
Fills screen with "SELECT GAME", initialises VDC, internal and
external RAM. Then waits until a key is pressed. This routine gives identical
results to selectgame on non Videopac+ G7400 machines and can
be used to detect the machine type.
| Input | None |
| Output | VDC enabled, gfx on, A=key number |
| | G7000: jmp 040Ch in bank 3 |
| | G7400: jmp 040Ch in bank 1 |
| Alters | Everything |
| First used | Chapter about Videopac+ G7400 |
plusstart: 02ABh (G7400 only)
Initialises VDC and continues as if selectgame was called.
printchar: 03EAh
Prints a character or quad onto the screen.
| Input | R0=pointer to char/quad |
| | R3=x |
| | R4=y |
| | R5=char |
| | R6=color |
| Output | R0=pointer to next char/quad |
| | R3=next x |
| | R5/R6=byte 2/3 |
| Alters | A |
| First used | Chapter about "HELLO WORLD" |
putchar23: 0261h
Calculates which bytes to put into character data offset 2 and 3
and puts it into VDC.
random: 0293h (G7000 only)
Returns 2 random nibbles with selectable maximums using the T register.
This routine is not available on the Videopac+ G7400.
selectgame: 02C3h
Initialises VDC, internal and external RAM. Displays "SELECT GAME".
Then waits until a key is pressed.
soundirq: 0044h
Processes sound-events in IRQ.
tablebcdbyte: 017Ch
Displays a BCD byte via table, starts the table and activates it.
tablebcdnibble: 0229h
Displays a BCD nibble via table.
tablechar23: 022Ch
Calculates which bytes to put into character data offset 2 and 3
and stores them into the table.
tableend: 0132h
Puts an end marker into the table and activates it.
tableprintchar: 0197h
Prints a character or quad onto the screen using the table, it's up to you
to set the first bytes of the table.
| Input | R0=pointer to table |
| | R3=x |
| | R4=y |
| | R5=char |
| | R6=color |
| Output | R0=pointer to end of table |
| | R3=next x |
| | R5/R6=byte 2/3 |
| Alters | A |
| First used | Chapter about table routines |
tableput2: 0235h
Puts a 2 into the table.
vdcenable: 00E7h
Enables the VDC, disables the external RAM.
vsyncirq: 001Ah
VSYNC routine: checks for collisions, counts the clock, copies the table,
processes first part of sound event.
waitforkey: 013Dh
Waits until a key is pressed, plays the keyclick tune and returns which key
was pressed.
waitvsync: 0176h
Waits until the next frame starts.
Resources used by the BIOS
Register Bank 0
| R7 | The last key that was pressed |
| R6 | Stores P1 while in interrupt |
| R5 | Stores A while in interrupt |
| R4 | Pointer to the next sound event in page 3 |
| R3 | Frames to wait for the next sound event |
| R2-R0 | Scratch |
Internal RAM
| 8048 Processor |
| 000h-007h | Register Bank 0 |
| 008h-017h | Stack |
| 018h-01fh | Register Bank 1 |
| BIOS |
| 03Fh:7 | 1=Table copy active |
| 03Fh:6 | 1=Sound active |
| 03Fh:5-0 | unused |
| 03Eh:7 | 1=Stop clock |
| 03Eh:6 | 1=Count clock up |
| 03Eh:5-0 | Frame counter (0-03Ch) |
| 03Dh | Collision register |
External RAM
| 07Fh | How many registers to copy |
| 07Eh | Start register |
| 07Dh-X | Contents of registers |
| X-1 | How many registers to copy |
| ... | ... |
| 02h | Clock: seconds |
| 01h | Clock: minutes |