Home page Development platforms Favourite web sites Favourite TV & Film Favourite Music Ongoing Projects Old Equipment

Cobra - Technical Discussion & Disassembly - Location of routines and data

This is preliminary list of the routines and data tables contained in Cobra. This is going to be dumped as a copy of the Diana (part of the Zeus package) source to generate the disassembly listing until I can find something better. If you're wondering what the listing looks likeso far, click here.

o 61a8
fx:\ZXSpectrum\jof\Cobra\cobra.bin

c; This is a work in progress and not all values are correct yet (but most of them should be)

c; Naming convention
c; b_NAME - Bitmap NAME
c; sb_NAME - Preshifted 3-tile block NAME
c; sp_NAME - Preshifted sprite NAME
c; t_NAME - Lookup table NAME
c; d8_NAME - 8-bit byte list NAME
c; d16_NAME - 16-bit word list NAME

c; Loads into 61a8-FFFF
r61a8 bdb8

l af10 USRSTART       
c; Entry point after LOADing

l 8505 NUMTEST       
c; Scan the top row for key presses and return number in C
d 851c t_NUMSCANS   
c; 16-bit scan code masks for the top row

l 8ea3 LOSELIFE
l 941B PLAYERHIT

l a936 PLAYTUNE        
c; Play tune referenced in register A
l 5b00 PLAYERCODE:      
c; Music player (07d0 bytes). Is relocated to 8000 when needed.

l e928 sp_SPRDATA2
l ee80 sb_GROUND
l eed4 sb_00
l f180 sb_01
l f300 sb_02
l f480 sb_03
l f600 sb_04
l f780 sb_05
l f900 sb_06
l fa80 sb_07
l fc00 t_TABLE
l fd00 t_INTVEC
l fe0d b_COBRA

l 9dcf DRAWGROUND   
c; Draw the scrolling ground
l 9c8a DRAWMAP       
c; Draw the background map
l 9ae3 DRAWSPRITES   
c; Draw the sprites

c; The following tables store the locations of the dynamically generated screen drawing routines for each row of tiles
c; There are two versions depending on whether the stack is odd or even aligned

c; The format of the two tables are as follows:
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw ROW0CODE, TILESET1, TILESET2
c; dw 0
c;
c; Where tileset1 is the address of the preshifted 3-tile block which will be pointed to by IX and
c; tileset2 is the address of the preshifted 3-tile block which will be pointed to by IY.
c; In most cases each row will only use one tileset, but when a different set of tiles is needed then
c; the registers AF,BC and DE will be POPed out of IY and used for the remainder of that row
c;

d 8a92 t_DRAWMAPODD
d 8a60 t_DRAWMAPEVEN

l fcdf _KEYPRESS

d fcb0 d16_CURSORPOS   
c; Cursor position in two bytes, column and row.
d fcb5 d8_PRINTATTR   
c; Current attribute for printing

l a369 PRINTSTR       
c; Routine to print a string, ff terminates a string

d a33f t_CTRLCHRSUBS   
c; Vector table for routines to handle control characters
l a3d4 CTRLCHRLOC   
c; Locate print position using following two bytes (goes into fcb0)
l a3dd CTRLCHR_01
l a3e4 CTRLCHR_02
l a428 CTRLCHR_03
l a42f CTRLCHR_04
l a440 CTRLCHRSETATTR
l a447 CTRLCHR_06
l a402 CTRLCHR_07
l a450 CTRLCHR_08
l a465 CTRLCHR_09
l a471 CTRLCHR_0a
l a47f CTRLCHR_0b
l a3f7 CTRLCHR_0c
l a487 CTRLCHR_0d
l a492 CTRLCHR_0e
l a4b0 CTRLCHR_0f
l a4c1 CTRLCHR_10
l a4f1 CTRLCHR_11
l a4f9 CTRLCHR_12
l a500 CTRLCHR_13
l a423 CTRLCHR_14

l a646 STRCMP       
c; Compare strings at DE and HL. Return Z if identical. HL and DE point to mismatch or null terminator
l a689 ADD_HL_A
c; Add A to HL
l a68e HL_FROM_HL   
c; LD HL,(HL)
l a693 DE_FROM_HL   
c; LD DE,(HL)
l a698 JPINDEX        
c; JP (HL)  - For real, actually retrieve the vector from (HL) and go there
l a69d HLBC_FROM_IX   
c; LD HL,(IX+0), LD BC,(IX+2)
l a6aa HLDE_FROM_IX   
c; LD HL,(IX+0), LD DE,(IX+2)

l a64f INIT_IM2       
c; Set up IM2, vector table at fd00-ff01 with ffff, copy ISR from a670 to fff4 (12 bytes)
l a670 IM2_HANDLER   
c; IM2 handler routine. ffff is a JR back to FFF4 which then jumps to a67c
l a67c IM2_ISR       
c; This is the actual handler for IM2 interrupts. It sets bit 7 of R to signal the interrupt.


l b0fd MAINMENU
l b11c t_MENUROUTINES
l b12c MENU_KEYBOARD
l b147 MENU_KEMPSTON
l b149 MENU_SINCLAIR
l b14f MENU_CUSROR
l b198 MENU_COLOUR
l b169 MENU_SOUND
l b1b9 MENU_DEFKEYS

; Scan the whole keyboard and return the section (1-8) and key position (1-5) in DE
l b280 SCANKEYBOARD
l b421 t_KEYBOARD
l b20a t_USERKEYS   
c; Up, Down, Left, Right, Murder, Hold


o 61a8

b @7dff

l.b_TILESET
o 73e0
G 6 2d 23
[1b
_
g 60
]

l.b_CHARSET
G 1 2d 23
[40
_
g 8
]
_


i @b750

l.b_OCNLOGO
G c 2d 23
[20
g c
]

l b8d0 sp_SPRDATA

G 6 2d 23

l.b_NSLASHER_L
[4
[18
g 6
]
_
]

l.b_NSLASHER_R
[4
[18
g 6
]
_
]

l.b_ROCKETLADY_L
[4
[20
g 6
]
_
]

l.b_ROCKETLADY_R
[4
[20
g 6
]
_
]

l.b_COBRA_L
[4
[20
g 6
]
_
]

l.b_COBRA_R
[4
[20
g 6
]
_
]

l.b_HEADBUTT_L
[20
g 6
]
_

l.b_HEADBUTT_R
[20
g 6
]
_

l.b_JUMP_L
[20
g 6
]
_

l.b_JUMP_R
[20
g 6
]
_

l.b_CROUCH_L
[18
g 6
]
_

l.b_CROUCH_R
[18
g 6
]
_

l.b_INGRID_L
[4
[20
g 6
]
_
]

l.b_INGRID_R
[4
[20
g 6
]
_
]

l.b_KNIFE_L
[4
[8
g 6
]
_
]

l.b_KNIFE_R
[4
[8
g 6
]
_
]

l.b_GUN_L
[8
g 6
]
_

l.b_GUN_R
[8
g 6
]
_

l.b_UZI_L
[10
g 6
]
_

l.b_UZI_R
[10
g 6
]
_


G 5 2d 23

l.b_DUCK
[28
g 5
]
_

G 6 2d 23

l.b_EXPLOSION
[4
[18
g 6
]
_
]

l.b_ARNIE_L
[4
[20
g 6
]
_
]

l.b_ARNIE_R
[4
[20
g 6
]
_
]

l.b_SLASHER_L
[4
[20
g 6
]
_
]

l.b_SLASHER_R
[4
[20
g 6
]
_
]

G 3 2d 23

l.b_GLOVE
[18
g 3
]
_


G 6 2d 23

l.b_USEYOURHEAD
[20
g 6
]
_

l.b_STARTTOSTAB
[20
g 6
]
_

l.b_IMTHECURE
[20
g 6
]
_

l.b_DONTPUSHME
[20
g 6
]
_

G 5 2d 23

l.b_COBRAPIC
[28
g 5
]
_


G 6 2d 23

l.b_PRAM_L
[4
[18
g 6
]
_
]

l.b_BURGER
[4
[10
g 6
]
_
]

l.b_MISSILE_L
[4
[8
g 6
]
_
]

l.b_MISSILE_R
[4
[8
g 6
]
_
]

b 18