mirror of
https://github.com/UzixLS/zx-midiplayer.git
synced 2025-07-19 07:11:26 +03:00
minor refactors
This commit is contained in:
7
lua/include_verbose.lua
Normal file
7
lua/include_verbose.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function include_verbose(file_name)
|
||||||
|
file_name = file_name:gsub('"', '')
|
||||||
|
start = sj.current_address
|
||||||
|
_pc(string.format([[include "%s"]], file_name))
|
||||||
|
finish = sj.current_address
|
||||||
|
_pc(string.format([[display "include file=%s start=0x%X end=0x%X size=%u"]], file_name, start, finish, finish-start))
|
||||||
|
end
|
13
lua/screen_address.inc
Normal file
13
lua/screen_address.inc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
includelua "lua/screen_address.lua"
|
||||||
|
|
||||||
|
MACRO LD_SCREEN_ADDRESS _reg, _yyxx
|
||||||
|
lua allpass
|
||||||
|
_pc("ld _reg, " .. screen_address_pixel((_c("_yyxx")&0xff)*8, (_c("_yyxx")>>8)*8))
|
||||||
|
endlua
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
MACRO LD_ATTR_ADDRESS _reg, _yyxx
|
||||||
|
lua allpass
|
||||||
|
_pc("ld _reg, " .. screen_address_attr((_c("_yyxx")&0xff)*8, (_c("_yyxx")>>8)*8))
|
||||||
|
endlua
|
||||||
|
ENDM
|
38
src/main.asm
38
src/main.asm
@ -3,29 +3,19 @@
|
|||||||
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
|
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
|
||||||
DEVICE ZXSPECTRUM128,stack_top
|
DEVICE ZXSPECTRUM128,stack_top
|
||||||
|
|
||||||
includelua "lua/screen_address.lua"
|
include "lua/screen_address.inc"
|
||||||
include "config.inc"
|
include "config.inc"
|
||||||
include "layout.inc"
|
include "layout.inc"
|
||||||
|
|
||||||
MACRO LD_SCREEN_ADDRESS _reg, _yyxx
|
|
||||||
lua allpass
|
|
||||||
_pc("ld _reg, " .. screen_address_pixel((_c("_yyxx")&0xff)*8, (_c("_yyxx")>>8)*8))
|
|
||||||
endlua
|
|
||||||
ENDM
|
|
||||||
MACRO LD_ATTR_ADDRESS _reg, _yyxx
|
|
||||||
lua allpass
|
|
||||||
_pc("ld _reg, " .. screen_address_attr((_c("_yyxx")&0xff)*8, (_c("_yyxx")>>8)*8))
|
|
||||||
endlua
|
|
||||||
ENDM
|
|
||||||
|
|
||||||
page 0
|
page 0
|
||||||
org int_handler-(variables0_end-begin)
|
org int_handler-(variables_low_end-begin)
|
||||||
assert $ >= #6000
|
assert $ >= 0x6000
|
||||||
begin:
|
begin:
|
||||||
db "Code begin",0
|
db "Code begin",0
|
||||||
include "variables_low.asm"
|
include "variables_low.asm"
|
||||||
variables0_end:
|
variables_low_end:
|
||||||
|
|
||||||
|
assert $ == 0x7f7f
|
||||||
org #7f7f
|
org #7f7f
|
||||||
int_handler:
|
int_handler:
|
||||||
push af ;
|
push af ;
|
||||||
@ -39,26 +29,28 @@ int_handler:
|
|||||||
assert $ < 0x8000
|
assert $ < 0x8000
|
||||||
org #8000
|
org #8000
|
||||||
int_im2_vector_table:
|
int_im2_vector_table:
|
||||||
assert int_handler == 0x7f7f
|
; by Z80 user manual int vector is I * 256 + (D & 0xFE)
|
||||||
.257 db #7f ; by Z80 user manual int vector is I * 256 + (D & 0xFE)
|
; but by other references and by T80/A-Z80 implementation int vector is I * 256 + D
|
||||||
; but by other references and by T80/A-Z80 implementation int vector is I * 256 + D
|
; so we just play safe and use symmetric int handler address and vector table with one extra byte
|
||||||
; so we just play safe and use symmetric int handler address and vector table with one extra byte
|
assert low int_handler == high int_handler
|
||||||
|
.257 db low int_handler
|
||||||
|
|
||||||
include "rle_unpack.asm"
|
include "rle_unpack.asm"
|
||||||
include "delay_tstate.asm"
|
include "delay_tstate.asm"
|
||||||
|
include "math.asm"
|
||||||
|
include "draw.asm"
|
||||||
include "input.asm"
|
include "input.asm"
|
||||||
include "menu.asm"
|
include "menu.asm"
|
||||||
include "menugen.asm"
|
include "menugen.asm"
|
||||||
|
include "device.asm"
|
||||||
include "file.asm"
|
include "file.asm"
|
||||||
|
include "settings.asm"
|
||||||
include "uart.asm"
|
include "uart.asm"
|
||||||
include "math.asm"
|
include "shama2695.asm"
|
||||||
include "smf.asm"
|
include "smf.asm"
|
||||||
include "player.asm"
|
include "player.asm"
|
||||||
include "draw.asm"
|
|
||||||
include "device.asm"
|
|
||||||
include "screen.asm"
|
include "screen.asm"
|
||||||
include "vis.asm"
|
include "vis.asm"
|
||||||
include "settings.asm"
|
|
||||||
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
|
@ -167,7 +167,7 @@ vis_process_frame:
|
|||||||
ld d, a ; ...
|
ld d, a ; ...
|
||||||
ld a, (LAYOUT_BARS_Y + LAYOUT_BARS_HEIGHT)/2 ; B = Y coordinate
|
ld a, (LAYOUT_BARS_Y + LAYOUT_BARS_HEIGHT)/2 ; B = Y coordinate
|
||||||
sub c ; ...
|
sub c ; ...
|
||||||
sla a ; ...
|
add a, a ; ...
|
||||||
ld b, a ; ...
|
ld b, a ; ...
|
||||||
ld a, e ; C = X coordinate
|
ld a, e ; C = X coordinate
|
||||||
rlca : rlca : rlca ; ...
|
rlca : rlca : rlca ; ...
|
||||||
|
Reference in New Issue
Block a user