If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Ometron

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Ometron

Developer: Software Projects
Publisher: Software Projects
Platform: ZX Spectrum
Released in EU: 1983


SourceIcon.png This game has uncompiled source code.


Source Code Fragment

A large section of code can be seen within the game's data. In the .tap dump, it's at 315E.

ORG 24576
LOAD 09000H
LD A,2
CALL 01601H
LD A,1
LD (23729),A
XOR A
LD (23692),A
LD (23608),A
LD (23609),A
LD HL,33971
LD (23660),HL
LD HL,43749
LD (23618),HL
LD HL,33907
LD DE,43264
LD DE,64
LDIR
DI
LD A,195
LD (23713),A
LD HL,DLY
LD (23714),HL
LD A,46
LD I,A
IM 2
EI
EXX
PUSH HL
EXX
LD A,1
LD (23728),A
LD (23671),A
LD IX,23296
LD DE,8
LD B,5

LPOK:
LD A,1
LD (IX+0),A
LD A,10
LD (IX+2),A
ADD IX,DE
DJNZ LPOK
LD A,(23562)
LD B,A

LPOL:
LD A,2
LD (IX+0),A
LD A,156
LD (IX+3),A
LD A,10
LD (IX+2),A
ADD IX,DE
DJNZ LPOL
XOR A
LD (IX+0),A

GM:
CALL HANDR
LD A,(23692)
LD D,A
LD A,(23608)
ADD A,D
AND 31
LD (23692),A
CALL KYS
CALL DISP
LD BC,65022
IN A,(C)
AND 1
JP Z,RT
LD A,(23728)
OR A
JP NZ,GM

RT:
EXX
POP HL
EXX
DI
LD A,62
LD I,A
IM 1
EI
RET

FC:
DB 1

SBAD:
DB 0

RV:
DB 1

XS:
DB 0

RRR:
DB 0

NX:
DB 10

NY:
DB 10

T:
DB 0,0

T2:
DB 0,0

SHAP:
LD A,(HL)
OR A
RET Z
DEC A
JP Z,DSH
CALL ADIS
LD A,(NX)
LD (23677),A
LD A,(NY)
LD (23678),A
JP SHAP

ADIS:
INC HL
LD A,(HL)
ADD A,(IX+3)
LD E,A
BIT 7,E
JP NZ,OFF
INC HL
PUSH HL
LD A,(HL)
ADD A,(IX+1)
LD H,A
LD L,0
SRA H
RR L
CALL DIV
LD BC,128
ADD HL,BC
LD A,H
OR A
JP NZ,OFF
LD A,L
LD (NX),A
POP HL
INC HL
PUSH HL
LD A,(HL)
ADD A,(IX+2)
LD H,A
LD L,0
SRA H
RR L
CALL DIV
LD BC,64
ADD HL,BC
LD A,H
OR A
JP NZ,OFF
BIT 7,L
JP NZ,OFF
LD A,L
LD (NY),A
POP HL
INC HL
RET

OFF:
POP HL
POP HL
JP NEX2

DSH:
CALL ADIS
LD D,1
LD E,D
LD A,(23677)
LD C,A
LD A,(NX)
SUB C
LD C,A
BIT 7,A
JP Z,U1
XOR A
SUB C
LD C,A
LD E,255

U1:
LD A,(23678)
LD B,A
LD A,(NY)
SUB B
LD B,A
BIT 7,A
JP Z,U2
XOR A
SUB B
LD B,A
LD D,255

U2:
PUSH HL
CALL 64640
POP HL
JP SHAP

DIV:
LD C,0
LD D,C
BIT 7,H
JP Z,O1
PUSH HL
POP BC
LD HL,0
SBC HL,BC
LD C,1

O1:
LD B,16

M1:
SLA L
RL H
RL D
LD A,D
SUB E
JP C,M2
LD D,A
SET 0,L

M2:
DJNZ M1
LD A,C
OR A
RET Z
PUSH HL
POP BC
LD HL,0
SBC HL,BC
RET

MULT:
LD HL,0
LD D,H
LD B,8

M4:
BIT 0,C
JP Z,M5
ADD HL,DE

M5:
SRL C
SLA E
RL D
DJNZ M4
RET

MUL2:
XOR A
BIT 7,E
JP Z,M6
SUB E
LD E,A
LD A,1

M6:
CALL MULT
OR A
RET Z
LD DE,0
EX DE,HL
SBC HL,DE
RET

HANDR:
LD IX,23296

MLOOP:
LD A,(IX+0)
OR A
RET Z
DEC A
JP Z,NEX2
DEC A
JP Z,ALIEN

YBM:
DEC (IX+5)
JP NZ,YB2
LD A,1
LD (IX+0),A
JP NEX2

YB2:
LD A,(IX+0)
CP 4
JP Z,BANG
CALL MOV
CALL CHEK
CALL MOV
CALL CHEK
CALL MOV
CALL MOV
CALL CSET
LD A,(IX+4)
ADD A,A
LD L,A
LD H,170
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
CALL SHAP

NEX2:
LD DE,8
ADD IX,DE
JP MLOOP

