You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
2.3 KiB
128 lines
2.3 KiB
4 years ago
|
include "charmap.inc"
|
||
|
include "defines.inc"
|
||
|
include "video.inc"
|
||
|
include "hardware.inc"
|
||
|
|
||
|
section "main.asm@data", rom0
|
||
|
gfx_font:
|
||
|
incbin "assets/tetrisfont.1bpp"
|
||
|
gfx_font_end:
|
||
|
|
||
|
section "main.asm@vram", vram
|
||
|
|
||
|
ds $2D tiles
|
||
|
v_font_dash_period: ds 2 tiles
|
||
|
ds $1 tiles
|
||
|
v_font_numbers: ds 10 tiles
|
||
|
ds $7 tiles
|
||
|
v_font_uppercase: ds 26 tiles
|
||
|
ds $6 tiles
|
||
|
v_font_lowercase: ds 26 tiles
|
||
|
|
||
|
section "main.asm", rom0
|
||
|
|
||
|
main::
|
||
|
call audio_disable
|
||
|
call lcd_disable
|
||
|
if def(ENABLE_CLEAR)
|
||
|
call vram_clear
|
||
|
endc
|
||
|
|
||
|
; Load the font
|
||
|
ld hl, gfx_font
|
||
|
ld de, v_font_numbers
|
||
|
ld bc, (10 tiles) / 2
|
||
|
call memcpy_double
|
||
|
ld de, v_font_uppercase
|
||
|
ld bc, (26 tiles) / 2
|
||
|
call memcpy_double
|
||
|
ld hl, gfx_font + (10 tiles) / 2
|
||
|
ld de, v_font_lowercase
|
||
|
ld bc, (26 tiles) / 2
|
||
|
call memcpy_double
|
||
|
ld de, v_font_dash_period + (1 tiles)
|
||
|
ld bc, (1 tiles) / 2
|
||
|
call memcpy_double
|
||
|
ld de, v_font_dash_period
|
||
|
ld bc, (1 tiles) / 2
|
||
|
call memcpy_double
|
||
|
|
||
|
; Setup the palettes
|
||
|
if def(ENABLE_CGB)
|
||
|
ldh a, [h_console]
|
||
|
cp console_cgb
|
||
|
jr c, .skip_pals
|
||
|
|
||
|
ld a, r_bcps_inc | 0 << r_bcps_pal_f | 0 << r_bcps_offs_f
|
||
|
ld c, LOW(r_bcps)
|
||
|
ldh [c], a
|
||
|
inc c
|
||
|
ld b, 4
|
||
|
ld a, $ff
|
||
|
.loop_pal_1
|
||
|
ldh [c], a
|
||
|
dec b
|
||
|
jr nz, .loop_pal_1
|
||
|
ld b, 4
|
||
|
xor a
|
||
|
.loop_pal_2
|
||
|
ldh [c], a
|
||
|
dec b
|
||
|
jr nz, .loop_pal_2
|
||
|
|
||
|
.skip_pals
|
||
|
endc
|
||
|
|
||
|
; Clear the background map
|
||
|
xor a
|
||
|
ld hl, v_bgmap1
|
||
|
ld bc, bgmap_width * bgmap_height
|
||
|
call memset
|
||
|
|
||
|
call lcd_enable
|
||
|
ld hl, string_something
|
||
|
bgcoord de, 5, 2
|
||
|
call print
|
||
|
|
||
|
call serial_init_master
|
||
|
|
||
|
main_loop:
|
||
|
call joypad_update
|
||
|
bit joy_a_f, a
|
||
|
jr nz, .send_shit
|
||
|
|
||
|
bgcoord hl, 7, 5
|
||
|
call lcd_blank_wait
|
||
|
ld [hl], " "
|
||
|
|
||
|
.continue
|
||
|
call vblank_wait
|
||
|
jr main_loop
|
||
|
|
||
|
.send_shit
|
||
|
call vblank_wait
|
||
|
call joypad_update
|
||
|
bit joy_a_f, a
|
||
|
jr nz, .send_shit
|
||
|
|
||
|
bgcoord hl, 7, 5
|
||
|
call lcd_blank_wait
|
||
|
ld [hl], "A"
|
||
|
ld hl, transfer_buffer
|
||
|
ld de, NULL
|
||
|
ld bc, transfer_buffer.end - transfer_buffer
|
||
|
call serial_transfer
|
||
|
|
||
|
.send_shit_wait
|
||
|
call vblank_wait
|
||
|
call serial_finished
|
||
|
jr nz, .send_shit_wait
|
||
|
|
||
|
jr .continue
|
||
|
|
||
|
transfer_buffer:
|
||
|
db $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $AA, $BB, $CC, $DD, $EE, $FF
|
||
|
.end
|
||
|
|
||
|
string_something: db "SOMETHING$"
|