Blame | Last modification | View Log | Download
# file opened: relocation_disp_inside.asm1 0000 ; init ZX48 device, put machine code at $80002 0000 DEVICE ZXSPECTRUM482 0000 ORG $80003 80004 8000 RELOCATE_START5 80006 8000 02 00 dw relocate_count7 8002 04 00 dw relocate_size8 80049 8004 vram_routine_bytes: ; relocatable label10 8004 ; like use case: "helper routine to be displaced at runtime to ULA VRAM"relocation_disp_inside.asm(11): error: Relocation makes one of the expressions unstable, use non-relocatable values only11 8004 DISP vram_routine_bytes ; error, no DISP for relocatable labels12 8004 DISP $400013 4000 vram_routine: ; absolute label (and "$" should be absolute here too)14 4000 21 00 3D ld hl,$-$300 ; should not relocate15 4003 11 03 48 ld de,$+$800 ; should not relocate16 4006 DD 21 04 80 ld ix,vram_routine_bytes ; should give relocate data for the physical location ($8000+ address)17 400A C2 00 40 jp nz,vram_routine ; should not relocate18 400D C3 25 80 jp absolute1 ; should not relocate19 4010relocation_disp_inside.asm(20): error: End the current DISP block first20 4010 RELOCATE_END ; error - can't finish relocate block with DISP block open21 401022 4010 ENT ; end displacement routine23 8014 vram_routine_bytes.size EQU $ - vram_routine_bytes ; should be length24 801425 8014 ; use case: "dislocating the subroutine to target memory at runtime"26 8014 21 04 80 ld hl,vram_routine_bytes ; should relocate27 8017 11 00 40 ld de,vram_routine ; should not relocate28 801A 01 10 00 ld bc,vram_routine_bytes.size ; absolute size (not relocate)29 801D ED B0 ldir30 801F CD 00 40 call vram_routine ; should not relocate31 8022 C3 25 80 jp absolute1 ; should not relocate32 802533 8025 RELOCATE_END34 802535 8025 absolute1:36 8025 C3 25 80 jp absolute1 ; should not relocate37 8028relocation_disp_inside.asm(38): error: ENT should be after DISP38 8028 ENT ; error ENT without DISP39 802840 8028 0C 80 15 80 RELOCATE_TABLE41 802C ; 0C 80 15 80 ($800C, $8015)42 802C43 802C ; verify the actual machine code was placed at $8000 in virtual device memory44 802C SAVEBIN "relocation_disp_inside.bin", $8000, $ - $800045 802C46 802C ASSERT 2 == relocate_count47 802C ASSERT 2*relocate_count == relocate_size48 802C ASSERT 3 == 349 802C ASSERT 0 == 050 802C# file closed: relocation_disp_inside.asmValue Label------ - -----------------------------------------------------------0x8025 absolute10x0002 relocate_count0x0004 relocate_size0x4000 vram_routine0x8004 vram_routine_bytes0x0010 vram_routine_bytes.size