Код: Выделить всё
;-----------------------------------------------------------
macro sectors datab,datae
IF low (datae-datab)=0
db 1,5,high (datae-datab)
ELSE
db 1,5,(1+high (datae-datab))
ENDIF
endm
MODULE boot
Basic:
db #00,#01;номер строки
DW EndLine1 - Line1
Line1:
db #EA;REM
ld sp,#5FFE
res 4,(iy+1)
xor a:out ($FE),a
ld hl,$5AFF,de,$5AFe,bc,$1B00-1,(hl),0:lddr
;demo
di
ld de,(#5CF4)
ld hl, #6000
ld a,#10,bc,#7FFD:out (c),a
sectors begin,end
call #3d13
di
ld de,(#5CF4)
ld hl, #C000
sectors page0b,page0e
call #3d13
di
ld de,(#5CF4)
ld hl, #C000
ld a,#11,bc,#7FFD:out (c),a
sectors page1b,page1e
call #3d13
di
ld de,(#5CF4)
ld hl, #C000
ld a,#13,bc,#7FFD:out (c),a
sectors page3b,page3e
call #3d13
di
ld de,(#5CF4)
ld hl, #C000
ld a,#14,bc,#7FFD:out (c),a
sectors page4b,page4e
call #3d13
jp #6000
db "yo,lamer!"
db #0D
EndLine1:
db #00,#02
DW EndLine2 - Line2
Line2:
db #20,#FD,#B0
db #22,#32,#34,#35,#37,#35,#22;clear val "24575"
db #3A; :
db #F9,#C0,#28,#35;randomize usr (5+256*peek val "23635"+peek val "23636"
db #0E,#00,#00,#05,#00,#00,#2B
db #32,#35,#36
db #0E,#00,#00,#00,#01,#00,#2A,#BE
db #B0
db #22,#32,#33,#36,#33,#36,#22;"23635"
db #2B;???
db #BE
db #B0
db #22,#32,#33,#36,#33,#35,#22;"23636"
db #29,#0D;)
db #80
db #AA,1,0;;;;;;;;;;;;;autorun line,change program length to -4, e.g. 83-4=79
EndLine2:
EndBasic:
ENDMODULE
display /d,end-begin
EMPTYTRD "dust.trd" ;create empty TRD image
SAVETRD "dust.trd", "boot.B", boot.Basic, boot.EndBasic - boot.Basic
SAVETRD "dust.trd","demo.C",begin,end-begin
PAGE 0
SAVETRD "dust.trd","pg0.C",page0b,page0e-page0b
PAGE 1
SAVETRD "dust.trd","pg1.C",page1b,page1e-page1b
PAGE 3
SAVETRD "dust.trd","pg3.C",page3b,page3e-page3b
PAGE 4
SAVETRD "dust.trd","pg4.C",page4b,page4e-page4b
;-----------------------------------------------------------
Данные в страничках раскиданы так:
PAGE 0
org $C000
page0b:
[тут все нужное]
page0e:
Единственное, что написано некорректно - макрос Sectors. Пущай krt17 поправит.