Несколько дней собирался накодить простой эффект и по разным причинам откладывал занятие.
Сначала нужно разобраться с примером сдвига экрана. Запустил BBC Basic и набросал программу:
10 MODE 12
11 VDU 23,0,192,0
20 GCOL 0,5
30 MOVE 0,0
40 PLOT 5,319,199
45 *FX 19
46 VDU 23,7,2,3,1
47 GOTO 45
.assume adl=1 ; ez80 ADL memory mode
.org $40000 ; load code here
jp start_here ; jump to start of code
.align 64 ; MOS header
.db "MOS",0,1
start_here:
push af ; store all the registers
push bc
push de
push ix
push iy
; ------------------
; This is our actual code
; prepare the screen
; SET_MODE 12; mode 12 is 320x240 pixels, 64 colours
ld a, 22
rst.lil $10
ld a, 12
rst.lil $10
; CLS
mainlp:
;sysvar_time: EQU 00h ; 4: Clock timer in centiseconds (incremented by 2 every VBLANK)
;WAIT_VBLANK:
; ld a, $08 ; code to send to MOS
; rst.lil $08 ; get IX pointer to System Variables
; LD.LIL A, (IX + sysvar_time + 0)
;WB: CP.LIL A, (IX + sysvar_time + 0)
; JR Z,WB
;scroll area
ld hl, VDUdata1
ld bc, endVDUdata1 - VDUdata1
rst.lil $18
ld.lil de,$C7013F;319
llp:
ld a,iyl
xor e
m9:
sub 9
jr nc,m9
add a,9
ld a,11
jr z,getcol2
xor a
getcol2:
; jr z,getcol
; ld a,11
;getcol:
; xor 11
ld (pcol+2),a
ld (px),de
; ld a,199
; ld (px+2),a
; Sending a VDU byte stream
push de
ld hl, VDUdata ; address of string to use
ld bc, endVDUdata - VDUdata ; length of string
rst.lil $18 ; Call the MOS API to send data to VDP
pop de
dec de ; dec.s de ??
bit 7,d
jr z,llp
inc iyl
ld a, $08 ; code to send to MOS
rst.lil $08 ; get IX pointer to System Variables
WAIT_HERE: ; loop here until we hit ESC key
ld a, (ix + $05) ; get ASCII code of key pressed
cp 27 ; check if 27 (ascii code for ESC)
jp nz, mainlp ; if pressed, jump to exit
; This is where we exit the program
EXIT_HERE:
; CLS
pop iy ; Pop all registers back from the stack
pop ix
pop de
pop bc
pop af
ld hl,0 ; Load the MOS API return code (0) for no errors.
ret ; Return to MOS
; ------------------
; This is the data we send to VDP
VDUdata1:
.db 23,7,1,3,1 ; 23,7,extent,direction,speed
endVDUdata1:
VDUdata:
.db 23, 1, 0 ; hide cursor
.db 23, 0, 192, 0; set to non-scaled graphics
; FOR A SINGLE PIXEL PLOT
pcol: .db 18, 0, bright_red; set graphics colour: mode (0), colour
.db 25, 69; PLOT: mode (69 is a point in current colour),
px: .dw 320,199; X; Y;
endVDUdata:
; ------------------
; colour data
bright_red: equ 9
Комментарии
Отправить комментарий