Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AppFilename equ "testx" ; What we're called (for file generation)
- AppFirst equ $8000 ; First byte of code (uncontended memory)
- zeusemulate "48K","ULA+" ; Set the model and enable ULA+
- org AppFirst ; Start of application
- AppEntry ld ix, dir ; load in the varibles in IX reg
- ld a,7 ; white ink (7) black paper (0),
- ld (23693),a ; set our screen colours.
- call 3503 ; ROM routine - clears screen, opens channel#2.
- mainloop call delay ; loop start
- call enemy_xy ;
- jp moveenemy ;
- cont call whitespace ;
- call enemy_xy ;
- call enemy1 ;
- jp mainloop ; loop end
- enemy_xy ld a,22 ; AT code.
- rst 16 ;
- ld a,(ix+1 ) ; player Y.
- rst 16 ;
- ld a,(ix+2) ; player X (static)
- rst 16 ;
- ret ;
- moveenemy: ld a,32 ;
- rst 16 ;
- ld a,(ix+0) ; direction, binary choice, =0 goes up, =1 goes down.
- or a ;
- jr nz, moveenemydown ;
- jp moveenemyup ;
- moveenemyup: dec (ix+1) ; move up
- LD a, (ix+1) ; store new pos val ;
- cp 1 ; at top?
- jr nz, switchdown ;
- jp cont ;
- moveenemydown: inc (ix+1) ; move down
- ld a, (ix+1) ; Store new co-ordinate ;
- cp 21 ; at bottom?
- jr nz, switchup ;
- jp cont ;
- switchup: ld (ix+0), 0 ; possible to combine into single
- jp cont ; routine that NOT's the value
- switchdown: ld (ix+0), 1 ;
- jp cont ;
- enemy1: ld a,7 ; white colour on black.
- ld (23695),a ; set our temporary screen colours.
- ld a,143 ; ASCII code for UDG block.
- rst 16 ; draw player.
- ret ;
- whitespace: ld a,0 ; black on black paper (0)
- ld (23675),a ; set our temporary screen colours.
- ld a,32 ; SPACE character.
- rst 16 ; display space.
- ret ;
- delay: ld b,12 ; Delay length
- delayloop: halt ;
- djnz delayloop ; Decrease B by one and repeat until B is zero
- ret ;
- ; vars
- dir defb 01 ;
- enemyY defb 10 ;
- enemyX defb 16 ;
- ; Stop planting code after this. (When generating a tape file we save bytes below here)
- AppLast equ *-1 ; The last used byte's address
- ; Generate some useful debugging commands
- profile AppFirst,AppLast-AppFirst+1 ; Enable profiling for all the code
- ; Setup the emulation registers, so Zeus can emulate this code correctly
- Zeus_PC equ AppEntry ; Tell the emulator where to start
- Zeus_SP equ $FF40 ; Tell the emulator where to put the stack
- ; These generate some output files
- ; Generate a SZX file
- output_szx AppFilename+".szx",$0000,AppEntry ; The szx file
- ; If we want a fancy loader we need to load a loading screen
- ; import_bin AppFilename+".scr",$4000 ; Load a loading screen
- ; Now, also generate a tzx file using the loader
- output_tzx AppFilename+".tzx",AppFilename,"",AppFirst,AppLast-AppFirst,1,AppEntry ; A tzx file using the loader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement