; slotData.asm ; A boot slot payload that arranges its own Data Segment. ; ; Stage one places Program Memory and nothing else, because knowing where a payload's data ; ends and its code begins would mean knowing a format, and knowing formats is the thing ; ROM must do as little of as possible. So a payload that wants initialised data arranges ; it: a loadable image is written into the slot as code followed by data, which leaves the ; data image sitting in Program Memory just past the code, and the first thing the payload ; does is blit it down to where it was assembled for. ; ; This is how the real second stage will get the Data Segment that sbfs.asm needs. ; ; THE PADDING IS NOT DECORATION. The blit needs a length, the assembler will not work out ; a difference between two labels, so the segment is padded to a round number and that ; number is what gets copied. Reserve one byte too many and the last byte does not arrive: ; the first draft of this padded to 257 and copied 256. ; ; Written by Anachronaut #Program #Base 0xC000 start: RSTA OUTA 0xE0 ; SourceBank: Program Memory, where stage one put everything. SETD.0 codeEnd PSHD.0 POPA POPB OUTB 0xE1 OUTA 0xE2 INIA 0d1 OUTA 0xE3 ; DestBank: Data Memory. SETD.0 Greeting PSHD.0 POPA POPB OUTB 0xE4 OUTA 0xE5 INIA 0x01 OUTA 0xE6 RSTA OUTA 0xE7 ; A round 256 bytes, which the segment is padded to. INIA 0x01 OUTA 0xE8 SETD.0 Greeting sayLoop: LDA.0 BRA sayDone OUTA 0x00 INCD.0 BRI sayLoop sayDone: HALT codeEnd: #Data #Base 0x3000 Greeting: "a payload with data of its own " Padding: #Reserve 0d224