CSET:
LD E,(IX+3)
BIT 7,E
JP NZ,NEXT
LD A,E
OR A
JP Z,NEXT
LD L,0
LD H,(IX+1)
SRA H
RR L
CALL DIV
LD BC,128
ADD HL,BC
LD A,H
OR A
JP NZ,NEXT
LD A,L
LD (23677),A
LD H,(IX+2)
LD L,0
SRA H
RR L
CALL DIV
LD BC,64
ADD HL,BC
LD A,H
OR A
JP NZ,NEXT
BIT 7,L
JP NZ,NEXT
LD A,L
LD (23678),A
RET

NEXT:
POP HL
JP NEX2

MOV:
LD A,(IX+4)
ADD A,A
LD L,A
LD H,255
LD B,0
LD C,(HL)
BIT 7,C
JP Z,M2A
LD B,255

M2A:
EX DE,HL
LD H,(IX+1)
LD L,(IX+6)
ADD HL,BC
ADD HL,BC
ADD HL,BC
LD (IX+1),H
LD (IX+6),L
EX DE,HL
INC HL
LD B,0
LD C,(HL)
BIT 7,C
JP Z,M3
LD B,255

M3:
LD H,(IX+3)
LD L,(IX+7)
ADD HL,BC
ADD HL,BC
ADD HL,BC
LD (IX+3),H
LD (IX+7),L
LD A,H
BIT 7,A
RET NZ
CP 15
RET NC
LD A,(IX+1)
CALL ABS
LD (23728),A
RET

ALIEN:
CALL DICHG
CALL MOV
CALL MOV
CALL MOV
CALL CSET
LD A,(23692)
ADD A,(IX+4)
AND 31
ADD A,A
LD L,A
LD H,169
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
CALL SHAP
JP NEX2

DICHG:
LD A,(23609)
OR A
RET Z
DEC A
JP Z,OK3
DEC (IX+5)
RET NZ
LD A,20
LD (IX+5),A

OK3:
LD E,1
LD A,R
AND 64
JP NZ,P1
LD E,255

P1:
LD A,(IX+4)
ADD A,E
AND 31
LD (IX+4),A
RET

III:
EQU 40

CHEK:
LD IY,23296+III
LD DE,8

LOOPR:
LD A,(IY+0)
OR A
RET Z
CP 2
JP Z,HITQ

NEC:
ADD IY,DE
JP LOOPR

HITQ:
LD A,(IY+1)
SUB (IX+1)
CALL ABS
JP NZ,NEC
LD A,(IY+3)
SUB (IX+3)
CALL ABS
JP NZ,NEC
LD HL,HISS
DI
LD (23714),HL
EI
LD A,10
LD (23671),A
LD A,1
LD (IY+0),A
LD A,4
LD (IX+0),A
INC A
LD (IX+5),A
JP SCOR
RET

ABS:
BIT 7,A
JP Z,LIP
LD C,A
XOR A
SUB C

LIP:
SRL A
SRL A
SRL A
OR A
RET

ROT:
LD A,(23677)
SUB 3
LD (23677),A
LD E,A
LD C,251
CALL MUL2
LD (T),HL
LD A,(23678)
ADD A,2
LD (23678),A
LD E,A
LD C,50
CALL MUL2
LD BC,(T)
ADD HL,BC
LD (T),HL
LD A,(23677)
LD E,A
LD C,50
CALL MUL2
LD (T2),HL
LD A,(23678)
LD E,A
LD C,251
CALL MUL2
LD BC,(T2)
OR A
SBC HL,BC
LD A,H
SUB 2
LD (23678),A
LD A,(T+1)
ADD A,3
LD (23677),A
RET

ROR:
LD IX,23296
LD A,1
LD (RRR),A
LD A,(SBAD)
ADD A,8
AND 56
LD (SBAD),A

R1:
LD A,(IX+0)
OR A
RET Z
LD A,(IX+4)
INC A
AND 31
LD (IX+4),A
LD A,(IX+1)
LD (23677),A
LD A,(IX+3)
LD (23678),A
CALL ROT
LD A,(23677)
LD (IX+1),A
LD A,(23678)
LD (IX+3),A
LD DE,8
ADD IX,DE
JP R1

ROL:
LD IX,23296
LD A,2
LD (RRR),A
LD A,(SBAD)
SUB 8
AND 56
LD (SBAD),A

R2:
LD A,(IX+0)
OR A
RET Z
LD A,(IX+4)
DEC A
AND 31
LD (IX+4),A
LD A,(IX+1)
LD (23678),A
LD A,(IX+3)
LD (23677),A
CALL ROT
LD A,(23678)
LD (IX+1),A
LD A,(23677)
LD (IX+3),A
LD DE,8
ADD IX,DE
JP R2

KYS:
LD BC,65278
IN A,(C)
AND 1
LD E,A
LD BC,32766
IN A,(C)
AND 1
AND E
JP Z,FIRE
LD A,1
LD (FC),A

FRT:
LD BC,65278
IN A,(C)
AND 24
CP 16
JP Z,ROR
CP 8
JP Z,ROL
RET

FIRE:
LD A,(FC)
OR A
JP Z,FRT
XOR A
LD (FC),A
LD IX,23296
LD DE,8
LD B,5

LJP:
LD A,(IX+0)
DEC A
JP Z,YES
ADD IX,DE
DJNZ LJP
JP FRT

YES:
LD (IX+1),A
LD (IX+6),A
LD (IX+7),A
LD A,3
LD (IX+0),A
LD A,15
LD (IX+3),A
LD A,16