Skip to content

ORG directive ignored in code #20

Open
@Smashcat

Description

@Smashcat

From what I can tell, the org directive is completely broken currently in this assembler. Using it to assemble the following results in the binary file having no padding between org sections. However, any label below an org results in a jp to that label being set to the org address, and not the address the instructions are relative to the start of the binary, which is obviously completely useless :)

org 0h
di
ld sp, 0x6000      ; Safe stack
im 1
ei
jp main_loop

org 38h ; completely ignored
push af
ld a, (borderColor)
xor 7
ld (borderColor), a
out (0xfe), a
pop af
reti

; Main loop (just show a stuff flashing for now)
org 200h ; if this is here, the jp main_loop is assembled to jp 200h, but the main_loop code is actually just under the interrupt handler!

main_loop:
ld b,7
inner_loop:
ld a,b
out (0xFE), a
inc a
and 7
ld b,a
rla
rla
rla ; paper colour

ld hl, 0x5800            ; Start of attribute area
ld de, 0x5801
ld bc, 0x02FF
lc (hl), a
ldir

halt
jp inner_loop

; Data
borderColor:
db 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions