minor refactors

This commit is contained in:
Eugene Lozovoy
2023-08-07 15:12:10 +03:00
parent 0a31be83a2
commit 0b0557d42d
4 changed files with 36 additions and 24 deletions

7
lua/include_verbose.lua Normal file
View 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
View 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

View File

@ -3,29 +3,19 @@
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUM128,stack_top
includelua "lua/screen_address.lua"
include "lua/screen_address.inc"
include "config.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
org int_handler-(variables0_end-begin)
assert $ >= #6000
org int_handler-(variables_low_end-begin)
assert $ >= 0x6000
begin:
db "Code begin",0
include "variables_low.asm"
variables0_end:
variables_low_end:
assert $ == 0x7f7f
org #7f7f
int_handler:
push af ;
@ -39,26 +29,28 @@ int_handler:
assert $ < 0x8000
org #8000
int_im2_vector_table:
assert int_handler == 0x7f7f
.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
; so we just play safe and use symmetric int handler address and vector table with one extra byte
; 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
; 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 "delay_tstate.asm"
include "math.asm"
include "draw.asm"
include "input.asm"
include "menu.asm"
include "menugen.asm"
include "device.asm"
include "file.asm"
include "settings.asm"
include "uart.asm"
include "math.asm"
include "shama2695.asm"
include "smf.asm"
include "player.asm"
include "draw.asm"
include "device.asm"
include "screen.asm"
include "vis.asm"
include "settings.asm"
main:

View File

@ -167,7 +167,7 @@ vis_process_frame:
ld d, a ; ...
ld a, (LAYOUT_BARS_Y + LAYOUT_BARS_HEIGHT)/2 ; B = Y coordinate
sub c ; ...
sla a ; ...
add a, a ; ...
ld b, a ; ...
ld a, e ; C = X coordinate
rlca : rlca : rlca ; ...