; ############## INITIALIZATION SECTION #################################### .org 0 .include "usgard.h" .include "orzupi.h" .db "Universe for Orzunoid 5+",0 ld hl,&ldata ld de,WUIB_ADDR ld bc,WUIB_SIZE ldir ld hl,(PROGRAM_ADDR) ld (UNIVERSE_ADDR),hl ld hl,&name jp VAR_EXEC name: .db "Orzunoid",0 ; ############## VARIABLE DELLARATION SECTION ############################## laserstatus =TEXT_MEM2 f1status =TEXT_MEM2+1 lasercoords =TEXT_MEM2+2 ;(X,Y) * 64 ; ############## INTERFACE SECTION ######################################### ldata: .db $D1 ;Revision 1 .db $4F ;Game name .db "LASER : PAD 21/01/98",0 ;Level ID .db 16 ;Number of levels jp &load_level ;Load level A jp &Init ;Code called at universe start jp &operate_lasers ;Code called every loop ld hl,laserstatus ;Code called when collected ld a,20 add a,(hl) ld (hl),a ld hl,(score) ld de,10 add hl,de ld (score),hl ret end_data: ; ############## IMPLEMENTATION SECTION #################################### Init: cp $50 jp nz, OTH_EXIT bit 0,h ret z ld hl,200 jp OCFT_SetLifeValue load_level: ld hl,6 ld ($800c),hl ld hl,olmsg ld de,(UNIVERSE_ADDR) add hl,de call D_ZT_STR ld hl,$8050 ;Generate random level ld b,32 loop_gen:push bc push hl call RANDOM pop hl and %01010101 ld (hl),a inc hl pop bc djnz loop_gen ld hl,laserstatus ;Clear data storage ld de,laserstatus+1 ld (hl),0 ld bc,65 ldir ret nof1: ld (hl),0 jr doneshooting operate_lasers: ld hl,laserstatus ld a,(hl) or a ret z call OTH_ARROW ;Check if 2nd pressed inc hl bit 5,a jr nz,nof1 ld a,(hl) or a jr nz,doneshooting ld (hl),1 dec hl ld a,(hl) dec A jr z,doneshooting ld (hl),a inc hl inc hl ;Put left bullet ld b,32 shooteml:ld a,(hl) or a jr nz,sactivel ld (hl),52 inc hl ld a,(p) ld (hl),a dec hl ld b,1 sactivel:inc hl inc hl djnz shooteml ld hl,lasercoords ;Put right bullet ld b,32 shootemr:ld a,(hl) or a jr nz,sactiver ld (hl),52 inc hl ld a,(p) ld b,a ld a,(expand) add a,b add a,30 ld (hl),a dec hl ld b,1 sactiver:inc hl inc hl djnz shootemr doneshooting: ld hl,lasercoords ;Handle laser blasts ld b,32 laserloop: push hl ld a,(hl) ;Test if blast active or a jr z,nolaserhere push bc dec (hl) ;Draw blast ld a,63 sub (hl) ld c,a inc hl ld b,(hl) srl b call FIND_PIXEL ld de,$8641 add hl,de or (hl) ld (hl),a pop bc pop hl push hl ld a,(hl) bit 5,a jr nz,nolaserhere and 28 add a,a add a,a ld e,a inc hl ld a,(hl) rra rra rra rra and 15 or e ld e,a ld d,0 ld hl,data add hl,de ld a,(hl) or a jr z,nolaserhere cp 3 jr z,nolaserhere dec a ld (hl),a ld hl,(score) inc hl ld (score),hl pop HL ld (hl),0 push hl nolaserhere: pop hl inc hl inc hl djnz laserloop ret olmsg: .db "Generating Level....",0 .end