This is just your opinion
And this is your right
Вид для печати
https://github.com/z00m128/sjasmplus...es/tag/v1.20.1
- new directives: SAVEAMSDOS, DEFDEVICE
- added "smart" SMC offset syntax: `value_addr+*: ld a,123`
- parse+ignore decimal numeric constants (for easier migration to Lua5.4)
https://github.com/z00m128/sjasmplus...es/tag/v1.20.2
- added optional second argument for DUP to have index variable
- option --exp will create file even when no EXPORT is used
- fixing variable name-clash when compiling against musl-clib
- LuaBridge updated, CMake and Makefile updated a bit
- minor bugfixes/improvements in parser in specific edge cases
Так и не понял, что это за index variable, и зачем она нужна.
Есть магия, как получитьКод:struct MedikitVTab /*виртуальная таблица для класса TMedikit*/
Metod dw #abcd
Metod1 dw fPick
ends
struct TMedikit /*класс*/
dw MyMedikitVTab /инкапсуляция!!!/
Coord dw #1f00 ; X
dw #1f00 ; Y
Count dw 55 ; Здоровье
ends
ORG #9e00
MyMedikit TMedikit /*экземпляр класса TMedikit (объект MyMedikit) объект класса */
MyMedikitVTab MedikitVTab
StartProg
ld bc,MyMedikit.+Coord
nop
ret
fPick ret
смещениеадрес по метке в инкапсуляции MyMedikitVTab из объекта MyMedikit?:
Код:ld bc,MyMedikit.+Metod1
you mean something like this?
also check listing with symbol table, or docs about structs, what values are available, you have all offsets, struct size and instance full addresses available at assembling time.Код:struct MedikitVTab /*виртуальная таблица для класса TMedikit*/
Metod dw #abcd
Metod1 dw fPick
ends
struct TMedikit /*класс*/
dw MyMedikitVTab /*инкапсуляция!!!*/
Coord dw #1f00 ; X
dw #1f00 ; Y
Count dw 55 ; Здоровье
ends
ORG #9e00
MyMedikit TMedikit /*экземпляр класса TMedikit (объект MyMedikit) объект класса */
MyMedikitVTab MedikitVTab
; DE = address of TMedikit instance
fPick:
ld hl,TMedikit.Count ; offset of Count in TMedikit struct
add hl,de ; HL = MyMedikit.Count #9e06
; ...
ret
; HL = object instance, BC = method offset in vtable
runVMetod:
ld de,(hl) ; DE = MyMedikitVTab #9e08 ; fake ld e,(hl) : inc hl : ld d,(hl) : dec hl
ex de,hl
add hl,bc ; HL = MyMedikitVTab.Metod1 #9e0a
ld a,(hl)
inc hl
ld h,(hl)
ld l,a ; HL = fPick #9e0c, DE = MyMedikit #9e00
jp (hl) ; jump to fPick
StartProg
ld hl,MyMedikit ; HL = MyMedikit instance address #9e00
ld bc,MedikitVTab.Metod1 ; offset of Metod1 in MedikitVTab struct #0002
call runVMetod ; `MyMedikit.Metod1();` alias `fPick(MyMedikit);`
jr $
(sjasmplus --lst --lstlab=sort file.asm)
https://github.com/z00m128/sjasmplus...es/tag/v1.20.3
- added alias --define for -D
- added string-literals suffixes Z and C to add zero or set high bit of last char
- end of line backslash continues source line (limited support, not recommended)
- Lua: minor version upgrade to 5.4.6 (from 5.4.4)
- minor updates to Makefile
https://youtu.be/Gerd209yR-M?si=pwIx2QP-Ae4N3QLs
мб кому пригодится VCode + sjasmplus