mid-kid
4 years ago
8 changed files with 160 additions and 124 deletions
@ -1,127 +1,22 @@ |
|||||
include "charmap.inc" |
include "charmap.inc" |
||||
include "defines.inc" |
include "defines.inc" |
||||
include "video.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 |
section "main.asm", rom0 |
||||
|
|
||||
main:: |
main:: |
||||
call audio_disable |
|
||||
call lcd_disable |
call lcd_disable |
||||
if def(ENABLE_CLEAR) |
call font_load |
||||
call vram_clear |
call pals_set_bw |
||||
endc |
;call vram_clear_bgmap |
||||
|
|
||||
; 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 |
call lcd_enable |
||||
|
|
||||
ld hl, string_something |
ld hl, string_something |
||||
bgcoord de, 5, 2 |
bgcoord de, (screen_width - string_something.end + string_something + 1) / 2, 2 |
||||
call print |
call print |
||||
|
|
||||
call serial_init_master |
;call prog_serial_test |
||||
|
jp _halt_ |
||||
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$" |
string_something: db "SOMETHING$" |
||||
|
.end |
||||
|
@ -0,0 +1,58 @@ |
|||||
|
include "charmap.inc" |
||||
|
include "video.inc" |
||||
|
include "hardware.inc" |
||||
|
|
||||
|
section "prog/serial_test.asm", rom0 |
||||
|
|
||||
|
prog_serial_test:: |
||||
|
call lcd_disable |
||||
|
call font_load |
||||
|
call pals_set_bw |
||||
|
call lcd_enable |
||||
|
|
||||
|
ld hl, string_title |
||||
|
bgcoord de, (screen_width - string_title.end + string_title + 1) / 2, 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_title: db "SERIAL TEST$" |
||||
|
.end |
Loading…
Reference in new issue