diff --git a/.gitignore b/.gitignore index b626b35..db71375 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ tmp/ build/ *.lst *.sld - +*.bak +*.BAK diff --git a/JumpingJack/jack.asm b/JumpingJack/jack.asm index 1eebb56..bf036c9 100644 --- a/JumpingJack/jack.asm +++ b/JumpingJack/jack.asm @@ -1,10 +1,3 @@ -; =================================================== -; Ocean-240.2 computer -; Jumping Jack Game -; -; Disassembled by Romych 2025-03-25 -; Patched for Monitor R8 -; =================================================== DEVICE NOSLOT64K SLDOPT COMMENT WPMEM, ASSERTION, LOGPOINT @@ -389,11 +382,11 @@ wait_game_start: LD A, H ADD HL, HL AND 0x60 - JP PE, i_rnd_m1 + JP PE, .i_rnd_m1 INC HL -i_rnd_m1: +.i_rnd_m1: DEC C - JP NZ, .i_rnd_m + JP NZ, .i_rnd_m0 LD (monstr_pos), HL ; 0x27AC NOP diff --git a/JumpingJack/jack_data.inc b/JumpingJack/jack_data.inc new file mode 100644 index 0000000..8e0b0db --- /dev/null +++ b/JumpingJack/jack_data.inc @@ -0,0 +1,463 @@ +; ================================================== +; Ocean 240.2 +; Jumping Jack Binary data +; +; Disassembled by Romych, 2026-03-24 +; ================================================== + +j_msg_fin1: + db ASCII_SP, ASCII_ESC, '71' ; Set RUS Charset + db ASCII_FF ; cursor home + db " ^TO-V, ZOLOTA WAM HWATIT DO$" + +j_msg_fin2: + db "KONCA VIZNI. OTPRAWLQJTESX NA$" + +j_msg_fin3: + db "ZASLUVENNU@ PENSI@. PUSTX$" + +j_msg_fin4: + db "POPYTA@T S^ASTXQ DRUGIE $" + +j_msg_pres_key: + db ASCII_CR, ASCII_LF, ASCII_ESC, '71' ; Set RUS Charset + db ASCII_TAB, "nAVMI KLAWI[U $" ; Нажми клавишу + db " $" + +game_line: + db 32 ; 80 - final + +save_vmode: + db 0x62 + +BYTE_ram_0cbc: + db 0x00 + +j_arr_src_00: + ds 32, 0xff + +lvl_plane_0: + ds 32, 0 + +j_arr_src1: + ; DS 32 + db 0x18, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x66, 0x00 + db 0x5A, 0x00, 0x3C, 0x00, 0x18, 0x00, 0x3C, 0x00 + db 0x5A, 0x00, 0xA5, 0x00, 0x24, 0x00, 0x24, 0x00 + db 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0xc3, 0x00 + +j_arr_src2: + ; DS 32 + db 0x30, 0x00, 0x78, 0x00, 0x84, 0x00, 0xCC, 0x00 + db 0xb4, 0x00, 0x78, 0x00, 0x30, 0x00, 0x78, 0x00 + db 0xb4, 0x00, 0x4A, 0x01, 0x48, 0x00, 0x48, 0x00 + db 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x86, 0x01 + +j_arr_src3: + ; DS 32 + db 0x60, 0x00, 0xf0, 0x00, 0x08, 0x01, 0x98, 0x01 + db 0x68, 0x01, 0xf0, 0x00, 0x60, 0x00, 0xf0, 0x00 + db 0x68, 0x01, 0x94, 0x02, 0x90, 0x00, 0x90, 0x00 + db 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x0C, 0x03 + +j_arr_src4: + ; DS 32 + db 0xc0, 0x00, 0xe0, 0x01, 0x10, 0x02, 0x30, 0x03 + db 0xD0, 0x02, 0xe0, 0x01, 0xc0, 0x00, 0xe0, 0x01 + db 0xD0, 0x02, 0x28, 0x05, 0x20, 0x01, 0x20, 0x01 + db 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x18, 0x06 + +j_arr_src5: + ; DS 32 + db 0x80, 0x01, 0xc0, 0x03, 0x20, 0x04, 0x60, 0x06 + db 0xa0, 0x05, 0xc0, 0x03, 0x80, 0x01, 0xc0, 0x03 + db 0xa0, 0x05, 0x50, 0x0A, 0x40, 0x02, 0x40, 0x02 + db 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x30, 0x0C + +j_arr_src6: + ; DS 32 + db 0x00, 0x03, 0x80, 0x07, 0x40, 0x08, 0xc0, 0x0C + db 0x40, 0x0b, 0x80, 0x07, 0x00, 0x03, 0x80, 0x07 + db 0x40, 0x0b, 0xa0, 0x14, 0x80, 0x04, 0x80, 0x04 + db 0x40, 0x08, 0x40, 0x08, 0x40, 0x08, 0x60, 0x18 + +j_arr_src7: + ; DS 32 + db 0x00, 0x06, 0x00, 0x0f, 0x80, 0x10, 0x80, 0x19 + db 0x80, 0x16, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0f + db 0x80, 0x16, 0x40, 0x29, 0x00, 0x09, 0x00, 0x09 + db 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0xc0, 0x30 + +j_arr_src8: + ; DS 32 + db 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x33 + db 0x00, 0x2D, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x1E + db 0x00, 0x2D, 0x80, 0x52, 0x00, 0x12, 0x00, 0x12 + db 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x80, 0x61 + +j_arr_src9: + ; DS 32 + db 0x00, 0x18, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x66 + db 0x00, 0x5A, 0x00, 0x3C, 0x00, 0x18, 0x00, 0x3C + db 0x00, 0x5A, 0x00, 0xA5, 0x00, 0x24, 0x00, 0x24 + db 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0xc3 + +j_arr_src10: + ; DS 32 + db 0x18, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x66, 0x00 + db 0x5A, 0x00, 0x3C, 0x00, 0x18, 0x00, 0x3C, 0x00 + db 0x5A, 0x00, 0xA5, 0x00, 0x24, 0x00, 0x24, 0x00 + db 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0xc3, 0x00 + +j_arr_src11: + ; DS 32 + db 0x30, 0x00, 0x78, 0x00, 0x84, 0x00, 0xCC, 0x00 + db 0xb4, 0x00, 0x78, 0x00, 0x30, 0x00, 0x78, 0x00 + db 0xb4, 0x00, 0x4A, 0x01, 0x48, 0x00, 0x48, 0x00 + db 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x86, 0x01 +j_arr_src12: + ; DS 32 + db 0x60, 0x00, 0xf0, 0x00, 0x08, 0x01, 0x98, 0x01 + db 0x68, 0x01, 0xf0, 0x00, 0x60, 0x00, 0xf0, 0x00 + db 0x68, 0x01, 0x94, 0x02, 0x90, 0x00, 0x90, 0x00 + db 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x0C, 0x03 +j_arr_src13: + ; DS 32 + db 0xc0, 0x00, 0xe0, 0x01, 0x10, 0x02, 0x30, 0x03 + db 0xD0, 0x02, 0xe0, 0x01, 0xc0, 0x00, 0xe0, 0x01 + db 0xD0, 0x02, 0x28, 0x05, 0x20, 0x01, 0x20, 0x01 + db 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x18, 0x06 +j_arr_src14: + ; DS 32 + db 0x80, 0x01, 0xc0, 0x03, 0x20, 0x04, 0x60, 0x06 + db 0xa0, 0x05, 0xc0, 0x03, 0x80, 0x01, 0xc0, 0x03 + db 0xa0, 0x05, 0x50, 0x0A, 0x40, 0x02, 0x40, 0x02 + db 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x30, 0x0C +j_arr_src15: + ; DS 32 + db 0x00, 0x03, 0x80, 0x07, 0x40, 0x08, 0xc0, 0x0C + db 0x40, 0x0b, 0x80, 0x07, 0x00, 0x03, 0x80, 0x07 + db 0x40, 0x0b, 0xa0, 0x14, 0x80, 0x04, 0x80, 0x04 + db 0x40, 0x08, 0x40, 0x08, 0x40, 0x08, 0x60, 0x18 +j_arr_src16: + ; DS 32 + db 0x00, 0x06, 0x00, 0x0f, 0x80, 0x10, 0x80, 0x19 + db 0x80, 0x16, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0f + db 0x80, 0x16, 0x40, 0x29, 0x00, 0x09, 0x00, 0x09 + db 0x80, 0x10, 0x80, 0x10, 0x80, 0x10, 0xc0, 0x30 + +j_arr_src17: + ; DS 32 + db 0x00, 0x0C, 0x00, 0x1E, 0x00, 0x21, 0x00, 0x33 + db 0x00, 0x2D, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x1E + db 0x00, 0x2D, 0x80, 0x52, 0x00, 0x12, 0x00, 0x12 + db 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x80, 0x61 + +j_arr_src18: + ; DS 32 + db 0x00, 0x18, 0x00, 0x3C, 0x00, 0x42, 0x00, 0x66 + db 0x00, 0x5A, 0x00, 0x3C, 0x00, 0x18, 0x00, 0x3C + db 0x00, 0x5A, 0x00, 0xA5, 0x00, 0x24, 0x00, 0x24 + db 0x00, 0x42, 0x00, 0x42, 0x00, 0x42, 0x00, 0xc3 + +j_player_tlt_c1: + ; frame: 0 + db 0x38, 0x00, 0x7C, 0x00, 0xB6, 0x00, 0x93, 0x00 + db 0x5C, 0x00, 0x3C, 0x00, 0x19, 0x00, 0x7A, 0x00 + db 0x5C, 0x00, 0x57, 0x00, 0x11, 0x00, 0x11, 0x00 + db 0x21, 0x00, 0x41, 0x00, 0x80, 0x00, 0x80, 0x00 + + ; frame: 1 + db 0xe0, 0x00, 0xf0, 0x01, 0xD8, 0x02, 0x4C, 0x02 + db 0x70, 0x01, 0xf0, 0x00, 0x62, 0x00, 0xF4, 0x01 + db 0xE8, 0x00, 0x50, 0x00, 0x48, 0x06, 0x44, 0x01 + db 0x82, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00 + + ; frame: 2 + db 0x80, 0x03, 0xc0, 0x07, 0x60, 0x0b, 0x30, 0x09 + db 0xc0, 0x05, 0xc0, 0x03, 0x80, 0x01, 0xc0, 0x01 + db 0xc0, 0x01, 0xf0, 0x01, 0x80, 0x01, 0x80, 0x01 + db 0x80, 0x07, 0x00, 0x05, 0x00, 0x01, 0x80, 0x01 + + ; frame: 3 + db 0x00, 0x0e, 0x00, 0x1F, 0x80, 0x2D, 0xc0, 0x24 + db 0x00, 0x17, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0f + db 0x80, 0x16, 0x40, 0x26, 0x00, 0x15, 0x80, 0x04 + db 0x00, 0x09, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x20 + +j_player_tlt_c0: + ; frame: 0 + db 0x38, 0x00, 0x7C, 0x00, 0xB6, 0x00, 0x93, 0x00 + db 0x5C, 0x00, 0x3C, 0x00, 0x19, 0x00, 0x7A, 0x00 + db 0x5C, 0x00, 0x57, 0x00, 0x11, 0x00, 0x11, 0x00 + db 0x21, 0x00, 0x41, 0x00, 0x80, 0x00, 0x80, 0x00 + + ; frame: 1 + db 0xe0, 0x00, 0xf0, 0x01, 0xD8, 0x02, 0x4C, 0x02 + db 0x70, 0x01, 0xf0, 0x00, 0x62, 0x00, 0xF4, 0x01 + db 0xE8, 0x00, 0x50, 0x00, 0x48, 0x06, 0x44, 0x01 + db 0x82, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00 + + ; frame: 2 + db 0x80, 0x03, 0xc0, 0x07, 0x60, 0x0b, 0x30, 0x09 + db 0xc0, 0x05, 0xc0, 0x03, 0x80, 0x01, 0xc0, 0x01 + db 0xc0, 0x01, 0xf0, 0x01, 0x80, 0x01, 0x80, 0x01 + db 0x80, 0x07, 0x00, 0x05, 0x00, 0x01, 0x80, 0x01 + + ; frame: 3 + db 0x00, 0x0e, 0x00, 0x1F, 0x80, 0x2D, 0xc0, 0x24 + db 0x00, 0x17, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0f + db 0x80, 0x16, 0x40, 0x26, 0x00, 0x15, 0x80, 0x04 + db 0x00, 0x09, 0x00, 0x0A, 0x00, 0x11, 0x00, 0x20 + +j_player_trt_c1: + ; Frame 0 + db 0x70, 0x00, 0xF8, 0x00, 0xb4, 0x01, 0x24, 0x03 + db 0xE8, 0x00, 0xf0, 0x00, 0x60, 0x02, 0x78, 0x01 + db 0xE8, 0x00, 0xA8, 0x03, 0x20, 0x02, 0x20, 0x02 + db 0x10, 0x02, 0x08, 0x06, 0x04, 0x00, 0x04, 0x00 + + ; Frame 1 + db 0xc0, 0x01, 0xe0, 0x03, 0xD0, 0x06, 0x90, 0x0C + db 0xa0, 0x03, 0xc0, 0x03, 0x80, 0x11, 0xe0, 0x0b + db 0xc0, 0x05, 0x80, 0x02, 0x98, 0x04, 0xa0, 0x08 + db 0x40, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x30 + + ; Frame 2 + db 0x00, 0x07, 0x80, 0x0f, 0x40, 0x1B, 0x40, 0x32 + db 0x80, 0x0e, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0e + db 0x00, 0x0e, 0x00, 0x3E, 0x00, 0x06, 0x00, 0x06 + db 0x80, 0x07, 0x80, 0x02, 0x00, 0x02, 0x00, 0x06 + + ; Frame 3 + db 0x00, 0x1C, 0x00, 0x3E, 0x00, 0x6D, 0x00, 0xc9 + db 0x00, 0x3A, 0x00, 0x1C, 0x00, 0x18, 0x00, 0x3C + db 0x00, 0x5A, 0x00, 0x99, 0x00, 0x2A, 0x00, 0x48 + db 0x00, 0x24, 0x00, 0x14, 0x00, 0x22, 0x00, 0x01 + +j_player_trt_c0: + ; Frame 0 + db 0x70, 0x00, 0xF8, 0x00, 0xb4, 0x01, 0x24, 0x03 + db 0xE8, 0x00, 0xf0, 0x00, 0x60, 0x02, 0x78, 0x01 + db 0xE8, 0x00, 0xA8, 0x03, 0x20, 0x02, 0x20, 0x02 + db 0x10, 0x02, 0x08, 0x06, 0x04, 0x00, 0x04, 0x00 + + ; Frame 1 + db 0xc0, 0x01, 0xe0, 0x03, 0xD0, 0x06, 0x90, 0x0C + db 0xa0, 0x03, 0xc0, 0x03, 0x80, 0x11, 0xe0, 0x0b + db 0xc0, 0x05, 0x80, 0x02, 0x98, 0x04, 0xa0, 0x08 + db 0x40, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x30 + + ; Frame 2 + db 0x00, 0x07, 0x80, 0x0f, 0x40, 0x1B, 0x40, 0x32 + db 0x80, 0x0e, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x0e + db 0x00, 0x0e, 0x00, 0x3E, 0x00, 0x06, 0x00, 0x06 + db 0x80, 0x07, 0x80, 0x02, 0x00, 0x02, 0x00, 0x06 + + ; Frame 3 + db 0x00, 0x1C, 0x00, 0x3E, 0x00, 0x6D, 0x00, 0xc9 + db 0x00, 0x3A, 0x00, 0x1C, 0x00, 0x18, 0x00, 0x3C + db 0x00, 0x5A, 0x00, 0x99, 0x00, 0x2A, 0x00, 0x48 + db 0x00, 0x24, 0x00, 0x14, 0x00, 0x22, 0x00, 0x01 + + ; Death player +j_play_death_c0: + ; DS 32 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x0f + db 0xc0, 0x16, 0x60, 0x12, 0x80, 0x1B, 0x80, 0x07 + db 0x10, 0x07, 0x28, 0x0b, 0x44, 0x13, 0x83, 0x23 +j_play_death_c1: + ; DS 32 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x0f + db 0xc0, 0x16, 0x60, 0x12, 0x80, 0x1B, 0x80, 0x07 + db 0x10, 0x07, 0x28, 0x0b, 0x44, 0x13, 0x83, 0x23 + + ; Emty array to erase player plane 0 +j_player_era_c0: + ds 32, 0 + + ; Emty array to erase player plane 1 +j_player_era_c1: + ds 32, 0 + + ; Treashure chest 24x24 pix + ; color bit 1 +j_chest_c1: + ; Col: 0 + db 0x00, 0x00, 0x3F, 0x00, 0xe0, 0x13, 0x00, 0x7C + db 0x0C, 0x80, 0x8F, 0x07, 0xf0, 0xc1, 0x03, 0x98 + db 0xC0, 0x01, 0x44, 0xc0, 0x00, 0x22, 0x40, 0x00 + ; Col: 1 + db 0x11, 0xFE, 0x0F, 0x09, 0xFF, 0xFF, 0xC5, 0xFF + db 0xBF, 0xF3, 0xFF, 0x87, 0xF1, 0xFF, 0xc0, 0xFD + db 0x3F, 0x86, 0xFF, 0x0f, 0x99, 0x03, 0x86, 0xa0 + ; Col: 2 + db 0x23, 0x46, 0x92, 0x53, 0x26, 0x88, 0x8B, 0xC6 + db 0x84, 0x23, 0x07, 0xE3, 0x8B, 0x16, 0x1C, 0x53 + db 0x86, 0x03, 0x23, 0x66, 0x00, 0xFF, 0x17, 0x00 + + ; treashure chest color bit 0 +j_chest_c0: + ; Col: 0 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ; Col: 1 + db 0x00, 0xfe, 0x0f, 0x00, 0xFF, 0x3F, 0xc0, 0xFF + db 0x07, 0xf0, 0xFF, 0x00, 0xf0, 0x3F, 0x00, 0xFC + db 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ; Col: 2 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + +j_gravecross_c0: + ;db[16] + db 0x18, 0x18, 0x18, 0x18, 0x7E, 0x7E, 0x18, 0x18 + db 0x58, 0x38, 0x1C, 0x1A, 0x18, 0x18, 0x18, 0x18 + +j_gravecross_c1: + ds 16,0 + +player_turn_frame: + db 0 + +player_tf2: + db 0x00 + +lvl_mrg_ctr: + db 0x00 + +j_monster_off: + db 0 + +j_lifes_param: + db 1 + +skip_frames: + db 0x1 + +random_w: + dw 0x13C6 +j_addr_75: + dw 0xC0D8 + +j_lvl_draw_addr: + dw 0xC0B8 + +j_player_addr: + dw 0xC0C8 +j_chest_addr: + dw 0xC400 + +first_lvl0_addr: + ; pg0 + db 0x3F, 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0x3F, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + ; pg1 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0xc0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xc0, 0xFF + + ; pg2 + db 0xFF, 0x3F, 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0x3F + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + ; pg3 + ds 32, 0 + + ; pg4 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0x3F, 0x00, 0x00 + db 0xc0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00 + + ; pg5 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0xBF + +last_lvl0_addr EQU $-1 + +full_lvl_size EQU last_lvl0_addr-first_lvl0_addr+1 + +first_lvl1_addr: + ; pg0 + db 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ; pg1 + ds 32, 0 + ; pg2 + ds 32,0 + ; pg3 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0xFC, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC + db 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0xFF + db 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ; pg4 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC + ; pg5 + db 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + db 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x03 + +last_lvl1_addr EQU $-1 + + + +lvl_merged_0: + ; DS 32 + db 0xc0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xc0, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + +lvl_merged_1: + ; DS 32 + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0x3F, 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0x3F, 0x00 + +lvl_merged_2: + ; DS 32 + db 0x00, 0xc0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xc0 + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + +lvl_merged_3: + ; DS 32 + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x03 + db 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x03, 0x00, 0x00 + db 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + +lvl_merged_4: + ; DS 32 + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xc0, 0xFF, 0xFF + db 0x3F, 0x00, 0x00, 0xc0, 0xFF, 0xFF, 0xFF, 0x03 + +lvl_merged_5: + ; DS 32 + db 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + db 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x40 diff --git a/MON_r8_9c6c6546/equates.inc b/MON_r8_9c6c6546/equates.inc index 52d0122..971e34d 100644 --- a/MON_r8_9c6c6546/equates.inc +++ b/MON_r8_9c6c6546/equates.inc @@ -144,7 +144,7 @@ MAX_MOD EQU 0x0F FCB_INFO_LEN EQU 15 ; length of FCB info bytes to match ;NXT_REC EQU 0x20 ; ------------------------------------------------------ -PIC_POLL_MODE EQU 0x0A +PIC_POLL_MODE EQU 0b00001010 PORT_C4 EQU 0x10 PRINTER_ACK EQU 0x10 PRINTER_IRQ EQU 0x08 diff --git a/MON_r8_9c6c6546/monitor.asm b/MON_r8_9c6c6546/monitor.asm index 4c423a0..ec8314d 100644 --- a/MON_r8_9c6c6546/monitor.asm +++ b/MON_r8_9c6c6546/monitor.asm @@ -135,16 +135,16 @@ m_start: OUT (TMR_DD70C2), A .conf_pic: ; Config PIC - LD A,00010010b ; ICW1 edge trigger, interval 8, sin... + LD A,00010010b ; ICW1 edge trigger, interval 8, single, no ICW4 OUT (PIC_DD75RS), A XOR A - OUT (PIC_DD75RM), A ; ICW2 + OUT (PIC_DD75RM), A ; ICW2 Interrupt vector address CPL OUT (PIC_DD75RM), A ; ICW3 no slave LD A,00100000b OUT (PIC_DD75RS), A ; Non-specific EOI command, End of I... - LD A, PIC_POLL_MODE - OUT (PIC_DD75RS), A ; Poll mode, poll on next RD + LD A, PIC_POLL_MODE ; 00001010 + OUT (PIC_DD75RS), A ; Poll mode, Read IRR by next #RD LD A, 0x80 OUT (KBD_DD78PC), A ; TODO: - Check using this 7th bit diff --git a/Mon_r9/monitor.asm b/Mon_r9/monitor.asm index 96b327c..5f83096 100644 --- a/Mon_r9/monitor.asm +++ b/Mon_r9/monitor.asm @@ -24,29 +24,29 @@ ; Monitor Entry points ; ------------------------------------------------------ -mon_start: JP m_start ; E000 -mon_hexb: JP m_hexb ; E003 -non_con_status: JP m_con_status ; E006 -mon_con_in: JP m_con_in ; E009 -mon_con_out: JP m_con_out ; E00C -mon_serial_in: JP m_serial_in ; E00F -mon_serial_out: JP m_serial_out ; E012 -mon_char_print: JP m_char_print ; E015 -mon_tape_read: JP m_tape_read ; E018 -mon_tape_write: JP m_tape_write ; E01B -mon_ram_disk_read: JP m_ramdisk_read ; E01E -mon_ram_disk_write: JP m_ramdisk_write ; E021 -mon_tape_read_ram: JP m_tape_read_ram2 ; E024 -mon_tape_write_ram: JP m_tape_write_ram2 ; E027 -mon_tape_wait: JP m_tape_wait ; E02A -mon_tape_detect: JP m_tape_blk_detect ; E02D -mon_read_floppy: JP m_read_floppy ; E030 -mon_write_floppy: JP m_write_floppy ; E033 -mon_out_str_z: JP m_out_strz ; E036 - JP m_fn_39 ; E039 - JP get_image_hdr ; E03C +mon_start: JP sys_init ; E000 +mon_hexb: JP print_hex_byte ; E003 +non_con_status: JP con_status ; E006 +mon_con_in: JP con_getchar ; E009 +mon_con_out: JP con_putchar ; E00C +mon_serial_in: JP uart_recv ; E00F +mon_serial_out: JP uart_send ; E012 +mon_char_print: JP printer_putchar ; E015 +mon_tape_read: JP tape_read_block ; E018 +mon_tape_write: JP tape_write_block ; E01B +mon_ram_disk_read: JP ramdisk_read ; E01E +mon_ram_disk_write: JP ramdisk_write ; E021 +mon_tape_read_ram: JP tape_read_ramdisk ; E024 +mon_tape_write_ram: JP tape_write_ramdisk ; E027 +mon_tape_wait: JP tape_wait_signal ; E02A +mon_tape_detect: JP tape_detect_pause ; E02D +mon_read_floppy: JP fdc_read_sector ; E030 +mon_write_floppy: JP fdc_write_sector ; E033 +mon_out_str_z: JP con_print_strz ; E036 + JP esc_image_merge ; E039 + JP esc_get_image_hdr ; E03C JP esc_picture ; E03F - JP m_print_at_xy ; E042 + JP gfx_print_at_xy ; E042 JP esc_draw_fill_rect ; E045 JP esc_paint ; E048 JP esc_draw_line ; E04B @@ -75,7 +75,7 @@ mon_out_str_z: JP m_out_strz ; E036 ; ------------------------------------------------------ ; Init system devices ; ------------------------------------------------------ -m_start: +sys_init: DI LD A, 10000000b ; DD17 all ports to out OUT (SYS_DD17CTR), A ; VV55 Sys CTR @@ -172,36 +172,36 @@ m_start: ; Init cursor LD SP, M_VARS.stack1 - CALL m_draw_cursor + CALL cursor_draw ; Beep LD C, ASCII_BELL - CALL m_con_out + CALL con_putchar LD A, (BIOS.boot_f) CP JP_OPCODE JP Z, BIOS.boot_f - LD HL, mgs_system_nf - CALL m_out_strz - JP m_sys_halt + LD HL, msg_system_not_found + CALL con_print_strz + JP sys_halt ; -------------------------------------------------- ; Output ASCIIZ string ; Inp: HL -> string ; -------------------------------------------------- -m_out_strz: +con_print_strz: LD C, (HL) LD A, C OR A RET Z - CALL m_con_out + CALL con_putchar INC HL - JP m_out_strz + JP con_print_strz -mgs_system_nf: +msg_system_not_found: DB "\r\nSYSTEM NOT FOUND\r\n", 0 -m_sys_halt: +sys_halt: HALT ; ------------------------------------------------------ @@ -209,7 +209,7 @@ m_sys_halt: ; Out: A = 0 - not ready ; A = 0xFF - ready (key pressed) ; ------------------------------------------------------ -m_con_status: +con_status: IN A, (PIC_DD75RS) ; Read PIC status NOP AND KBD_IRQ ; Check keyboard request RST1 @@ -222,10 +222,10 @@ m_con_status: ; Wait and read data from UART ; Out: A - 7 bit data ; ------------------------------------------------------ -m_serial_in: +uart_recv: IN A, (UART_DD72RR) AND RX_READY - JP Z, m_serial_in ; wait for rx data ready + JP Z, uart_recv ; wait for rx data ready IN A, (UART_DD72RD) AND 0x7f ; leave 7 bits RET @@ -234,10 +234,10 @@ m_serial_in: ; Read key ; Out: A ; ------------------------------------------------------ -m_con_in: - CALL m_con_status +con_getchar: + CALL con_status OR A - JP Z, m_con_in ; wait key + JP Z, con_getchar ; wait key IN A, (KBD_DD78PA) ; get key ;AND 0x7f ; reset hi bit, leave 0..127 code ; NOP @@ -259,10 +259,10 @@ m_con_in: ; Send data by UART ; Inp: C - data to transmitt ; ------------------------------------------------------ -m_serial_out: +uart_send: IN A, (UART_DD72RR) AND TX_READY - JP Z, m_serial_out ; Wait for TX ready + JP Z, uart_send ; Wait for TX ready LD A, C OUT (UART_DD72RD), A RET @@ -271,11 +271,11 @@ m_serial_out: ; Send character to printer ; Inp: C - character ; ------------------------------------------------------ -m_char_print: +printer_putchar: ; wait printer ready IN A, (PIC_DD75RS) AND PRINTER_IRQ - JP Z, m_char_print + JP Z, printer_putchar LD A, C NOP @@ -298,11 +298,11 @@ m_char_print: ; Out char to console ; Inp: C - char ; ------------------------------------------------------ -m_con_out: +con_putchar: PUSH HL PUSH DE PUSH BC - CALL m_con_out_int + CALL con_putchar_impl POP BC POP DE POP HL @@ -311,19 +311,19 @@ m_con_out: ; ------------------------------------------------------ ; Out char C to console ; ------------------------------------------------------ -m_con_out_int: +con_putchar_impl: LD DE, M_VARS.esc_mode LD A, (DE) DEC A OR A ; TODO: unused (save 1b 4t) - JP M, m_print_no_esc ; esc_mode=0 - standart print no ESC mode - JP NZ, m_print_at_xy ; esc_mode=2 (graphics) + JP M, con_putchar_normal ; esc_mode=0 - standart print no ESC mode + JP NZ, gfx_print_at_xy ; esc_mode=2 (graphics) ; handle ESC param (esc_mode=1) INC E ; INC DE LD A, (DE) OR A - JP P, get_esc_param + JP P, esc_collect_param LD A, C AND 0xf ; convert char to command code LD (DE), A @@ -332,7 +332,7 @@ m_con_out_int: LD (DE), A RET -get_esc_param: +esc_collect_param: LD HL, M_VARS.esc_cmd LD B, (HL) ; TODO: replace to INC L L=0xd4 save 2t INC L ; HL -> param count @@ -378,20 +378,20 @@ get_esc_param: EX DE, HL ; It is 1..4 func DRAW_* func? CP 0x4 - JP P, esc_no_draw_fn + JP P, esc_check_gfx_mode LD A, (M_VARS.screen_mode) AND 00000011b ; If not in graphics mode - exit - JP NZ, esc_exit + JP NZ, esc_reset_mode -esc_no_draw_fn: - LD DE, esc_exit +esc_check_gfx_mode: + LD DE, esc_reset_mode PUSH DE ; Jump to ESC func handler JP (HL) -esc_exit: +esc_reset_mode: XOR A LD (M_VARS.esc_mode), A RET @@ -458,35 +458,35 @@ esc_print_screen: AND 00000011b RET NZ ; ret if not 0-3 mode LD DE, 0x30ff - CALL m_print_hor_line + CALL printer_print_hline DEC E LD D, 0xf0 .chk_keys: - CALL m_con_status + CALL con_status OR A JP Z, .no_keys - CALL m_con_in + CALL con_getchar CP ASCII_ESC RET Z .no_keys: - CALL m_print_hor_line + CALL printer_print_hline DEC E JP NZ, .chk_keys LD D, 0xe0 ; 224d - CALL m_print_hor_line + CALL printer_print_hline RET ; ------------------------------------------------------ ; Print line to printer ; D - width ; ------------------------------------------------------ -m_print_hor_line: +printer_print_hline: LD HL, cmd_esc_set_X0 ; Set printer X coordinate = 0 - CALL m_print_cmd + CALL printer_send_cmd LD HL, 4 LD (M_VARS.ul_var0), HL ; Set start coord X = 4 LD B, H ; LD B, 0x0 @@ -494,9 +494,9 @@ m_print_hor_line: .print_next_col: LD C, 0x0 ; 1 - CALL m_get_7vpix + CALL screen_get_7vpix AND D - CALL NZ, m_print_vert_7pix + CALL NZ, printer_print_7vpix LD HL, (M_VARS.ul_var0) INC HL @@ -504,9 +504,9 @@ m_print_hor_line: LD (M_VARS.ul_var0), HL LD C, 0x1 ; 2 - CALL m_get_7vpix + CALL screen_get_7vpix AND D - CALL NZ, m_print_vert_7pix + CALL NZ, printer_print_7vpix LD HL, (M_VARS.ul_var0) INC HL ; inc X @@ -516,21 +516,21 @@ m_print_hor_line: CP 236 JP C, .print_next_col LD HL, cmd_esc_inc_Y2 - CALL m_print_cmd + CALL printer_send_cmd RET ; ------------------------------------------------------ ; Send command to printer ; Inp: HL -> command bytes array ; ------------------------------------------------------ -m_print_cmd: +printer_send_cmd: PUSH BC .print_nxt: LD A, (HL) CP ESC_CMD_END JP Z, .cmd_end LD C, A - CALL m_char_print + CALL printer_putchar INC HL JP .print_nxt .cmd_end: @@ -541,23 +541,23 @@ m_print_cmd: ; Print 7 vertical pixels to printer ; Inp: A - value to print ; ------------------------------------------------------ -m_print_vert_7pix: +printer_print_7vpix: PUSH AF ; Set coordinate X to 0 LD HL, cmd_esc_set_X - CALL m_print_cmd + CALL printer_send_cmd LD HL, (M_VARS.ul_var0) LD C, H - CALL m_char_print + CALL printer_putchar LD C, L - CALL m_char_print + CALL printer_putchar ; Set column print mode LD HL, cmd_esc_print_col - CALL m_print_cmd + CALL printer_send_cmd POP AF ; Print 7 vertical pixels LD C, A - CALL m_char_print + CALL printer_putchar RET ; ------------------------------------------------------ @@ -575,7 +575,7 @@ cmd_esc_inc_Y2: cmd_esc_set_X0: DB ASCII_ESC DB 'X' - DB 0h ; 0..479 + DB 0h ; 0..479 DB 0h DB ESC_CMD_END @@ -598,10 +598,10 @@ cmd_esc_print_col: ; Inp: C - sheet ; Out: A - byte ; ------------------------------------------------------ -m_get_7vpix: +screen_get_7vpix: LD A, (M_VARS.row_shift) ADD A, B - ADD A, 19 ; skip first 20pix + ADD A, 19 ; skip first 20pix LD L, A PUSH DE PUSH BC @@ -683,7 +683,7 @@ esp_no_colr: esc_set_charset: LD A, (M_VARS.esc_param) - AND 0x3 ; charset 0..3 + AND 0x3 ; charset 0..3 LD (M_VARS.codepage), A RET @@ -692,7 +692,7 @@ esc_set_charset: ; Inp: A - ascii code ; Out: HL -> glyph offset ; ------------------------------------------------------ -m_get_glyph: +font_get_glyph: LD L, A ; L = ascii code LD E, A ; E = ascii code XOR A @@ -704,7 +704,7 @@ m_get_glyph: ADD HL, HL ADD HL, DE ; HL = A * 7 - LD A, E ; A = A at proc entry + LD A, E ; A = A at proc entry CP '@' ; First 64 symbols is same for all codepages JP M, .cp_common @@ -734,18 +734,18 @@ m_get_glyph: ; Console output ; Inp: C - char ; -------------------------------------------------- -m_print_no_esc: +con_putchar_normal: LD A, C AND 0x7f ; C = 0..127 ASCII code CP ASCII_SP ; C < ' '? - JP M, m_handle_esc_code ; jump if less - CALL m_get_glyph + JP M, con_handle_esc ; jump if less + CALL font_get_glyph EX DE, HL LD A, (M_VARS.screen_mode) AND 0x3 - JP NZ, mp_mode_64 ; jump to non color modes + JP NZ, con_putchar_64col ; jump to non color modes - CALL calc_addr_40 + CALL vram_addr_40col INC L ; Access to VRAM LD A, 0x1 @@ -845,7 +845,7 @@ m_print_no_esc: OUT (SYS_DD17PB), A ; draw cursor on return - LD HL, m_draw_cursor + LD HL, cursor_draw PUSH HL LD HL, M_VARS.cursor_row @@ -853,7 +853,7 @@ m_print_no_esc: ; Handle ASCII_CAN (cursor right) ; Inp: HL - cursor pos ; -------------------------------------------------- -m40_rt: +cur40_right: INC HL LD A, (HL) ; a = col ADD A, 1 ; col+1 @@ -863,24 +863,24 @@ m40_rt: DEC HL RET M ; Return if no wrap -m40_wrap_rt: +cur40_wrap_right: INC HL XOR A LD (HL), A DEC HL LD A, (M_VARS.screen_mode) AND 0x08 ; screen_mode=8? - JP NZ, m2_lf + JP NZ, cur20_down ; -------------------------------------------------- ; Handle ASCII_LF (cursor down) ; Inp: HL - cursor pos ; -------------------------------------------------- -m40_lf: +cur40_down: LD A, (HL) ADD A, 10 CP 248 - JP NC, scroll_up + JP NC, screen_scroll_up LD (HL), A RET @@ -888,7 +888,7 @@ m40_lf: ; Handle ASCII_BS (cursor left) ; Inp: HL - cursor pos ; -------------------------------------------------- -m40_bksp: +cur40_left: INC HL LD A, (HL) DEC A @@ -909,7 +909,7 @@ m40_bksp: ; Handle ASCII_EM (cursor up) ; Inp: HL - cursor pos ; -------------------------------------------------- -m40_up: +cur40_up: LD A, (HL) SUB 10 ; 10 rows per symbol JP NC, .up_no_minus @@ -922,7 +922,7 @@ m40_up: ; Handle ASCII_TAB (cursor right 8 pos) 20rows mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m20_tab: +cur20_tab: INC HL LD A, (HL) ADD A, 8 @@ -931,12 +931,12 @@ m20_tab: CP 40 DEC HL RET M ; ret if column <40 - JP m40_wrap_rt ; or wrap to next line + JP cur40_wrap_right ; or wrap to next line ; -------------------------------------------------- ; Calculate VRAM address in 40 column mode ; -------------------------------------------------- -calc_addr_40: +vram_addr_40col: LD HL, (M_VARS.cursor_row) LD A, (M_VARS.row_shift) ADD A, L @@ -970,7 +970,7 @@ calc_addr_40: LD (M_VARS.esc_var0),A RET -m2_lf: +cur20_down: LD A, (HL) ADD A, 10 CP 15 @@ -1030,7 +1030,7 @@ m2_lf: ; --------------------------------------------------- ; Handle ASCII_BS (cursor left) in 20row mode ; --------------------------------------------------- -m20_bksp: +cur20_left: INC HL LD A, (HL) OR A @@ -1047,9 +1047,9 @@ m20_bksp: ; --------------------------------------------------- ; Print symbol in 64x25 mode ; --------------------------------------------------- -mp_mode_64: +con_putchar_64col: CP 3 ; - JP Z, mp_mode_80 ; jump for screen_mode=3 + JP Z, con_putchar_80col ; jump for screen_mode=3 ; calc symbol address in VRAM LD HL, (M_VARS.cursor_row) LD A, (M_VARS.row_shift) @@ -1082,7 +1082,7 @@ mp_mode_64: LD A, 0x0 OUT (SYS_DD17PB), A ; draw cursor at end - LD HL, m_draw_cursor + LD HL, cursor_draw PUSH HL LD HL, M_VARS.cursor_row @@ -1090,7 +1090,7 @@ mp_mode_64: ; Handle ASCII_CAN (cursor right) in 64x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m64_rt: +cur64_right: INC HL LD A, (HL) ADD A, 1 @@ -1103,18 +1103,18 @@ m64_rt: ; Handle ASCII_LF (cursor down) in 64x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m64_lf: +cur64_down: LD A, (HL) ADD A, 10 CP 248 - JP NC, scroll_up + JP NC, screen_scroll_up LD (HL), A RET ; -------------------------------------------------- ; Scroll Up for 10 rows ; -------------------------------------------------- -scroll_up: +screen_scroll_up: LD A, (M_VARS.row_shift) ADD A, 10 OUT (SYS_DD17PA), A ; Scroll via VShift register @@ -1155,7 +1155,7 @@ scroll_up: ; Handle ASCII_BS (cursor left) in 64x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m64_bs: +cur64_left: INC HL LD A, (HL) DEC A @@ -1170,7 +1170,7 @@ m64_bs: ; Handle ASCII_EM (cursor up) in 64x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m64_up: +cur64_up: LD A, (HL) SUB 10 JP NC, .no_wrap @@ -1184,7 +1184,7 @@ m64_up: ; Handle ASCII_TAB (cursor column + 8) in 64x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m64_tab: +cur64_tab: INC HL LD A, (HL) ADD A, 8 @@ -1193,13 +1193,13 @@ m64_tab: DEC HL RET NZ ; return if no wrap ; cursor down if wrap - JP m64_lf + JP cur64_down ; -------------------------------------------------- ; Print symbols in 80x25 mode ; -------------------------------------------------- -mp_mode_80: - CALL calc_addr_80 +con_putchar_80col: + CALL vram_addr_80col ; Access to VRAM LD A, 0x1 OUT (SYS_DD17PB), A @@ -1306,7 +1306,7 @@ mp_mode_80: LD A, 0x0 OUT (SYS_DD17PB), A ; Draw cursor after symbol - LD HL, m_draw_cursor + LD HL, cursor_draw PUSH HL LD HL, M_VARS.cursor_row @@ -1314,7 +1314,7 @@ mp_mode_80: ; Handle ASCII_CAN (cursor right) in 80x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m80_rt: +cur80_right: INC HL LD A, (HL) ADD A, 1 ; inc column @@ -1324,7 +1324,7 @@ m80_rt: DEC HL RET M ; return if no wrap -m80_col_wrap: +cur80_wrap_right: INC HL XOR A LD (HL), A @@ -1335,11 +1335,11 @@ m80_col_wrap: ; Handle ASCII_LF (cursor down) in 80x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m80_lf: +cur80_down: LD A, (HL) ADD A, 10 CP 248 - JP NC, scroll_up + JP NC, screen_scroll_up LD (HL), A RET @@ -1347,7 +1347,7 @@ m80_lf: ; Handle ASCII_BS (cursor left) in 80x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m80_bs: +cur80_left: INC HL LD A, (HL) DEC A @@ -1368,7 +1368,7 @@ m80_bs: ; Handle ASCII_EM (cursor up) in 80x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m80_up: +cur80_up: LD A, (HL) SUB 10 JP NC, .no_wrap @@ -1382,7 +1382,7 @@ m80_up: ; Handle ASCII_TAB (cursor column + 8) in 80x25 mode ; Inp: HL - cursor pos ; -------------------------------------------------- -m80_tab: +cur80_tab: INC HL LD A, (HL) ADD A, 8 @@ -1391,14 +1391,14 @@ m80_tab: CP 80 DEC HL RET M ; return if no cursor wrap - JP m80_col_wrap + JP cur80_wrap_right ; -------------------------------------------------- ; Calculate address for cursor pos for 80x25 mode ; Out: HL -> VRAM ; B -> pixel pos in byte ; -------------------------------------------------- -calc_addr_80: +vram_addr_80col: LD HL, (M_VARS.cursor_row) LD A, (M_VARS.row_shift) ADD A, L @@ -1434,10 +1434,10 @@ mns_ep_fm_0: ; Clear screen and set cursor to 0,0 ; Inp: HL -> cursor position ; -------------------------------------------------- -m_clear_screen: +screen_clear: LD A, (M_VARS.screen_mode) AND 0x8 - JP NZ, m_clear_20_rows ; for bit 4 is set, clear only 20 rows + JP NZ, screen_clear_20rows ; for bit 4 is set, clear only 20 rows ; all in black LD A, 01111111b OUT (VID_DD67PB), A ; C/M=1 FL=111 CL=111 All black @@ -1475,7 +1475,7 @@ m_clear_screen: ; Set cursor to 0,0 and close VRAM access ; Inp: HL -> cursor_row ; -------------------------------------------------- -m_cursor_home: +cursor_home: XOR A NOP NOP @@ -1491,7 +1491,7 @@ m_cursor_home: RET ; Clear only 20 rows -m_clear_20_rows: +screen_clear_20rows: ; take row shift in account LD A, (M_VARS.row_shift) LD L, A @@ -1502,27 +1502,27 @@ m_clear_20_rows: OUT (SYS_DD17PB), A .next_row: - LD H, 0x40 ; HL = 0x4000 + shift_row - LD B, 64 ; 64 bytes at row + LD H, 0x40 ; HL = 0x4000 + shift_row + LD B, 64 ; 64 bytes at row XOR A .next_col: LD (HL), A - INC H ; next column + INC H ; next column DEC B JP NZ, .next_col - INC L ; next row + INC L ; next row DEC C JP NZ, .next_row ; Disabe VRAM access LD A, 0 OUT (SYS_DD17PB), A - JP m_cursor_home + JP cursor_home ; -------------------------------------------------- ; Draw cursor at current cursor position ; if not hidden ; -------------------------------------------------- -m_draw_cursor: +cursor_draw: LD A, (M_VARS.screen_mode) AND 0x4 ; check hidden cursor bit RET NZ ; return if hidden @@ -1539,7 +1539,7 @@ m_draw_cursor: PUSH HL EX DE, HL - CALL calc_addr_40 + CALL vram_addr_40col ; Access to VRAM LD A, 0x1 OUT (SYS_DD17PB), A @@ -1653,7 +1653,7 @@ m_draw_cursor: RET P ; return if column > 80 PUSH HL - CALL calc_addr_80 + CALL vram_addr_80col LD C, 7 ; cursor size INC L @@ -1673,7 +1673,7 @@ m_draw_cursor: JP Z, .dc_2_byte LD B, 0x7c DEC H - ;JP .dc_1_byte ; TODO: unused + ;JP .dc_1_byte ; TODO: unused .dc_1_byte: ; xor with VRAM byte @@ -1712,46 +1712,46 @@ m_draw_cursor: ; If ESC character, turn esc_mode ON ; Inp: A - ASCII symbol ; -------------------------------------------------- -m_handle_esc_code: +con_handle_esc: CP ASCII_ESC - JP NZ, m_handle_control_code + JP NZ, con_handle_ctrl ; turn on ESC mode for next chars LD HL, M_VARS.esc_mode - LD (HL), 0x1 ; turn on ESC mode + LD (HL), 0x1 ; turn on ESC mode INC HL - LD (HL), 0xff ; esc_cmd = 0xff + LD (HL), 0xff ; esc_cmd = 0xff RET ; -------------------------------------------------- ; Handle one byte ASCII control code ; Inp: A - ASCII symbol ; -------------------------------------------------- -m_handle_control_code: +con_handle_ctrl: CP ASCII_BELL - JP Z, m_beep - LD HL, m_draw_cursor + JP Z, speaker_beep + LD HL, cursor_draw PUSH HL LD HL, M_VARS.cursor_row PUSH AF - CALL m_draw_cursor + CALL cursor_draw LD A, (M_VARS.screen_mode) - AND 0x08 ; 20-rows mode? - JP Z, handle_cc_common ; jump for normal screen modes + AND 0x08 ; 20-rows mode? + JP Z, ctrl_handle_std ; jump for normal screen modes ; for hidden cursor modes POP AF - CP ASCII_TAB ; TAB - JP Z, m20_tab - CP ASCII_BS ; BKSP - JP Z, m20_bksp - CP ASCII_CAN ; Cancel - JP Z, m40_rt - CP ASCII_US ; ASCII Unit separator - JP Z, m_clear_20_rows - CP ASCII_LF ; LF - JP Z, m2_lf - CP ASCII_CR ; CR - RET NZ ; ret on unknown + CP ASCII_TAB ; TAB + JP Z, cur20_tab + CP ASCII_BS ; BKSP + JP Z, cur20_left + CP ASCII_CAN ; Cancel + JP Z, cur40_right + CP ASCII_US ; ASCII Unit separator + JP Z, screen_clear_20rows + CP ASCII_LF ; LF + JP Z, cur20_down + CP ASCII_CR ; CR + RET NZ ; ret on unknown INC HL LD (HL), 0x0 DEC HL @@ -1760,12 +1760,12 @@ m_handle_control_code: ; -------------------------------------------------- ; Handle cursor for 40x25, 64x25, 80x25 modes ; -------------------------------------------------- -handle_cc_common: +ctrl_handle_std: POP AF CP ASCII_US - JP Z, m_clear_screen + JP Z, screen_clear CP ASCII_FF - JP Z, m_cursor_home + JP Z, cursor_home PUSH AF LD A, (M_VARS.screen_mode) AND 3 ; check for color modes @@ -1773,17 +1773,17 @@ handle_cc_common: ; 32x25 text mode POP AF CP ASCII_TAB ; cursor right +8 - JP Z, m20_tab + JP Z, cur20_tab CP ASCII_BS ; cursor left - JP Z, m40_bksp + JP Z, cur40_left CP ASCII_CAN ; cursor right - JP Z, m40_rt + JP Z, cur40_right CP ASCII_EM ; cursor up - JP Z, m40_up + JP Z, cur40_up CP ASCII_SUB - JP Z, m40_lf ; cursor down + JP Z, cur40_down ; cursor down CP ASCII_LF - JP Z, m40_lf + JP Z, cur40_down CP ASCII_CR RET NZ INC HL @@ -1797,23 +1797,23 @@ handle_cc_common: .handle_cc_mono: LD A, (M_VARS.screen_mode) CP 3 - JP Z, handle_cc_80x25 + JP Z, ctrl_handle_80col CP 7 - JP Z, handle_cc_80x25 + JP Z, ctrl_handle_80col ; 64x25 screen mode POP AF CP ASCII_TAB - JP Z, m64_tab + JP Z, cur64_tab CP ASCII_BS - JP Z, m64_bs + JP Z, cur64_left CP ASCII_CAN - JP Z, m64_rt + JP Z, cur64_right CP ASCII_EM - JP Z, m64_up + JP Z, cur64_up CP ASCII_SUB - JP Z, m64_lf + JP Z, cur64_down CP ASCII_LF - JP Z, m64_lf + JP Z, cur64_down CP ASCII_CR RET NZ INC HL @@ -1824,20 +1824,20 @@ handle_cc_common: ; -------------------------------------------------- ; Handle control chars for 80x25 modes ; -------------------------------------------------- -handle_cc_80x25: +ctrl_handle_80col: POP AF CP ASCII_TAB - JP Z, m80_tab + JP Z, cur80_tab CP ASCII_BS - JP Z, m80_bs + JP Z, cur80_left CP ASCII_CAN - JP Z, m80_rt + JP Z, cur80_right CP ASCII_EM - JP Z, m80_up + JP Z, cur80_up CP ASCII_SUB - JP Z, m80_lf + JP Z, cur80_down CP ASCII_LF - JP Z, m80_lf + JP Z, cur80_down CP ASCII_CR RET NZ INC HL @@ -1848,33 +1848,33 @@ handle_cc_80x25: ; -------------------------------------------------- ; ; -------------------------------------------------- -m_beep: +speaker_beep: LD HL, (M_VARS.beep_duration) EX DE, HL LD HL, (M_VARS.beep_period) - LD A, 00110110b ; TMR#0 LSB+MSB Square Wave Generator + LD A, 00110110b ; TMR#0 LSB+MSB Square Wave Generator OUT (TMR_DD70CTR), A - LD A, L ; LSB + LD A, L ; LSB OUT (TMR_DD70C1), A - LD A, H ; MSB + LD A, H ; MSB OUT (TMR_DD70C1), A LD A, (M_VARS.strobe_state) LD B, A m_bell_cont: - LD A, D ; DE=duration + LD A, D ; DE=duration OR E - RET Z ; ret if enough + RET Z ; ret if enough DEC DE LD A, B XOR BELL_PIN LD B, A - OUT (DD67PC), A ; Invert bell pin + OUT (DD67PC), A ; Invert bell pin m_bell_wait_tmr1: IN A, (PIC_DD75RS) - AND TIMER_IRQ ; 0x10 + AND TIMER_IRQ ; 0x10 JP NZ, m_bell_wait_tmr1 LD A, B - XOR BELL_PIN ; Flip pin again + XOR BELL_PIN ; Flip pin again LD B, A OUT (DD67PC), A m_bell_wait_tmr2: @@ -1888,7 +1888,7 @@ m_bell_wait_tmr2: ; 5 Set cursor position ; ------------------------------------------------------ esc_set_cursor: - CALL m_draw_cursor + CALL cursor_draw LD DE, M_VARS.esc_param LD HL, M_VARS.cursor_col INC DE @@ -1939,8 +1939,8 @@ esc_le_24: ADD A, B ADD A, A LD (HL), A - CALL m_draw_cursor ; TODO change call+ret to jp - RET ; + CALL cursor_draw ; TODO change call+ret to jp + RET ; ------------------------------------------------------ ; 6n Set video mode or cursor visibility @@ -1983,10 +1983,10 @@ esc_set_vmode: OUT (VID_DD67PB), A ; configure screen mode LD HL, M_VARS.cursor_row - CALL m_clear_screen + CALL screen_clear .draw_cursor: - CALL m_draw_cursor ; TODO change call+ret to jp + CALL cursor_draw ; TODO change call+ret to jp RET .cursor_hide: @@ -2008,7 +2008,7 @@ esc_set_vmode: ; ------------------------------------------------------ esc_set_color: LD A, (M_VARS.esc_param) -m_set_color: +gfx_set_color: AND 0x3 RRA LD B, A @@ -2026,11 +2026,11 @@ m_set_color: ; Inp: param x,y ; C - character or sprite_no to draw ;--------------------------------------------------- -m_print_at_xy: +gfx_print_at_xy: ; check video mode LD A, (M_VARS.screen_mode) AND 0x3 ; color? - JP NZ, esc_exit ; exit for mono modes + JP NZ, esc_reset_mode ; exit for mono modes LD A, C AND 0x7f @@ -2039,22 +2039,22 @@ m_print_at_xy: JP Z, .sprites_en ; enable sprite mode CP ASCII_SP - JP M, mode2_exit ; codes 0..31 - turm off game_mode + JP M, sprite_mode_off ; codes 0..31 - turm off game_mode ; check X, Y range to prevent drawing symbols out of screen LD HL, M_VARS.esc_param LD A, (HL) LD E, A ADD A, 8 - JP C, mode2_exit ; exit if esc_param[0]>247 + JP C, sprite_mode_off ; exit if esc_param[0]>247 LD (HL), A INC HL ; HL -> esc_param[1] LD A, 247 CP (HL) - JP C, mode2_exit ; exit if esc_param[1]>247 + JP C, sprite_mode_off ; exit if esc_param[1]>247 ; calculate X,Y pixel address in VRAN LD D, (HL) - CALL calc_px_addr + CALL vram_pixel_addr ; HL - address, B - pixel pos in byte LD A, L SUB 8 @@ -2067,7 +2067,7 @@ m_print_at_xy: ; font LD A, C - CALL m_get_glyph + CALL font_get_glyph LD C, 7 POP DE INC E @@ -2078,7 +2078,7 @@ m_print_at_xy: LD A, C SUB 32 CP 35 - JP NC, co_ex_l08 + JP NC, sprite_invalid_exit ; Calc sprite address LD L, A ; HL=A - sprite_no @@ -2098,7 +2098,7 @@ m_print_at_xy: .out_sp: LD A, (M_VARS.esc_param+2) DEC A - JP Z, out_no_xor + JP Z, sprite_draw_opaque .next_line: PUSH HL @@ -2155,16 +2155,16 @@ m_print_at_xy: LD (M_VARS.esc_var2), A RET -mode2_exit: +sprite_mode_off: XOR A LD (M_VARS.esc_var2), A - JP esc_exit + JP esc_reset_mode -co_ex_l08: +sprite_invalid_exit: POP DE - JP mode2_exit + JP sprite_mode_off -out_no_xor: +sprite_draw_opaque: PUSH HL ; Acess to VRAM LD A, 0x1 @@ -2227,7 +2227,7 @@ out_no_xor: POP HL INC HL DEC C - JP NZ, out_no_xor + JP NZ, sprite_draw_opaque RET ; Binary data to draw sprites @@ -2240,7 +2240,7 @@ out_no_xor: ; Out: HL - address ; B - offset in byte ; -------------------------------------------------- -calc_px_addr: +vram_pixel_addr: ; take into account the vertical displacement LD A, (M_VARS.row_shift) SUB D @@ -2279,7 +2279,7 @@ esc_draw_fill_rect: .non_zero_h: LD C, A ; C = height ; DE = Y2, X1 - CALL calc_px_addr + CALL vram_pixel_addr ; HL -> videomem offset, b - pixel offset ; build pixel mask @@ -2328,7 +2328,7 @@ esc_draw_fill_rect: PUSH DE PUSH HL PUSH BC - CALL draw_line_h + CALL gfx_draw_hline POP BC POP HL POP DE @@ -2432,7 +2432,7 @@ esc_paint: ; set color from param 3 LD A, (M_VARS.esc_param+2) DEC A - CALL m_set_color + CALL gfx_set_color ; color to replace, from param 4 LD A, (M_VARS.esc_param+3) @@ -2454,7 +2454,7 @@ esc_paint: LD (M_VARS.paint_var5), A ; task_no=2 EX DE, HL - CALL calc_px_addr + CALL vram_pixel_addr LD (M_VARS.esc_param+1), HL ; temporary ctore address of start fill point ; make mask LD A, 10000000b @@ -2470,12 +2470,12 @@ esc_paint: LD A, (M_VARS.cmp_color) LD C, A LD D, E ; D = X - CALL paint_find_left + CALL paint_scan_left ; find right border LD HL, (M_VARS.esc_param+1) ; restore HL LD A, (M_VARS.esc_param+3) ; restore mask LD B, A - CALL paint_find_right + CALL paint_scan_right ; LD HL, 0x0 PUSH HL @@ -2505,7 +2505,7 @@ ep_fm_0: LD H, A LD L, D PUSH HL - JP paint_task ; exec task + JP paint_execute_task ; exec task ep_task_end: LD A, (M_VARS.cmp_color) @@ -2535,7 +2535,7 @@ ep_l5: ep_l6: LD A, (M_VARS.paint_var7) OR A - JP Z, paint_task + JP Z, paint_execute_task LD A, (M_VARS.paint_var2) CP 2 JP Z, ep_l5 ; TODO: change to one JP NZ @@ -2561,13 +2561,13 @@ ep_l8: JP Z, ep_l10 LD (M_VARS.paint_y), A INC L - CALL paint_find_next_right + CALL paint_scan_next_right JP Z, ep_l10 LD HL, (M_VARS.esc_param+4) LD A, (M_VARS.esc_param+6) LD B, A INC L - CALL paint_find_next_left + CALL paint_scan_next_left JP Z, ep_l10 LD A, (M_VARS.esc_param) OR A @@ -2583,12 +2583,12 @@ ep_l9: LD H, A LD L, D PUSH HL - JP paint_task + JP paint_execute_task ep_l10: LD A, (M_VARS.esc_param) OR A - JP NZ, paint_task + JP NZ, paint_execute_task LD A, (M_VARS.paint_var7) DEC A LD (M_VARS.paint_var7), A @@ -2608,13 +2608,13 @@ ep_l11: JP Z, ep_l10 LD (M_VARS.paint_y), A DEC L - CALL paint_find_next_right + CALL paint_scan_next_right JP Z, ep_l10 LD HL, (M_VARS.esc_param+4) LD A, (M_VARS.esc_param+6) LD B, A DEC L - CALL paint_find_next_left + CALL paint_scan_next_left JP Z, ep_l10 LD A, (M_VARS.esc_param) OR A @@ -2624,10 +2624,10 @@ ep_l11: ; --------------------------------------------------- ; ; --------------------------------------------------- -paint_find_next_right: - CALL get_pixel +paint_scan_next_right: + CALL gfx_get_pixel JP NZ, .l1 - CALL paint_find_left + CALL paint_scan_left LD A, 0xff OR A RET @@ -2645,7 +2645,7 @@ paint_find_next_right: INC H .l2: - CALL get_pixel + CALL gfx_get_pixel JP NZ, .l1 LD A, 0xff OR A @@ -2654,10 +2654,10 @@ paint_find_next_right: ; --------------------------------------------------- ; ; --------------------------------------------------- -paint_find_next_left: - CALL get_pixel +paint_scan_next_left: + CALL gfx_get_pixel JP NZ, .l1 - CALL paint_find_right + CALL paint_scan_right LD A, 0xff OR A RET @@ -2673,7 +2673,7 @@ paint_find_next_left: DEC H DEC H .l2: - CALL get_pixel + CALL gfx_get_pixel JP NZ, .l1 LD A, 0xff OR A @@ -2695,7 +2695,7 @@ ep_l12: JP ep_l16 ep_l13: LD D, E - CALL paint_find_left + CALL paint_scan_left LD E, D LD A, (M_VARS.paint_y) LD D, A @@ -2713,7 +2713,7 @@ ep_l14: DEC H DEC H ep_l15: - CALL get_pixel + CALL gfx_get_pixel JP NZ, ep_l14 JP ep_l12 ep_l16: @@ -2725,7 +2725,7 @@ ep_l16: ; HL - current pixel address ; B - pixel mask ; --------------------------------------------------- -paint_find_right: +paint_scan_right: LD A, E CP 0xff RET Z ; return if X=right border @@ -2740,8 +2740,8 @@ paint_find_right: INC H .in_byte: - CALL get_pixel - JP Z, paint_find_right ; find until same color + CALL gfx_get_pixel + JP Z, paint_scan_right ; find until same color ; border found, x-1 DEC E ; rotate mask back 1 px @@ -2760,7 +2760,7 @@ paint_find_right: ; HL - current pixel address ; B - pixel mask ; --------------------------------------------------- -paint_find_left: +paint_scan_left: LD A, D OR A RET Z ; return if x=0 @@ -2774,8 +2774,8 @@ paint_find_left: DEC H .in_byte: - CALL get_pixel - JP Z, paint_find_left ; repeat until same color + CALL gfx_get_pixel + JP Z, paint_scan_left ; repeat until same color INC D ; border found, x+1 ; mask rotate right @@ -2795,7 +2795,7 @@ paint_find_left: ; Out: A - 0,1,2 ; ZF - set if color match ; --------------------------------------------------- -get_pixel: +gfx_get_pixel: ; Access to VRAM LD A, 0x1 OUT (SYS_DD17PB), A @@ -2842,7 +2842,7 @@ get_pixel: CP C RET -paint_task: +paint_execute_task: POP HL ; L=x0, H=Y LD (M_VARS.paint_var3), HL EX DE, HL @@ -2850,11 +2850,11 @@ paint_task: POP HL ; L=x1, H=mode LD A, H OR A - JP Z, paint_exit ; jump for mode=0 + JP Z, paint_cleanup ; jump for mode=0 ; calc leftmost pixel address, mask for draw horisontal line LD (M_VARS.paint_var1), HL - CALL calc_px_addr + CALL vram_pixel_addr LD (M_VARS.esc_param+1), HL LD C, B LD A, 0x80 @@ -2869,7 +2869,7 @@ paint_task: LD E, A LD A, (M_VARS.paint_var4) LD D, A - CALL calc_px_addr + CALL vram_pixel_addr LD (M_VARS.esc_param+4), HL LD D, B LD A, 0x80 @@ -2879,7 +2879,7 @@ paint_task: DEC B JP P, .rmp_mask LD (M_VARS.esc_param+6), A - ;LD A, (M_VARS.esc_param+3) ; TODO: unused code + ;LD A, (M_VARS.esc_param+3) ; TODO: unused code XOR A .lmi_mask: @@ -2905,10 +2905,10 @@ paint_task: SUB H ; delta x RRCA ; 2 byte for 8 pix LD C, A ; C - line width - CALL draw_line_h + CALL gfx_draw_hline JP ep_task_end -paint_exit: +paint_cleanup: LD HL, (M_VARS.tmp_color) ; restore previous current color LD (M_VARS.curr_color), HL LD HL, (M_VARS.paint_sp_save) ; restore previous stack @@ -2921,7 +2921,7 @@ paint_exit: ; DE - left & right pixel mask ; HL - address of first byte of line ;--------------------------------------------------- -draw_line_h: +gfx_draw_hline: ; Access to VideoRAM LD A, 0x1 OUT (SYS_DD17PB), A @@ -2971,7 +2971,7 @@ draw_line_h: JP NZ, .full_8 JP .r_mask -.complete: ; TODO: duplicate close_vram_ret +.complete: ; TODO: duplicate vram_close_ret ; Disable VideoRAM access LD A, 0x0 OUT (SYS_DD17PB), A @@ -3048,7 +3048,7 @@ esc_draw_line: LD HL, (M_VARS.esc_param) ; x1,y1 EX DE, HL LD C, B - CALL calc_px_addr + CALL vram_pixel_addr ; HL - address, B - offset in byte ; make mask LD A, 10000000b @@ -3155,7 +3155,7 @@ esc_draw_line: ; -------------------------------------------------- .width0 LD C, H - CALL calc_px_addr + CALL vram_pixel_addr ; make pixel mask LD A, 10000000b @@ -3194,7 +3194,7 @@ esc_draw_line: DEC H LD A, C OR A - JP Z, close_vram_ret + JP Z, vram_close_ret DEC C ; dec row DEC L @@ -3218,13 +3218,13 @@ esc_draw_line: DEC H LD A, C OR A - JP Z, close_vram_ret + JP Z, vram_close_ret DEC C ; inc row INC L JP .next_row_down -close_vram_ret: +vram_close_ret: ; Disable VRAM access LD A, 0x0 OUT (SYS_DD17PB), A @@ -3243,7 +3243,7 @@ height0: JP NZ, .len_ne0 INC C ; length 1 at least .len_ne0: - CALL calc_px_addr + CALL vram_pixel_addr ; make pixel mask LD A, 10000000b .edl_l19 @@ -3301,7 +3301,7 @@ height0: esc_draw_dot: LD HL, (M_VARS.esc_param) EX DE, HL - CALL calc_px_addr + CALL vram_pixel_addr LD A, 0x80 edd_l1: @@ -3352,7 +3352,7 @@ edd_ep_fm_0: RET edd_ep_task_end: - CALL get_pixel + CALL gfx_get_pixel LD (M_VARS.esc_var3), A RET @@ -3387,7 +3387,7 @@ esc_picture: ; Enable VRAM access LD A, 0x1 OUT (SYS_DD17PB), A - CALL pict_sub1 + CALL pict_dispatch_dir ; Disable VRAM access LD A, 0x0 OUT (SYS_DD17PB), A @@ -3397,53 +3397,53 @@ esc_picture: LD (HL), C INC HL LD (HL), B - CALL pict_sub2 ; TODO: replace call+ret to jp; + CALL pict_put_masked ; TODO: replace call+ret to jp; RET -pict_sub1: +pict_dispatch_dir: LD A, (M_VARS.esc_param) CP ASCII_EM - JP Z, gih_up + JP Z, pict_scroll_up CP ASCII_CAN - JP Z, gih_rt + JP Z, pict_scroll_right CP ASCII_SUB - JP Z, gih_ctrl_z + JP Z, pict_scroll_down CP ASCII_BS - JP Z, gih_bs + JP Z, pict_scroll_left CP ASCII_US - JP Z, pict_clr + JP Z, pict_put_block RET -pict_clr: +pict_put_block: LD L, C LD H, B LD A, (M_VARS.esc_var0) LD C, A LD A, (M_VARS.esc_var1) LD B, A - CALL put_image + CALL vram_put_image POP HL POP HL POP HL RET -ehd_l1: +esc_image_dispatch: CP 0x2 - JP Z, get_image_hdr + JP Z, esc_get_image_hdr CP 0x3 - JP Z, m_fn_39 + JP Z, esc_image_merge RET ; -------------------------------------------------- ; Function 39 ; -------------------------------------------------- -m_fn_39: +esc_image_merge: LD HL, (M_VARS.esc_param+2) ; pr 3,4 INC L LD C, L LD B, H LD E, L - CALL dc_mul_e_h + CALL mul_u8 ADD HL, HL EX DE, HL LD HL, (M_VARS.esc_param) ; par 1,2 @@ -3461,7 +3461,7 @@ m_fn_39: POP BC LD A, 4 .l1: - PUSH AF ; TODO: remove AF not changed + PUSH AF ; TODO: remove AF not changed EX DE, HL ADD HL, BC EX DE, HL @@ -3469,19 +3469,19 @@ m_fn_39: INC HL LD (HL), D INC HL - POP AF ; TODO: remove AF not changed + POP AF ; TODO: remove AF not changed DEC A JP NZ, .l1 EX DE, HL LD HL, 0x0 - ADD HL, BC ; HL=BC - ADD HL, BC ; HL=2*BC - ADD HL, HL ; HL=4*BC - ADD HL, BC ; HL=5*BC - ADD HL, HL ; HL=10*BC - EX DE, HL ; DE=10*BC + ADD HL, BC ; HL=BC + ADD HL, BC ; HL=2*BC + ADD HL, HL ; HL=4*BC + ADD HL, BC ; HL=5*BC + ADD HL, HL ; HL=10*BC + EX DE, HL ; DE=10*BC LD A, 0x0 - LD B, A ; B=A=0 + LD B, A ; B=A=0 ; fill DE bytes at [HL] with 0 .l2: LD (HL), B @@ -3503,7 +3503,7 @@ m_fn_39: LD HL, (M_VARS.esc_param+4) EX DE, HL PUSH BC - CALL fn39_sub2 + CALL image_merge_row POP BC LD A, (M_VARS.esc_var0) ADD A, 0x2 @@ -3515,7 +3515,7 @@ m_fn_39: ; --------------------------------------------------- ; Function 3C ; --------------------------------------------------- -get_image_hdr: +esc_get_image_hdr: LD HL, (M_VARS.esc_param+4) LD (HL), 58 ; ':' INC HL @@ -3528,7 +3528,7 @@ get_image_hdr: LD B, A LD H, B LD E, C - CALL dc_mul_e_h + CALL mul_u8 ADD HL, HL EX DE, HL POP HL @@ -3546,7 +3546,7 @@ get_image_hdr: EX DE, HL PUSH BC PUSH HL - CALL calc_px_addr + CALL vram_pixel_addr POP DE LD A, L LD (DE), A @@ -3560,7 +3560,7 @@ get_image_hdr: POP BC LD A, 0x1 OUT (SYS_DD17PB), A - CALL get_image ; TODO: replace call+ret to jp + CALL vram_get_image ; TODO: replace call+ret to jp RET ; --------------------------------------------------- @@ -3569,16 +3569,16 @@ get_image_hdr: esc_get_put_image: LD A, (M_VARS.esc_param+6) CP 0x2 - JP NC, ehd_l1 + JP NC, esc_image_dispatch LD HL, M_VARS.esc_param LD E, (HL) INC HL LD D, (HL) INC HL LD C, (HL) - INC HL ; TODO: next call to calc_px_addr + INC HL ; TODO: next call to vram_pixel_addr LD B, (HL) ; destroy value of B and HL - CALL calc_px_addr + CALL vram_pixel_addr EX DE, HL LD HL, (M_VARS.esc_param+4) LD A, H @@ -3595,7 +3595,7 @@ esc_get_put_image: OUT (SYS_DD17PB), A LD A, (M_VARS.esc_param+6) OR A - JP NZ, put_image + JP NZ, vram_put_image ; --------------------------------------------------- ; Get image from VRAM to user buffer @@ -3603,7 +3603,7 @@ esc_get_put_image: ; DE -> buffer ; BC - width, height ; --------------------------------------------------- -get_image: +vram_get_image: PUSH HL PUSH BC .next_row: @@ -3628,8 +3628,8 @@ get_image: POP HL INC L DEC B ; dec width - JP NZ, get_image - JP img_task_end + JP NZ, vram_get_image + JP vram_close_access ; --------------------------------------------------- ; Put image from buffer to VRAM @@ -3637,7 +3637,7 @@ get_image: ; DE -> buffer ; BC - width, height ; --------------------------------------------------- -put_image: +vram_put_image: PUSH HL PUSH BC .next_row: @@ -3664,9 +3664,9 @@ put_image: ; next column INC L DEC B - JP NZ, put_image + JP NZ, vram_put_image -img_task_end: +vram_close_access: LD A, 0x0 OUT (SYS_DD17PB), A RET @@ -3674,7 +3674,7 @@ img_task_end: ; --------------------------------------------------- ; ; --------------------------------------------------- -fn39_sub2: +image_merge_row: DEC C .l1: PUSH BC @@ -3736,7 +3736,7 @@ fn39_sub2: ; -------------------------------------------------- ; Handle ASCII_CAN symbol (cursor right) ; -------------------------------------------------- -gih_rt: +pict_scroll_right: DEC DE LD A, (DE) ADD A, 0x2 @@ -3808,7 +3808,7 @@ gih_rt: ; -------------------------------------------------- ; Handle ASCII_BS (BackSpace) symbol ; -------------------------------------------------- -gih_bs: +pict_scroll_left: DEC DE LD A, (DE) SUB 0x2 @@ -3885,7 +3885,7 @@ gih_bs: ; -------------------------------------------------- ; Handle ASCII_SUB symbol ; -------------------------------------------------- -gih_ctrl_z: +pict_scroll_down: PUSH BC LD A, (M_VARS.esc_var0) ADD A, A @@ -3951,7 +3951,7 @@ gih_ctrl_z: ; -------------------------------------------------- ; Handle ASCII_EM symbol ; -------------------------------------------------- -gih_up: +pict_scroll_up: PUSH BC LD A, (M_VARS.esc_var0) ADD A, A @@ -4031,10 +4031,10 @@ gih_up: DEC C RET -; --------------------------------------------------- -; -; --------------------------------------------------- -pict_sub2: +; -------------------------------------------------- +; Put picture taking mask into account +; -------------------------------------------------- +pict_put_masked: PUSH DE DEC DE LD A, (DE) @@ -4059,7 +4059,7 @@ pict_sub2: LD C, L LD B, H POP HL - CALL mov_hl_bc + CALL mem_copy LD A, (M_VARS.esc_param+5) OR A JP Z, .l1 @@ -4107,7 +4107,7 @@ pict_sub2: JP Z, .l4 EX DE, HL .l4: - CALL mov_hl_bc + CALL mem_copy POP DE EX DE, HL LD A, (M_VARS.esc_var0) @@ -4116,7 +4116,7 @@ pict_sub2: LD B, A LD A, 0x1 OUT (SYS_DD17PB), A - CALL put_image ; TODO: replace call+ret to jp + CALL vram_put_image ; TODO: replace call+ret to jp RET ; --------------------------------------------------- @@ -4125,7 +4125,7 @@ pict_sub2: ; BC -> dst ; esc_var0*4 - count ; --------------------------------------------------- -mov_hl_bc: +mem_copy: PUSH DE LD A, (M_VARS.esc_var0) ADD A, A @@ -4158,7 +4158,7 @@ esc_draw_circle: XOR A LD D, A ; 0 LD E, B ; r - CALL dc_draw_8px + CALL circle_draw_8pts LD A, 1 LD H, A @@ -4175,8 +4175,8 @@ esc_draw_circle: INC D LD A, E CP D - JP Z, dc_draw_8px - CALL dc_draw_8px + JP Z, circle_draw_8pts + CALL circle_draw_8pts LD A, H ADD A, 0x2 LD H, A @@ -4193,15 +4193,15 @@ esc_draw_circle: DEC E LD A, D CP E - JP Z, dc_draw_8px + JP Z, circle_draw_8pts SUB E CP 0x1 RET Z LD A, E SUB D CP 0x1 - JP Z, dc_draw_8px - CALL dc_draw_8px + JP Z, circle_draw_8pts + CALL circle_draw_8pts LD A, H ADD A, 0x2 LD H, A @@ -4220,30 +4220,30 @@ esc_draw_circle: ; --------------------------------------------------- ; ; --------------------------------------------------- -dc_draw_8px: +circle_draw_8pts: PUSH HL PUSH DE PUSH BC PUSH DE - CALL dc_aspect_ratio_1 + CALL circle_apply_aspect1 LD HL, (M_VARS.esc_param) ; HL=Y,X - CALL dc_draw_4px_bc + CALL circle_plot_4pts_bc POP DE - CALL dc_aspect_ratio2 + CALL circle_apply_aspect2 LD HL, (M_VARS.esc_param) ; HL=Y,X - CALL dc_draw_4px_cb + CALL circle_plot_4pts_cb POP BC POP DE POP HL XOR A RET -; --------------------------------------------------- +; -------------------------------------------------- ; Scale circle axis dy specified aspect ratio ; if aspect_x = 0 C = D else C = D * aspect_x / 256 ; if aspect_y = 0 B = E else B = E * aspect_y / 256 -; --------------------------------------------------- -dc_aspect_ratio_1: +; -------------------------------------------------- +circle_apply_aspect1: LD HL, (M_VARS.esc_param+3) ; aspect_x -> L, aspect_y -> H LD A, L OR A @@ -4258,22 +4258,22 @@ dc_aspect_ratio_1: LD A, H LD H, L LD E, C - CALL dc_mul_e_h + CALL mul_u8 LD C, E OR A RET Z .dc_ay_ne0: LD H, A LD E, B - CALL dc_mul_e_h + CALL mul_u8 LD B, E RET -; --------------------------------------------------- +; -------------------------------------------------- ; if aspect_x = 0 B = E else B = E * aspect_x / 256 ; if aspect_y = 0 C = D else C = D * aspect_y / 256 -; --------------------------------------------------- -dc_aspect_ratio2: +; -------------------------------------------------- +circle_apply_aspect2: LD HL, (M_VARS.esc_param+3) ; aspect_x -> L, aspect_y -> H LD A, L OR A @@ -4288,7 +4288,7 @@ dc_aspect_ratio2: LD A, H LD H, L LD E, B - CALL dc_mul_e_h + CALL mul_u8 LD B, E OR A RET Z @@ -4296,14 +4296,14 @@ dc_aspect_ratio2: .dc_ay_ne0: LD H, A LD E, C - CALL dc_mul_e_h + CALL mul_u8 LD C, E RET ; --------------------------------------------------- ; ; --------------------------------------------------- -dc_mul_e_h: +mul_u8: LD D, 0x0 LD L, D ADD HL, HL @@ -4344,7 +4344,7 @@ dc_mul_e_h: ; --------------------------------------------------- ; ; --------------------------------------------------- -dc_draw_4px_bc: +circle_plot_4pts_bc: ; draw pixel(H+B, L+C) if in screen LD A, H ADD A, B @@ -4353,7 +4353,7 @@ dc_draw_4px_bc: LD A, L ADD A, C LD E, A - CALL dc_put_pixel + CALL circle_put_pixel .l1: ; draw pixel(H+B, L-C) if in screen LD A, H @@ -4363,7 +4363,7 @@ dc_draw_4px_bc: LD A, L SUB C LD E, A - CALL dc_put_pixel + CALL circle_put_pixel .l2: ; draw pixel(H-B, L-C) if in screen LD A, H @@ -4373,7 +4373,7 @@ dc_draw_4px_bc: LD A, L SUB C LD E, A - CALL dc_put_pixel + CALL circle_put_pixel .l3: ; draw pixel(H-B, L+C) if in screen LD A, H @@ -4383,13 +4383,13 @@ dc_draw_4px_bc: LD A, L ADD A, C LD E, A - CALL dc_put_pixel ; TODO: replace call+ret to jp + CALL circle_put_pixel ; TODO: replace call+ret to jp RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -dc_draw_4px_cb: +; -------------------------------------------------- +circle_plot_4pts_cb: ; draw pixel(H+C, L+B) if in screen LD A, H ADD A, C @@ -4398,7 +4398,7 @@ dc_draw_4px_cb: LD A, L ADD A, B LD E, A - CALL dc_put_pixel + CALL circle_put_pixel .l1: ; draw pixel(H+C, L-B) if in screen LD A, H @@ -4408,7 +4408,7 @@ dc_draw_4px_cb: LD A, L SUB B LD E, A - CALL dc_put_pixel + CALL circle_put_pixel .l2: ; draw pixel(H-C, L-B) if in screen LD A, H @@ -4418,7 +4418,7 @@ dc_draw_4px_cb: LD A, L SUB B LD E, A - CALL dc_put_pixel + CALL circle_put_pixel l3: ; draw pixel(H-C, L+B) if in screen LD A, H @@ -4428,18 +4428,18 @@ l3: LD A, L ADD A, B LD E, A - CALL dc_put_pixel ; TODO: replace call+ret to jp + CALL circle_put_pixel ; TODO: replace call+ret to jp RET ; --------------------------------------------------- ; Draw pixel on screen ; Inp: DE - X, Y ; --------------------------------------------------- -dc_put_pixel: +circle_put_pixel: RET C ; return if CF set (out of screen) PUSH HL PUSH BC - CALL calc_px_addr + CALL vram_pixel_addr ; calculate B = pixel mask LD A, 10000000b .roll: @@ -4478,10 +4478,10 @@ dc_put_pixel: ; Full charset, Common + Latin letters (112*8=890) INCLUDE "font-6x7.inc" -; --------------------------------------------------- +; -------------------------------------------------- ; Convert 0h..Fh decimal value to symbol '0'..'F' -; --------------------------------------------------- -conv_nibble: +; -------------------------------------------------- +nibble_to_ascii: AND 0xf ADD A, 0x90 DAA @@ -4490,28 +4490,28 @@ conv_nibble: LD C, A RET -; --------------------------------------------------- +; -------------------------------------------------- ; Print byte in HEX ; Inp: A - byte to print -; --------------------------------------------------- -m_hexb: +; -------------------------------------------------- +print_hex_byte: PUSH AF RRCA RRCA RRCA RRCA - CALL out_hex + CALL print_hex_nibble POP AF -out_hex: - CALL conv_nibble - CALL m_con_out ; TODO: replace call+ret to jp +print_hex_nibble: + CALL nibble_to_ascii + CALL con_putchar ; TODO: replace call+ret to jp RET -; --------------------------------------------------- +; -------------------------------------------------- ; Wtite RAM-Disk 64K to TAPE -; --------------------------------------------------- -m_tape_write_ram2: +; -------------------------------------------------- +tape_write_ramdisk: LD HL, M_VARS.buffer LD C, 128 .cl_stack: @@ -4524,20 +4524,20 @@ m_tape_write_ram2: ; write empty block ; DE - block ID ; HL -> block - CALL m_tape_write - CALL twr2_delay + CALL tape_write_block + CALL tape_interblock_delay LD DE, 0x0 - CALL m_tape_write - CALL twr2_delay + CALL tape_write_block + CALL tape_interblock_delay LD BC, 512 LD DE, 0x0 .nxt_blk: PUSH BC LD HL, M_VARS.buffer - CALL m_ramdisk_read + CALL ramdisk_read INC DE - CALL m_tape_write - CALL twr2_delay + CALL tape_write_block + CALL tape_interblock_delay POP BC DEC BC LD A, B @@ -4545,10 +4545,10 @@ m_tape_write_ram2: JP NZ, .nxt_blk RET -; --------------------------------------------------- +; -------------------------------------------------- ; Pause between blocks on tape -; --------------------------------------------------- -twr2_delay: +; -------------------------------------------------- +tape_interblock_delay: LD BC, 250 .delay: DEC BC @@ -4557,12 +4557,12 @@ twr2_delay: JP NZ, .delay RET -; --------------------------------------------------- +; -------------------------------------------------- ; Read RAM-Disk 64K from TAPE -; --------------------------------------------------- -m_tape_read_ram2: +; -------------------------------------------------- +tape_read_ramdisk: LD A, 100 - CALL m_tape_wait + CALL tape_wait_signal OR A JP NZ, .end LD E, 6 @@ -4572,7 +4572,7 @@ m_tape_read_ram2: JP Z, .not_found ; read block LD HL, M_VARS.buffer - CALL m_tape_read + CALL tape_read_block CP 4 JP Z, .end OR A @@ -4587,7 +4587,7 @@ m_tape_read_ram2: .rd_next: PUSH BC ; Read block from tape - CALL m_tape_read + CALL tape_read_block OR A JP NZ, .rd_error DEC BC @@ -4598,7 +4598,7 @@ m_tape_read_ram2: CP E JP NZ, .inv_id ; Ok, write block to RAM disk - CALL m_ramdisk_write + CALL ramdisk_write INC DE POP BC DEC BC @@ -4608,7 +4608,7 @@ m_tape_read_ram2: RET .not_found: LD HL, msg_no_start_rec - CALL me_out_strz ; TODO: replace call+ret to jp + CALL con_print_strz2 ; TODO: replace call+ret to jp RET .rd_error: CP 2 @@ -4616,23 +4616,23 @@ m_tape_read_ram2: CP 4 JP Z, .err_ibu LD HL, msg_checksum - CALL me_out_strz - CALL out_hexw + CALL con_print_strz2 + CALL print_hex_word POP BC RET ; Illegal sequence of blocks .inv_id: LD HL, msg_sequence - CALL me_out_strz + CALL con_print_strz2 INC BC - CALL out_hexw + CALL print_hex_word POP BC RET .err_ubi: LD HL, msg_ibg - CALL me_out_strz + CALL con_print_strz2 POP BC RET @@ -4641,20 +4641,20 @@ m_tape_read_ram2: POP BC .end: LD HL, msg_break - CALL me_out_strz ; TODO: replace call+ret to jp + CALL con_print_strz2 ; TODO: replace call+ret to jp RET ; -------------------------------------------------- ; Output hex word ; Inp: BC - word to output ; -------------------------------------------------- -out_hexw: +print_hex_word: PUSH BC LD A, B - CALL m_hexb + CALL print_hex_byte POP BC LD A, C - CALL m_hexb ; TODO: replace call+ret to jp + CALL print_hex_byte ; TODO: replace call+ret to jp RET msg_no_start_rec: @@ -4668,29 +4668,29 @@ msg_ibg: msg_break: DB "BREAK", 0 -; --------------------------------------------------- +; -------------------------------------------------- ; Out ASCIIZ message ; Inp: HL -> zero ended string -; --------------------------------------------------- -me_out_strz: +; -------------------------------------------------- +con_print_strz2: LD A, (HL) OR A RET Z PUSH BC LD C, A - CALL m_con_out + CALL con_putchar INC HL POP BC - JP me_out_strz + JP con_print_strz2 -; --------------------------------------------------- +; -------------------------------------------------- ; Read from RAM-disk to RAM ; Inp: DE - source sector 0..511/1535 ; HL -> destination buffer -; --------------------------------------------------- -m_ramdisk_read: +; -------------------------------------------------- +ramdisk_read: PUSH HL PUSH DE LD A, D @@ -4742,12 +4742,12 @@ m_ramdisk_read: POP HL RET -; --------------------------------------------------- +; -------------------------------------------------- ; Write sector to RAM disk ; Inp: HL -> source buffer ; DE - destination sector 0..511/1535 -; --------------------------------------------------- -m_ramdisk_write: +; -------------------------------------------------- +ramdisk_write: PUSH HL PUSH DE LD A, D @@ -4761,7 +4761,7 @@ m_ramdisk_write: AND 00000001b ; 512 sectors = 64k OR 0x2 ; Set A16 address line ENDIF - ;OR 0x0 ; TODO: remove unused + ;OR 0x0 ; TODO: remove unused LD B, A XOR A LD A, E @@ -4794,14 +4794,14 @@ m_ramdisk_write: ; In: DE - block ID, ; HL -> block of data. ; -------------------------------------------------- -m_tape_write: +tape_write_block: PUSH HL PUSH DE PUSH DE LD BC, 2550 LD A, PIC_POLL_MODE ; pool mode OUT (PIC_DD75RS), A - LD A, TMR0_SQWAVE ; tmr0, load lsb+msb, sq wave, bin + LD A, TMR0_SQWAVE ; tmr0, load lsb+msb, sq wave, bin OUT (TMR_DD70CTR), A LD A, C OUT (TMR_DD70C1), A @@ -4839,31 +4839,31 @@ m_tape_write: ; Write 00 at start LD A, 0x0 - CALL m_tape_wr_byte + CALL tape_write_byte ; Write 0xF5 marker LD A, 0xf5 - CALL m_tape_wr_byte + CALL tape_write_byte LD E, 0x0 ; checksum=0 ; Write block ID POP BC LD A, C - CALL m_tape_wr_byte + CALL tape_write_byte LD A, B - CALL m_tape_wr_byte + CALL tape_write_byte ; Write 128 data bytes LD B, 128 .next_byte: LD A, (HL) - CALL m_tape_wr_byte + CALL tape_write_byte INC HL DEC B JP NZ, .next_byte ; Write checksum LD A, E - CALL m_tape_wr_byte + CALL tape_write_byte ; Write final zero byte LD A, 0x0 - CALL m_tape_wr_byte + CALL tape_write_byte .wait_end: IN A, (PIC_DD75RS) AND TIMER_IRQ @@ -4881,7 +4881,7 @@ m_tape_write: ; D - current level ; E - current checksum ; ------------------------------------------------------ -m_tape_wr_byte: +tape_write_byte: PUSH BC ; calc checksum LD B, A @@ -4945,28 +4945,28 @@ m_tape_wr_byte: POP BC RET -; ------------------------------------------------------ +; -------------------------------------------------- ; Load block from Tape ; In: HL -> buffer to receive bytes from Tape ; Out: A = 0 - ok, ; 1 - CRC error, ; 2 - unexpected block Id ; 4 - key pressed -; ------------------------------------------------------ -m_tape_read: +; -------------------------------------------------- +tape_read_block: PUSH HL PUSH DE - LD A, PIC_POLL_MODE ; pool mode + LD A, PIC_POLL_MODE ; pool mode OUT (PIC_DD75RS), A LD A, TMR0_SQWAVE - OUT (TMR_DD70CTR), A ; tmr0, load lsb+msb, sq wave + OUT (TMR_DD70CTR), A ; tmr0, load lsb+msb, sq wave LD A, 0x0 ; tmr0 load 0x0000 OUT (TMR_DD70C1), A OUT (TMR_DD70C1), A LD C, 3 .wait_3_changes: - CALL read_tape_bit_kbd + CALL tape_read_bit_int INC A JP Z, .key_pressed LD A, B @@ -4975,7 +4975,7 @@ m_tape_read: DEC C JP NZ, .wait_3_changes .wait_4th_change: - CALL read_tape_bit_kbd + CALL tape_read_bit_int INC A JP Z, .key_pressed LD A, B @@ -4983,7 +4983,7 @@ m_tape_read: JP M, .wait_4th_change LD C, 0x0 .wait_f5_marker: - CALL read_tape_bit_kbd + CALL tape_read_bit_int INC A JP Z, .key_pressed DEC A @@ -4995,17 +4995,17 @@ m_tape_read: JP NZ, .wait_f5_marker LD E, 0x0 ; checksum = 0 ; Read blk ID - CALL m_tape_read_byte + CALL tape_read_byte JP NC, .err_read_id LD C, D - CALL m_tape_read_byte + CALL tape_read_byte JP NC, .err_read_id LD B, D PUSH BC ; Read block, 128 bytes LD C, 128 .read_next_b: - CALL m_tape_read_byte + CALL tape_read_byte JP NC, .err_read_blk LD (HL), D INC HL @@ -5013,7 +5013,7 @@ m_tape_read: JP NZ, .read_next_b ; Read checksum - CALL m_tape_read_byte + CALL tape_read_byte JP NC, .err_read_blk LD A, E OR A @@ -5033,22 +5033,22 @@ m_tape_read: LD A, 0x2 ; read error JP .return .key_pressed: - CALL m_con_in + CALL con_getchar LD C, A ; store key code in C LD B, 0x0 LD A, 0x4 JP .return -; ------------------------------------------------------ +; -------------------------------------------------- ; Read byte from Tape ; Out: D - byte ; CF is set if ok, cleared if error -; ------------------------------------------------------ -m_tape_read_byte: +; -------------------------------------------------- +tape_read_byte: PUSH BC LD C, 8 .next_bit: - CALL m_read_tape_bit + CALL tape_read_bit ; push bit from lo to hi in D RRA LD A, D @@ -5068,12 +5068,12 @@ m_tape_read_byte: POP BC RET -; ------------------------------------------------------ +; -------------------------------------------------- ; Read bit from tape ; Out: A - bit from tape ; B - time from last bit -; ------------------------------------------------------ -m_read_tape_bit: +; -------------------------------------------------- +tape_read_bit: IN A, (KBD_DD78PB) ; Read Tape bit 5 (data) AND TAPE_P LD B, A @@ -5100,12 +5100,12 @@ m_read_tape_bit: INC A RET -; ------------------------------------------------------ +; -------------------------------------------------- ; Read bit from tape with keyboard interruption ; Out: A - bit from tape ; B - time from last bit -; ------------------------------------------------------ -read_tape_bit_kbd: +; -------------------------------------------------- +tape_read_bit_int: IN A, (KBD_DD78PB) AND TAPE_P LD B, A ; save tape bit state @@ -5139,12 +5139,12 @@ read_tape_bit_kbd: LD A, 0xff RET -; ------------------------------------------------------ +; -------------------------------------------------- ; Wait tape block ; Inp: A - periods to wait ; Out: A=4 - interrupded by keyboard, C=key -; ------------------------------------------------------ -m_tape_wait: +; -------------------------------------------------- +tape_wait_signal: OR A RET Z PUSH DE @@ -5182,27 +5182,27 @@ m_tape_wait: RET .key_pressed: - CALL m_con_in + CALL con_getchar LD C, A ; C = key pressed LD A, 0x4 ; a=4 interrupted by key POP DE RET -; ------------------------------------------------------ +; -------------------------------------------------- ; Check block marker from Tape ; Out: A=0 - not detected, 0xff - detected -; ------------------------------------------------------ -m_tape_blk_detect: +; -------------------------------------------------- +tape_detect_pause: IN A, (KBD_DD78PB) - AND TAPE_D ; TAPE5 - Pause detector + AND TAPE_D ; TAPE5 - Pause detector LD A, 0x0 RET Z CPL RET -; ====================================================== +; ================================================== ; FDC DRIVER -; ====================================================== +; ================================================== fdc_unload_head: @@ -5215,7 +5215,7 @@ fdc_unload_head: .wait_no_busy: IN A, (FDC_CMD) - AND 00000101b ; Track0 , Busy + AND 00000101b ; Track0, Busy CP 00000100b JP Z, .tr0_ok @@ -5240,12 +5240,12 @@ fdc_unload_head: LD (M_VARS.ul_B_var5), A RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_select_drive: +; -------------------------------------------------- +fdc_select_drive: PUSH AF - CALL delay_1.4mS + CALL delay_1_4ms DEC A ; CP 0x1 LD B, 0x5 JP Z, .sel_A @@ -5254,7 +5254,7 @@ m_select_drive: .sel_A: ;LD A, 0x5 ;.sel_B - ;LD B, A ; 010b or 101b + ;LD B, A ; 010b or 101b IN A, (FLOPPY) ; read Floppy controller reg AND 0x40 ; SSEL RRA ; SSEL for out @@ -5270,10 +5270,10 @@ m_select_drive: LD A, (BIOS.bios_var04) .dpar_b: PUSH BC - LD B, A ; B = dpar_A or B - LD A, D ; compare with D? + LD B, A ; B = dpar_A or B + LD A, D ; compare with D? CP B - JP C, .l_le ; D < B + JP C, .l_le ; D < B SUB B LD D, A POP BC @@ -5287,7 +5287,7 @@ m_select_drive: LD A, B OR 0x20 ; set SSEL to 1 OUT (FLOPPY), A - CALL delay_136uS + CALL delay_136us RET .l_le: POP BC @@ -5298,72 +5298,72 @@ m_select_drive: LD A, B AND 0x7 OUT (FLOPPY), A - CALL delay_136uS + CALL delay_136us RET -; --------------------------------------------------- +; -------------------------------------------------- ; Delay for 136uS -; --------------------------------------------------- -delay_136uS: +; -------------------------------------------------- +delay_136us: LD B, 16 ; 7 -; --------------------------------------------------- +; -------------------------------------------------- ; Delay for B*8uS -; --------------------------------------------------- +; -------------------------------------------------- delay_b: DEC B ; 4 JP NZ, delay_b ; 10 RET ; 10 -; --------------------------------------------------- +; -------------------------------------------------- ; Delay for 1.4mS -; --------------------------------------------------- -delay_1.4mS: +; -------------------------------------------------- +delay_1_4ms: LD B, 175 ; 7 JP delay_b ; 10 -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_read_floppy: +; -------------------------------------------------- +fdc_read_sector: PUSH AF - CALL m_select_drive + CALL fdc_select_drive POP AF - CALL m_start_seek_track - JP C, fdc_ret - CALL m_fdc_read_c_bytes - JP C, fdc_ret + CALL fdc_seek_start + JP C, fdc_return + CALL fdc_read_bytes + JP C, fdc_return XOR A RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_write_floppy: +; -------------------------------------------------- +fdc_write_sector: PUSH AF - CALL m_select_drive + CALL fdc_select_drive POP AF - CALL m_start_seek_track - JP C, fdc_ret - CALL m_fdc_write_bytes - JP C, fdc_ret + CALL fdc_seek_start + JP C, fdc_return + CALL fdc_write_bytes + JP C, fdc_return XOR A RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_start_seek_track: - CALL m_start_floppy +; -------------------------------------------------- +fdc_seek_start: + CALL fdc_motor_start RET C - CALL m_fdc_seek_trk + CALL fdc_seek_track RET C ; TODO: remove RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_start_floppy: +; -------------------------------------------------- +fdc_motor_start: LD B, A LD A, (M_VARS.ul_var3) CP B @@ -5379,9 +5379,9 @@ m_start_floppy: AND FDC_NOT_READY ; not ready flag RET Z -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- +; -------------------------------------------------- .wait_motor: PUSH BC LD BC, 65535 @@ -5404,9 +5404,9 @@ m_start_floppy: POP BC RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- +; -------------------------------------------------- fdc_init: IN A, (FLOPPY) AND 01001110b ; Get SSEL, DRSEL, MOT1, MOT0 @@ -5416,11 +5416,11 @@ fdc_init: OUT (FLOPPY), A RET -; --------------------------------------------------- +; -------------------------------------------------- ; Seek track on floppy ; Inp: DE - track/sector -; --------------------------------------------------- -m_fdc_seek_trk: +; -------------------------------------------------- +fdc_seek_track: LD A, B DEC A JP Z, .drv_b @@ -5491,10 +5491,10 @@ m_fdc_seek_trk: POP AF RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_fdc_write_bytes: +; -------------------------------------------------- +fdc_write_bytes: LD A, C OUT (FDC_CMD), A .w_next: @@ -5504,13 +5504,13 @@ m_fdc_write_bytes: OUT (FDC_DATA), A INC HL JP C, .w_next - CALL fdc_check_status ; TODO: replace call+ret to jp + CALL fdc_check_error ; TODO: replace call+ret to jp RET -; --------------------------------------------------- +; -------------------------------------------------- ; -; --------------------------------------------------- -m_fdc_read_c_bytes: +; -------------------------------------------------- +fdc_read_bytes: LD A, C OUT (FDC_CMD), A JP .l2 @@ -5522,27 +5522,27 @@ m_fdc_read_c_bytes: RRCA IN A, (FDC_DATA) JP C, .l1 - CALL fdc_check_status ; TODO: replace call+ret to jp + CALL fdc_check_error ; TODO: replace call+ret to jp RET -; --------------------------------------------------- +; -------------------------------------------------- ; Check fdc status for errors ; Out: CF set if errors -; --------------------------------------------------- -fdc_check_status: +; -------------------------------------------------- +fdc_check_error: IN A, (FDC_CMD) AND 11011111b CP 0x0 - JP Z, fdc_ret + JP Z, fdc_return SCF -fdc_ret: +fdc_return: RET ;filler1: ; DB 20h -; ------------------------------------------------------ +; -------------------------------------------------- LAST EQU $ CODE_SIZE EQU LAST-0xE000 @@ -5550,50 +5550,50 @@ FILL_SIZE EQU ROM_CHIP_SIZE-CODE_SIZE IFDEF CHECK_INTEGRITY - ASSERT m_start = 0xe051 - ASSERT m_out_strz = 0xe0f1 - ASSERT m_con_out_int = 0xe16d - ASSERT get_esc_param = 0xe187 + ASSERT sys_init = 0xe051 + ASSERT con_print_strz = 0xe0f1 + ASSERT con_putchar_impl = 0xe16d + ASSERT esc_collect_param = 0xe187 ASSERT esc_params_tab = 0xe1cb ASSERT esc_handler_tab = 0xe1db ASSERT esc_set_beep = 0xe1f9 - ASSERT m_print_hor_line = 0xe23a - ASSERT m_get_7vpix = 0xe2b4 + ASSERT printer_print_hline = 0xe23a + ASSERT screen_get_7vpix = 0xe2b4 ASSERT esc_set_palette = 0xe2fe - ASSERT m_get_glyph = 0xe320 - ASSERT m_print_no_esc = 0xe349 - ASSERT calc_addr_40 = 0xe439 - ASSERT mp_mode_64 = 0xe4b8 - ASSERT calc_addr_80 = 0xe612 - ASSERT m_clear_screen = 0xe639 - ASSERT m_cursor_home = 0xe66c - ASSERT m_draw_cursor = 0xe69a - ASSERT m_handle_esc_code = 0xe77c - ASSERT handle_cc_common = 0xe7c4 - ASSERT handle_cc_80x25 = 0xe833 - ASSERT m_beep = 0xe85a + ASSERT font_get_glyph = 0xe320 + ASSERT con_putchar_normal = 0xe349 + ASSERT vram_addr_40col = 0xe439 + ASSERT con_putchar_64col = 0xe4b8 + ASSERT vram_addr_80col = 0xe612 + ASSERT screen_clear = 0xe639 + ASSERT cursor_home = 0xe66c + ASSERT cursor_draw = 0xe69a + ASSERT con_handle_esc = 0xe77c + ASSERT ctrl_handle_std = 0xe7c4 + ASSERT ctrl_handle_80col = 0xe833 + ASSERT speaker_beep = 0xe85a ASSERT esc_set_cursor = 0xe890 ASSERT esc_set_vmode = 0xe8e9 ASSERT esc_set_color = 0xe92f - ASSERT m_print_at_xy = 0xe943 + ASSERT gfx_print_at_xy = 0xe943 ASSERT game_sprite_tab = 0xea39 ASSERT esc_draw_fill_rect = 0xeb64 - ASSERT draw_line_h = 0xeed1 + ASSERT gfx_draw_hline = 0xeed1 ASSERT esc_draw_line = 0xef0b ASSERT esc_draw_dot = 0xf052 ASSERT esc_picture = 0xf0a4 - ASSERT m_fn_39 = 0xf10f - ASSERT get_image_hdr = 0xf177 + ASSERT esc_image_merge = 0xf10f + ASSERT esc_get_image_hdr = 0xf177 ASSERT esc_get_put_image = 0xf1b5 - ASSERT pict_sub2 = 0xf3ca + ASSERT pict_put_masked = 0xf3ca ASSERT m_font_cp0 = 0xf5bc - ASSERT me_out_strz = 0xfb36 - ASSERT m_ramdisk_write = 0xfb6d - ASSERT m_tape_write = 0xfb97 - ASSERT m_tape_wr_byte = 0xfc0e - ASSERT m_tape_read_byte = 0xfcee - ASSERT m_read_tape_bit = 0xfd08 - ASSERT m_tape_wait = 0xfd58 + ASSERT con_print_strz2 = 0xfb36 + ASSERT ramdisk_write = 0xfb6d + ASSERT tape_write_block = 0xfb97 + ASSERT tape_write_byte = 0xfc0e + ASSERT tape_read_byte = 0xfcee + ASSERT tape_read_bit = 0xfd08 + ASSERT tape_wait_signal = 0xfd58 ENDIF ; DISPLAY "Code size is: ", /A, CODE_SIZE