mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-04-20 00:17:04 +00:00
Merge pull request #215 from fredsa/apple0803
Document $0803 implicit start address
This commit is contained in:
@@ -51,7 +51,7 @@ EXITDOS equ $03D0
|
||||
; ------------------------------------
|
||||
; Build Options
|
||||
; ------------------------------------
|
||||
|
||||
|
||||
NOISY equ 0 ; 0 = Sound off, 1 = Sound on
|
||||
CHARSET equ 1 ; 0 = Olde Skoole, 1 = Pixel, 2 = Inverse, 3 = Small O's, 4 = Enhanced
|
||||
INIT_PATTERN equ 0 ; 0 = Glider gun, 1 = "Random", 2 = Edge test
|
||||
@@ -125,7 +125,7 @@ y_bottomright equ dataWidth*2+2
|
||||
; Entry Point
|
||||
; ------------------------------------
|
||||
seg program
|
||||
org $803
|
||||
org $803 ; Starting address, do not change
|
||||
|
||||
start subroutine
|
||||
lda #0
|
||||
@@ -146,7 +146,7 @@ runLoop subroutine
|
||||
|
||||
perfTest subroutine
|
||||
jsr RDKEY
|
||||
.startTimer
|
||||
.startTimer
|
||||
lda #50
|
||||
sta .counter
|
||||
.loop jsr iterate
|
||||
@@ -210,13 +210,13 @@ iterate subroutine
|
||||
bit CLICK
|
||||
endif
|
||||
ldy #y_topleft ; set top left value to one (previous value is stale)
|
||||
lda #1
|
||||
sta (altData),y
|
||||
lda #1
|
||||
sta (altData),y
|
||||
if soundEnabled
|
||||
bit CLICK ; (Pretend I'm not here... I just click the speaker)
|
||||
endif
|
||||
clc
|
||||
INCREMENT top
|
||||
INCREMENT top
|
||||
INCREMENT topright
|
||||
INCREMENT left
|
||||
INCREMENT right
|
||||
@@ -277,9 +277,9 @@ updateData subroutine
|
||||
cmp #charOff
|
||||
beq .clearTopLeft
|
||||
ldy #y_topleft ; set top left value to one (previous value is stale)
|
||||
lda #1
|
||||
lda #1
|
||||
sta (altData),y
|
||||
clc
|
||||
clc
|
||||
INCREMENT top
|
||||
INCREMENT topright
|
||||
INCREMENT left
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
;;;
|
||||
|
||||
; uninitialized zero-page variables
|
||||
seg.u ZEROPAGE
|
||||
seg.u ZEROPAGE
|
||||
org $0
|
||||
PWMBUF .ds 2
|
||||
PWMLEN .ds 1
|
||||
@@ -88,14 +88,14 @@ PULWID = 6
|
||||
IF {2} == 1
|
||||
sta SPKR
|
||||
ENDIF
|
||||
|
||||
|
||||
; increment pointer lo byte
|
||||
iny ; 2-1 = 1
|
||||
|
||||
|
||||
IF {2} == 2
|
||||
sta SPKR
|
||||
ENDIF
|
||||
|
||||
|
||||
bne .noinchi ; 4
|
||||
; increment pointer hi byte
|
||||
inc PWMBUF+1
|
||||
@@ -107,17 +107,17 @@ PULWID = 6
|
||||
IF {2} == 3
|
||||
sta SPKR
|
||||
ENDIF
|
||||
|
||||
|
||||
; reset X counter
|
||||
ldx #8 ; 6
|
||||
|
||||
|
||||
IF {2} == 4 || {2} == 5
|
||||
sta SPKR
|
||||
ENDIF
|
||||
|
||||
|
||||
; fetch new byte
|
||||
lda (PWMBUF),y ; 11
|
||||
|
||||
|
||||
; a few NOPs to match the normal pulse width
|
||||
; (inx, lsr, branch)
|
||||
IF {2} == 6
|
||||
@@ -130,7 +130,7 @@ PULWID = 6
|
||||
ENDIF
|
||||
; make up cycles we missed
|
||||
SLEEP2 PULWID*2-6
|
||||
|
||||
|
||||
.noinc
|
||||
; carry flag still valid from lsr
|
||||
bcc LVLS{1}
|
||||
@@ -138,7 +138,7 @@ PULWID = 6
|
||||
|
||||
;;; start of code
|
||||
seg CODE
|
||||
org $803 ; starting address
|
||||
org $803 ; starting address, do not change
|
||||
|
||||
Start
|
||||
lda #>(SAMPLE_END-SAMPLES)+1
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
; --------------------------------------------------
|
||||
; Example showing how to create a DOS 3.3 binary
|
||||
; header and program that is automatically loaded
|
||||
; into the desired ORIGIN memory address.
|
||||
; --------------------------------------------------
|
||||
|
||||
processor 6502
|
||||
|
||||
; --------------------------------------------------
|
||||
; Desired origin
|
||||
; - Origin must be less than $C000
|
||||
; - Origin + size must be less than $13000
|
||||
; - Origin must be $0803 or aligned to $xx00
|
||||
; --------------------------------------------------
|
||||
ORIGIN equ $2000
|
||||
SIZE equ END_OF_PRORGAM-ORIGIN
|
||||
|
||||
; --------------------------------------------------
|
||||
; DOS 3.3 binary header (4 bytes)
|
||||
; --------------------------------------------------
|
||||
org ORIGIN - 4 ; Subtract 4 ensures correct memory locations
|
||||
word ORIGIN ; Origin (2 bytes)
|
||||
word SIZE ; Size (2 bytes), must be length - 4
|
||||
|
||||
; --------------------------------------------------
|
||||
; ROM routines
|
||||
; --------------------------------------------------
|
||||
HOME equ $FC58
|
||||
|
||||
; --------------------------------------------------
|
||||
; Origin and start of program
|
||||
; --------------------------------------------------
|
||||
org ORIGIN ; Starting address
|
||||
|
||||
|
||||
start
|
||||
; --------------------------------------------------
|
||||
; Clear screen
|
||||
; --------------------------------------------------
|
||||
jsr HOME
|
||||
|
||||
; --------------------------------------------------
|
||||
; Print "START $" (7 chars) to $0400..$0406
|
||||
; --------------------------------------------------
|
||||
ldx #0
|
||||
pfx_loop
|
||||
lda prefix,x
|
||||
ora #$80
|
||||
sta $0400,x
|
||||
inx
|
||||
cpx #7
|
||||
bne pfx_loop
|
||||
|
||||
|
||||
; --------------------------------------------------
|
||||
; Print origin in hex to $0407 - $040A
|
||||
; --------------------------------------------------
|
||||
|
||||
; High byte high nibble
|
||||
lda #>start
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
lda hexchar,x
|
||||
ora #$80
|
||||
sta $0407
|
||||
|
||||
; High byte low nibble
|
||||
lda #>start
|
||||
and #$0F
|
||||
tax
|
||||
lda hexchar,x
|
||||
ora #$80
|
||||
sta $0408
|
||||
|
||||
; Low byte high nibble
|
||||
lda #<start
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
lda hexchar,x
|
||||
ora #$80
|
||||
sta $0409
|
||||
|
||||
; Low byte low nibble
|
||||
lda #<start
|
||||
and #$0F
|
||||
tax
|
||||
lda hexchar,x
|
||||
ora #$80
|
||||
sta $040A
|
||||
|
||||
; --------------------------------------------------
|
||||
; Endless loop (text stays on screen)
|
||||
; --------------------------------------------------
|
||||
done jmp done
|
||||
|
||||
|
||||
; --------------------------------------------------
|
||||
; Data
|
||||
; --------------------------------------------------
|
||||
prefix
|
||||
byte "START $"
|
||||
|
||||
hexchar
|
||||
byte "0123456789ABCDEF"
|
||||
|
||||
END_OF_PRORGAM ; Don't add instructions after this line
|
||||
+18
-19
@@ -1,21 +1,21 @@
|
||||
|
||||
;
|
||||
; LZ4FH uncompression for 6502
|
||||
; By Andy McFadden
|
||||
; Version 1.0.1, August 2015
|
||||
;
|
||||
; Refactored for size & speed
|
||||
; by Peter Ferrie.
|
||||
;
|
||||
; Developed with Merlin-16
|
||||
; Ported to DASM by Steven Hugg
|
||||
; Apache 2.0 license
|
||||
;
|
||||
; LZ4FH uncompression for 6502
|
||||
; By Andy McFadden
|
||||
; Version 1.0.1, August 2015
|
||||
;
|
||||
; Refactored for size & speed
|
||||
; by Peter Ferrie.
|
||||
;
|
||||
; Developed with Merlin-16
|
||||
; Ported to DASM by Steven Hugg
|
||||
; Apache 2.0 license
|
||||
; http://www.apache.org/licenses/LICENSE-2.0
|
||||
;
|
||||
;
|
||||
|
||||
processor 6502
|
||||
|
||||
org $0803
|
||||
org $0803 ; starting address, do not change
|
||||
|
||||
;
|
||||
; Constants
|
||||
@@ -47,7 +47,7 @@ entry
|
||||
jsr UnpackLZ4FH
|
||||
.endless
|
||||
jmp .endless
|
||||
|
||||
|
||||
|
||||
UnpackLZ4FH:
|
||||
lda #<LZDATA ;copy source address to zero page
|
||||
@@ -119,9 +119,9 @@ mainloop
|
||||
lda (srcptr),y ;get mixed-length byte
|
||||
sta savmix
|
||||
lsr ;get the literal length
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
beq noliteral
|
||||
cmp #$0f ;sets carry for >= 15
|
||||
bne shortlit
|
||||
@@ -413,5 +413,4 @@ LZDATA:
|
||||
hex 012d1b1504340d1f0628cc0331030013
|
||||
hex c21821000cbc0c130c711536047c6621
|
||||
hex 0a005a062c0343b1031a006a000f1500
|
||||
hex 000ffe
|
||||
|
||||
hex 000ffe
|
||||
|
||||
+51
-46
@@ -6,52 +6,53 @@ import { Base6502MachinePlatform } from "../common/baseplatform";
|
||||
import { CodeAnalyzer_apple2 } from "../common/analysis";
|
||||
import { BaseMAME6502Platform } from "../common/mameplatform";
|
||||
|
||||
const APPLE2_PRESETS : Preset[] = [
|
||||
{id:'sieve.c', name:'Sieve', category:"C"},
|
||||
{id:'keyboardtest.c', name:'Keyboard Test'},
|
||||
{id:'mandel.c', name:'Mandelbrot'},
|
||||
{id:'tgidemo.c', name:'TGI Graphics Demo'},
|
||||
{id:'Eliza.c', name:'Eliza'},
|
||||
{id:'siegegame.c', name:'Siege Game'},
|
||||
{id:'cosmic.c', name:'Cosmic Impalas'},
|
||||
{id:'farmhouse.c', name:"Farmhouse Adventure"},
|
||||
{id:'yum.c', name:"Yum Dice Game"},
|
||||
{id:'lz4test.c', name:"LZ4 Decompressor"},
|
||||
{id:'hgrtest.a', name:"HGR Test", category:"Assembly Language"},
|
||||
{id:'conway.a', name:"Conway's Game of Life"},
|
||||
{id:'lz4fh.a', name:"LZ4FH Decompressor"},
|
||||
{id:'deltamod.dasm', name:"Delta Modulation Audio"},
|
||||
// {id:'zap.dasm', name:"ZAP!"},
|
||||
// {id:'tb_6502.s', name:'Tom Bombem (assembler game)'},
|
||||
const APPLE2_PRESETS: Preset[] = [
|
||||
{ id: 'sieve.c', name: 'Sieve', category: "C" },
|
||||
{ id: 'keyboardtest.c', name: 'Keyboard Test' },
|
||||
{ id: 'mandel.c', name: 'Mandelbrot' },
|
||||
{ id: 'tgidemo.c', name: 'TGI Graphics Demo' },
|
||||
{ id: 'Eliza.c', name: 'Eliza' },
|
||||
{ id: 'siegegame.c', name: 'Siege Game' },
|
||||
{ id: 'cosmic.c', name: 'Cosmic Impalas' },
|
||||
{ id: 'farmhouse.c', name: "Farmhouse Adventure" },
|
||||
{ id: 'yum.c', name: "Yum Dice Game" },
|
||||
{ id: 'lz4test.c', name: "LZ4 Decompressor" },
|
||||
{ id: 'hgrtest.a', name: "HGR Test", category: "Assembly Language" },
|
||||
{ id: 'conway.a', name: "Conway's Game of Life" },
|
||||
{ id: 'lz4fh.a', name: "LZ4FH Decompressor" },
|
||||
{ id: 'deltamod.dasm', name: "Delta Modulation Audio" },
|
||||
// {id:'zap.dasm', name:"ZAP!"},
|
||||
// {id:'tb_6502.s', name:'Tom Bombem (assembler game)'},
|
||||
{ id: 'dos33bin.a', name: "DOS 3.3 Binary" },
|
||||
];
|
||||
|
||||
/// MAME support
|
||||
|
||||
class Apple2MAMEPlatform extends BaseMAME6502Platform implements Platform {
|
||||
|
||||
start () {
|
||||
start() {
|
||||
this.startModule(this.mainElement, {
|
||||
jsfile:'mame8bitpc.js',
|
||||
biosfile:['apple2e.zip'],
|
||||
jsfile: 'mame8bitpc.js',
|
||||
biosfile: ['apple2e.zip'],
|
||||
//cfgfile:'nes.cfg',
|
||||
driver:'apple2e',
|
||||
width:280*2,
|
||||
height:192*2,
|
||||
driver: 'apple2e',
|
||||
width: 280 * 2,
|
||||
height: 192 * 2,
|
||||
//romfn:'/emulator/cart.nes',
|
||||
//romsize:romSize,
|
||||
//romdata:new lzgmini().decode(lzgRom).slice(0, romSize),
|
||||
preInit:function(_self) {
|
||||
preInit: function (_self) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getOpcodeMetadata = getOpcodeMetadata_6502;
|
||||
getDefaultExtension () { return ".c"; };
|
||||
getDefaultExtension() { return ".c"; };
|
||||
getToolForFilename = getToolForFilename_6502;
|
||||
|
||||
getPresets () { return APPLE2_PRESETS; }
|
||||
getPresets() { return APPLE2_PRESETS; }
|
||||
|
||||
loadROM (title, data) {
|
||||
loadROM(title, data) {
|
||||
this.loadROMFile(data);
|
||||
// TODO
|
||||
}
|
||||
@@ -61,29 +62,33 @@ class Apple2MAMEPlatform extends BaseMAME6502Platform implements Platform {
|
||||
|
||||
class NewApple2Platform extends Base6502MachinePlatform<AppleII> implements Platform {
|
||||
|
||||
newMachine() { return new AppleII(); }
|
||||
getPresets() { return APPLE2_PRESETS; }
|
||||
newMachine() { return new AppleII(); }
|
||||
getPresets() { return APPLE2_PRESETS; }
|
||||
getDefaultExtension() { return ".c"; };
|
||||
readAddress(a) { return this.machine.readConst(a); }
|
||||
readAddress(a) { return this.machine.readConst(a); }
|
||||
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
|
||||
getMemoryMap = function() { return { main:[
|
||||
{name:'Zero Page RAM',start:0x0,size:0x100,type:'ram'},
|
||||
{name:'Line Input RAM',start:0x200,size:0x100,type:'ram'},
|
||||
{name:'RAM',start:0x300,size:0xc0,type:'ram'},
|
||||
{name:'DOS Vectors',start:0x3c0,size:0x40,type:'ram'},
|
||||
{name:'Text/Lores Page 1',start:0x400,size:0x400,type:'ram'},
|
||||
{name:'RAM',start:0x800,size:0x1800,type:'ram'},
|
||||
{name:'Hires Page 1',start:0x2000,size:0x2000,type:'ram'},
|
||||
{name:'Hires Page 2',start:0x4000,size:0x2000,type:'ram'},
|
||||
{name:'RAM',start:0x6000,size:0x6000,type:'ram'},
|
||||
{name:'I/O',start:0xc000,size:0x1000,type:'io'},
|
||||
{name:'ROM',start:0xd000,size:0x3000,type:'rom'},
|
||||
] } };
|
||||
getROMExtension(rom:Uint8Array) {
|
||||
if (rom && rom.length == 35*16*256) return ".dsk"; // DSK image
|
||||
getMemoryMap = function () {
|
||||
return {
|
||||
main: [
|
||||
{ name: 'Zero Page RAM', start: 0x0, size: 0x100, type: 'ram' },
|
||||
{ name: 'Line Input RAM', start: 0x200, size: 0x100, type: 'ram' },
|
||||
{ name: 'RAM', start: 0x300, size: 0xc0, type: 'ram' },
|
||||
{ name: 'DOS Vectors', start: 0x3c0, size: 0x40, type: 'ram' },
|
||||
{ name: 'Text/Lores Page 1', start: 0x400, size: 0x400, type: 'ram' },
|
||||
{ name: 'RAM', start: 0x800, size: 0x1800, type: 'ram' },
|
||||
{ name: 'Hires Page 1', start: 0x2000, size: 0x2000, type: 'ram' },
|
||||
{ name: 'Hires Page 2', start: 0x4000, size: 0x2000, type: 'ram' },
|
||||
{ name: 'RAM', start: 0x6000, size: 0x6000, type: 'ram' },
|
||||
{ name: 'I/O', start: 0xc000, size: 0x1000, type: 'io' },
|
||||
{ name: 'ROM', start: 0xd000, size: 0x3000, type: 'rom' },
|
||||
]
|
||||
}
|
||||
};
|
||||
getROMExtension(rom: Uint8Array) {
|
||||
if (rom && rom.length == 35 * 16 * 256) return ".dsk"; // DSK image
|
||||
return ".bin";
|
||||
};
|
||||
getToolForFilename = (fn:string) : string => {
|
||||
getToolForFilename = (fn: string): string => {
|
||||
if (fn.endsWith(".lnk")) return "merlin32";
|
||||
else return getToolForFilename_6502(fn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user