Skip to content

Commit e3f454e

Browse files
committed
AppleSingle BIN sample
1 parent a697efd commit e3f454e

2 files changed

Lines changed: 136 additions & 0 deletions

File tree

presets/apple2/applesinglebin.a

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
2+
processor 6502
3+
4+
seg
5+
org $4000
6+
7+
; --------------------------------------------------
8+
; AppleSingle version 2 file header
9+
; --------------------------------------------------
10+
; - https://github.com/cc65/cc65/blob/master/libsrc/apple2/exehdr.s
11+
; - https://nulib.com/library/FTN.e00001.htm
12+
; - https://www.kreativekorp.com/miscpages/a2info/filetypes.shtml
13+
__HEADER_BEGIN
14+
.byte $00, $05, $16, $00 ; Magic number
15+
.byte $00, $02, $00, $00 ; Version number
16+
17+
; Home File System - 16 bytes
18+
; ProDOS
19+
.byte $50,$72,$6F,$44,$4F,$53,$20,$20
20+
.byte $20,$20,$20,$20,$20,$20,$20,$20
21+
22+
.byte 0, 2 ; Number of entries
23+
.byte 0, 0, 0, 1 ; Entry ID 1 - Data Fork
24+
.byte 0, 0, >__DATA_OFFSET, <__DATA_OFFSET ; Offset
25+
.byte 0, 0, >__DATA_LENGTH, <__DATA_LENGTH ; Length
26+
27+
.byte 0, 0, 0, 11 ; Entry ID 11 - ProDOS File Info
28+
.byte 0, 0, >__PRODOS_OFFSET, <__PRODOS_OFFSET ; Offset
29+
.byte 0, 0, >__PRODOS_LENGTH, <__PRODOS_LENGTH ; Length
30+
__PRODOS_INFO
31+
.byte 0, %11000011 ; Access - Destroy, Rename, Write, Read
32+
.byte >__FILETYPE__, <__FILETYPE__ ; File Type
33+
.byte 0, 0 ; Auxiliary Type high
34+
.byte >__PROGRAM_BEGIN, <__PROGRAM_BEGIN ; Auxiliary Type low
35+
__HEADER_END:
36+
37+
__FILETYPE__ = $0006 ; BIN (Auxiliary type is the binary file's loading address)
38+
__DATA_LENGTH equ __PROGRAM_END - __PROGRAM_BEGIN
39+
__DATA_OFFSET equ __HEADER_END - __HEADER_BEGIN
40+
__PRODOS_LENGTH equ __HEADER_END - __PRODOS_INFO
41+
__PRODOS_OFFSET equ __PRODOS_INFO - __HEADER_BEGIN
42+
43+
44+
; --------------------------------------------------
45+
; ROM routines
46+
; --------------------------------------------------
47+
HOME equ $FC58
48+
49+
50+
51+
; --------------------------------------------------
52+
; Start of program
53+
; --------------------------------------------------
54+
__PROGRAM_BEGIN
55+
56+
start
57+
; --------------------------------------------------
58+
; Clear screen
59+
; --------------------------------------------------
60+
jsr HOME
61+
62+
; --------------------------------------------------
63+
; Print "START $" (7 chars) to $0400..$0406
64+
; --------------------------------------------------
65+
ldx #0
66+
pfx_loop
67+
lda prefix,x
68+
ora #$80
69+
sta $0400,x
70+
inx
71+
cpx #7
72+
bne pfx_loop
73+
74+
75+
; --------------------------------------------------
76+
; Print origin in hex to $0407 - $040A
77+
; --------------------------------------------------
78+
79+
; High byte high nibble
80+
lda #>start
81+
lsr
82+
lsr
83+
lsr
84+
lsr
85+
tax
86+
lda hexchar,x
87+
ora #$80
88+
sta $0407
89+
90+
; High byte low nibble
91+
lda #>start
92+
and #$0F
93+
tax
94+
lda hexchar,x
95+
ora #$80
96+
sta $0408
97+
98+
; Low byte high nibble
99+
lda #<start
100+
lsr
101+
lsr
102+
lsr
103+
lsr
104+
tax
105+
lda hexchar,x
106+
ora #$80
107+
sta $0409
108+
109+
; Low byte low nibble
110+
lda #<start
111+
and #$0F
112+
tax
113+
lda hexchar,x
114+
ora #$80
115+
sta $040A
116+
117+
; --------------------------------------------------
118+
; Endless loop (text stays on screen)
119+
; --------------------------------------------------
120+
done jmp done
121+
122+
123+
; --------------------------------------------------
124+
; Data
125+
; --------------------------------------------------
126+
prefix
127+
.byte "START $"
128+
129+
hexchar
130+
.byte "0123456789ABCDEF"
131+
132+
133+
134+
__PROGRAM_END
135+
; Don't add instructions after this line

src/platform/apple2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const APPLE2_PRESETS: Preset[] = [
2424
// {id:'zap.dasm', name:"ZAP!"},
2525
// {id:'tb_6502.s', name:'Tom Bombem (assembler game)'},
2626
{ id: 'dos33bin.a', name: "DOS 3.3 Binary" },
27+
{ id: 'applesinglebin.a', name: "AppleSingle Binary" },
2728
];
2829

2930
/// MAME support

0 commit comments

Comments
 (0)