https://wiki.c256foenix.com/index.php?title=Startup_code&feed=atom&action=history
Startup code - Revision history
2024-03-29T10:25:57Z
Revision history for this page on the wiki
MediaWiki 1.32.0
https://wiki.c256foenix.com/index.php?title=Startup_code&diff=375&oldid=prev
Bzuidgeest at 19:45, 23 February 2020
2020-02-23T19:45:13Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 19:45, 23 February 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The startup code==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The startup code==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I cannot add the asm code as a file to the wiki. So I pasted it below. I hope the it survives the wiki formatting. </div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I cannot add the asm code as a file to the wiki. So I pasted it below. I hope the it survives the wiki formatting<ins class="diffchange diffchange-inline">. This code was taken from the WDC original and the edits on that made by mikebgeek</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
Bzuidgeest
https://wiki.c256foenix.com/index.php?title=Startup_code&diff=374&oldid=prev
Bzuidgeest at 19:42, 23 February 2020
2020-02-23T19:42:52Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 19:42, 23 February 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>== The startup code</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>==The startup code<ins class="diffchange diffchange-inline">==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">I cannot add the asm code as a file to the wiki. So I pasted it below. I hope the it survives the wiki formatting. </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>; File: <del class="diffchange diffchange-inline">WDC_CStartup_816</del>.asm</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>; File: <ins class="diffchange diffchange-inline">fxloader</ins>.asm</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>; 05/14/2004</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>; 05/14/2004</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
Bzuidgeest
https://wiki.c256foenix.com/index.php?title=Startup_code&diff=373&oldid=prev
Bzuidgeest: Created page with "== The startup code <pre> ; File: WDC_CStartup_816.asm ; 05/14/2004 PW 128 ;Page Width (# of char/line) PL 60 ;Page Length for HP Laser INCL..."
2020-02-23T19:40:10Z
<p>Created page with "== The startup code <pre> ; File: WDC_CStartup_816.asm ; 05/14/2004 PW 128 ;Page Width (# of char/line) PL 60 ;Page Length for HP Laser INCL..."</p>
<p><b>New page</b></p><div>== The startup code<br />
<br />
<pre><br />
; File: WDC_CStartup_816.asm<br />
; 05/14/2004<br />
<br />
PW 128 ;Page Width (# of char/line) <br />
PL 60 ;Page Length for HP Laser<br />
INCLIST ON ;Add Include files in Listing<br />
<br />
;*********************************************<br />
;Test for Valid Processor defined in -D option<br />
;*********************************************<br />
IF USING_265<br />
ELSEIF USING_816<br />
ELSEIF USING_CDC16F <br />
ELSE<br />
EXIT "Not Valid Processor: Use -DUSING_816, etc. ! ! ! ! ! ! ! ! ! ! ! !"<br />
ENDIF<br />
<br />
<br />
;*********************************************<br />
;Test for Valid 'Model' type defined in -D option<br />
;*********************************************<br />
IF SMALL<br />
ELSEIF MEDIUM<br />
ELSEIF COMPACT<br />
ELSEIF LARGE<br />
ELSE<br />
EXIT "Not Valid 'Model' type - SMALL, MEDIUM, COMPACT, or LARGE: Use -DSMALL, etc. ! ! ! ! ! ! ! ! ! ! ! !"<br />
ENDIF<br />
<br />
title "fxos 'C' Startup Program V 1.00 for Large Model W65C816 - fxloader.asm"<br />
<br />
<br />
; bgnpkhdr<br />
;***************************************************************************<br />
; FILE_NAME: WDC_CStartup_816.asm<br />
;<br />
; DATA_RIGHTS: Western Design Center and R & C Services Proprietary<br />
; Copyright(C) 1980-2003<br />
; All rights reserved. Reproduction in any manner, <br />
; in whole or in part, is strictly prohibited without<br />
; the prior written approval of R & C Services or <br />
; Western Design Center.<br />
;<br />
; Information contained in this publication regarding<br />
; device applications and the like is intended through<br />
; suggestion only and may be superseded by updates. <br />
; It is your responsibility to ensure that your application<br />
; meets with your specifications. No representation or<br />
; warranty is given and no liability is assumed by <br />
; Western Design Center, Inc. with respect to the accuracy<br />
; or use of such information, or infringement of patents<br />
; or other intellectual property rights arising from such<br />
; use or otherwise. Use of Western Design Center's products<br />
; as critical components in life support systems is not<br />
; authorized except with express written approval by<br />
; Western Design Center, Inc.'s. No licenses are conveyed,<br />
; implicitly or otherwise, under any intellectual property rights.<br />
;<br />
;<br />
;<br />
; TITLE: WDC_CStartup_816<br />
;<br />
; DESCRIPTION: This File describes the WDC SDS General purpose ROM startup code.<br />
;<br />
; Program Flow<br />
;<br />
; First we make sure we are in native mode.<br />
; Then we set up the stack pointer.<br />
; Then we set the data bank register.<br />
; Then we copy the initialized data.<br />
; Then we clear out the uninitialized data.<br />
; Then we call main.<br />
;<br />
; DEFINED FUNCTIONS:<br />
; Undefined_IRQ<br />
; - Process a Bad Interrupt Vector - send code & Hang!<br />
;<br />
;<br />
; SPECIAL_CONSIDERATIONS:<br />
;<br />
;<br />
; SHARED_DATA:<br />
; None<br />
;<br />
; GLOBAL_MODULES:<br />
; None<br />
;<br />
; LOCAL_MODULES:<br />
; See above in "DEFINED FUNCTIONS"<br />
;<br />
; AUTHOR: Jim Goodnow II<br />
;<br />
; CREATION DATE: March 11,1997<br />
;<br />
; REVISION HISTORY<br />
; Name Date Description<br />
; ------------ ---------- ------------------------------------------------<br />
; R. Greenthal 10/07/2003 1.01 Initial<br />
;<br />
;<br />
;<br />
; NOTE:<br />
; Change the lines for each version - current version is 1.01<br />
; See - <br />
; title "WDC 'C' Startup Program V 1.01 for Large Model W65C816 - WDC_CStartup_816.asm"<br />
;<br />
;<br />
;***************************************************************************<br />
;endpkhdr<br />
<br />
<br />
;***************************************************************************<br />
; Include Files<br />
;***************************************************************************<br />
;None<br />
<br />
; Set 8-bit accumulator<br />
setas .macro<br />
SEP #$20 ; set A short <br />
LONGA OFF<br />
.endm<br />
<br />
; Set 16-bit accumulator<br />
setal .macro<br />
REP #$20 ; set A long <br />
LONGA ON<br />
.endm<br />
<br />
;***************************************************************************<br />
; Global Modules<br />
;***************************************************************************<br />
;None<br />
<br />
;***************************************************************************<br />
; External Modules<br />
;***************************************************************************<br />
;None<br />
<br />
;***************************************************************************<br />
; External Variables<br />
;***************************************************************************<br />
;None<br />
<br />
<br />
;***************************************************************************<br />
; Local Constants<br />
;***************************************************************************<br />
;<br />
<br />
<br />
; .page<br />
<br />
;***************************************************************************<br />
; RAM Section<br />
;***************************************************************************<br />
; <br />
<br />
<br />
<br />
sttl "WDC_CStartup_816 Code"<br />
.page<br />
<br />
;***************************************************************************<br />
;***************************************************************************<br />
; WDC_CStartup_816 Code Section<br />
;***************************************************************************<br />
;***************************************************************************<br />
<br />
****************************************************************<br />
* *<br />
* Define a special section in case most of the *<br />
* code is not in bank 0. *<br />
* *<br />
****************************************************************<br />
; Large Model Function Calls use module Function_Name and xdef ~~Function_Name<br />
<br />
STACK EQU $EF00 ;CHANGE THIS FOR YOUR SYSTEM<br />
<br />
STARTUP SECTION OFFSET $7D00<br />
<br />
~~START:<br />
<br />
START:<br />
SEI<br />
CLC ;clear carry<br />
XCE ;clear emulation-Now in Native 16 bit Mode<br />
REP #$38 ;16 bit registers and Clear Decimal mode<br />
LONGI ON<br />
LONGA ON<br />
LDA #STACK ;get the stack address<br />
TCS ;and set the stack to it<br />
<br />
****************************************************************<br />
* *<br />
* Set up the data bank register. We assume that the data *<br />
* section is where we want to point at. *<br />
* *<br />
****************************************************************<br />
<br />
SEP #$20 ;8 bit accum<br />
LONGA OFF<br />
<br />
LDA #^_BEG_DATA ;get bank of data<br />
PHA<br />
PLB ;set data bank register<br />
REP #$20 ;back to 16 bit mode<br />
LONGA ON<br />
<br />
****************************************************************<br />
* *<br />
* Next, we want to copy the initialized data from *<br />
* ROM to RAM. *<br />
* *<br />
****************************************************************<br />
<br />
LDA #_END_DATA-_BEG_DATA ;number of bytes to copy<br />
BEQ SKIP ;if none, just skip<br />
DEC A ;less one for MVN instruction<br />
LDX #<_ROM_BEG_DATA ;get source into X<br />
LDY #<_BEG_DATA ;get dest into Y<br />
MVN #^_ROM_BEG_DATA,#^_BEG_DATA ;copy bytes<br />
SKIP:<br />
<br />
****************************************************************<br />
* *<br />
* Now, clear out the uninitialized data area. *<br />
* We assume that it is in the same bank as DATA. *<br />
* *<br />
****************************************************************<br />
<br />
LDX #_END_UDATA-_BEG_UDATA ;get number of bytes to clear<br />
BEQ DONE ;nothing to do<br />
LDA #0 ;get a zero for storing<br />
SEP #$20 ;do byte at a time<br />
LDY #_BEG_UDATA ;get beginning of zeros<br />
<br />
LOOP STA |0,Y ;clear memory<br />
INY ;bump pointer<br />
DEX ;decrement count<br />
BNE LOOP ;continue till done<br />
REP #$20 ;16 bit memory reg<br />
DONE:<br />
<br />
****************************************************************<br />
* *<br />
* Finally, transfer control to the real program. *<br />
* *<br />
****************************************************************<br />
; Small Model Function Calls use module Function_Name and xdef __Function_Name<br />
; Medium Model Function Calls use module Function_Name and xdef ~_Function_Name<br />
; Large Model Function Calls use module Function_Name and xdef ~~Function_Name<br />
; Compact Model Function Calls use module Function_Name and xdef _~Function_Name <br />
<br />
NOP<br />
NOP<br />
<br />
XREF ~~main ;change MYSTART to yours<br />
JSL ~~main ;long jump in case not bank 0<br />
<br />
XDEF ~~_exit<br />
~~_exit:<br />
BRK<br />
<br />
<br />
<br />
<br />
sttl "WDC_CStartup_816 IRQ - Interrupt Handler Code"<br />
.page<br />
<br />
;***************************************************************<br />
; *<br />
; Example of transfering control to the real Interrupt *<br />
; Handler written in 'C'. Note: save all the registers *<br />
; *<br />
;***************************************************************<br />
XDEF IRQ<br />
<br />
IRQ: <br />
<br />
setal <br />
;Example of needing to read/write to data in another data bank<br />
<br />
phb ; save Data Bank<br />
phd ; save Direct Page Register<br />
pha<br />
phx<br />
phy<br />
<br />
setas<br />
<br />
;LDA #'A'<br />
;STA >$AFA000<br />
<br />
setal<br />
XREF ~~IRQHandler<br />
jsl ~~IRQHandler<br />
<br />
;setas<br />
;LDA #'B'<br />
;STA >$AFA000<br />
<br />
<br />
setal<br />
<br />
ply<br />
plx<br />
pla<br />
pld ; restore Direct Page Reg<br />
plb ; Restore Data Bank<br />
<br />
<br />
<br />
RTI<br />
<br />
<br />
NMI:<br />
RTI<br />
<br />
<br />
BRK: <br />
<br />
setal <br />
;Example of needing to read/write to data in another data bank<br />
<br />
phb ; save Data Bank<br />
phd ; save Direct Page Register<br />
pha<br />
phx<br />
phy<br />
<br />
setas<br />
<br />
setal<br />
XREF ~~BRKHandler<br />
jsl ~~BRKHandler<br />
<br />
setal<br />
<br />
ply<br />
plx<br />
pla<br />
pld ; restore Direct Page Reg<br />
plb ; Restore Data Bank<br />
<br />
RTI<br />
<br />
COP: <br />
<br />
setal <br />
;Example of needing to read/write to data in another data bank<br />
<br />
phb ; save Data Bank<br />
phd ; save Direct Page Register<br />
pha<br />
phx<br />
phy<br />
<br />
setas<br />
<br />
setal<br />
XREF ~~COPHandler<br />
jsl ~~COPHandler<br />
<br />
setal<br />
<br />
ply<br />
plx<br />
pla<br />
pld ; restore Direct Page Reg<br />
plb ; Restore Data Bank<br />
<br />
RTI<br />
;************************************************<br />
; Bad Vectors<br />
;************************************************<br />
<br />
Undefined_IRQ:<br />
nop<br />
bra Undefined_IRQ<br />
<br />
<br />
;WDCMON_START EQU $7E00<br />
;ROMSPACE EQU WDCMON_START-* ;gives space left in the ROM BEFORE TABLES;<br />
; IF ROMSPACE<0<br />
;EXIT "Not Enough Memory for WDC_Cstartup_02.ASM - bumping into WDCMON! ! ! ! ! ! ! ! ! ! ! !"<br />
;ENDIF<br />
<br />
; ENDS<br />
<br />
<br />
XREF _BEG_DATA<br />
XREF _END_DATA<br />
XREF _ROM_BEG_DATA<br />
XREF _BEG_UDATA<br />
XREF _END_UDATA<br />
<br />
<br />
ends<br />
<br />
<br />
sttl "WDC_CStartup_816 Shadow Vector Defines"<br />
.page<br />
<br />
;***************************************************************************<br />
; $7E00 - $7FFF New Expanded Shadow Vector Section Definitions<br />
;***************************************************************************<br />
;***************************************************************************<br />
;***************************************************************************<br />
<br />
; hvectors: section ; the real reset and interrupt vectors<br />
;<br />
; ;65C816 Vectors<br />
; org $18ffe4<br />
; ;Status bit E = 0 (Native mode);<br />
; dw Undefined_IRQ ; $FFE4 - COP(816)<br />
; dw Undefined_IRQ ; $FFE6 - BRK(816)<br />
; dw Undefined_IRQ ; $FFE8 - ABORT(816)<br />
; dw Undefined_IRQ ; $FFEA - NMI(816)<br />
; dw Undefined_IRQ ; $FFEC - IRQRVD(816)<br />
; dw IRQ ; $FFEE - IRQ(816)<br />
; ;Status bit E = 1 (Emulation mode)<br />
; dw Undefined_IRQ ; $FFF0 - IRQRVD(816)<br />
; dw Undefined_IRQ ; $FFF2 - IRQRVD(816)<br />
; dw Undefined_IRQ ; $FFF4 - COP(816Emulation)<br />
; dw Undefined_IRQ ; $FFF6 - IRQRVD(816Emulation)<br />
; dw Undefined_IRQ ; $FFF8 - ABORT(816Emulation)<br />
;<br />
; ; Common Vectors for all CPUs<br />
; dw Undefined_IRQ ; $FFFA - NMIRQ (ALL)<br />
; dw START ; $FFFC - RESET (ALL)<br />
; dw Undefined_IRQ ; $FFFE - IRQBRK (ALL)<br />
;<br />
; ends<br />
<br />
<br />
<br />
<br />
<br />
<br />
****************************************************************<br />
* *<br />
* This section defines the interrupt and reset vectors. *<br />
* The reset vectors always start at FFE4 in bank 0. *<br />
* Since the vectors are only 16 bits, they must point *<br />
* into bank 0. Replace the "Undefined_IRQ" with any *<br />
* routines that handle that interrupt. *<br />
* *<br />
****************************************************************<br />
<br />
<br />
vectors: section ; the real reset and interrupt vectors<br />
<br />
;65C816 Vectors<br />
org $ffe4<br />
;Status bit E = 0 (Native mode)<br />
dw COP ; $FFE4 - COP(816)<br />
dw BRK ; $FFE6 - BRK(816)<br />
dw Undefined_IRQ ; $FFE8 - ABORT(816)<br />
dw NMI ; $FFEA - NMI(816)<br />
dw Undefined_IRQ ; $FFEC - IRQRVD(816)<br />
dw IRQ ; $FFEE - IRQ(816)<br />
;Status bit E = 1 (Emulation mode)<br />
dw Undefined_IRQ ; $FFF0 - IRQRVD(816)<br />
dw Undefined_IRQ ; $FFF2 - IRQRVD(816)<br />
dw Undefined_IRQ ; $FFF4 - COP(816Emulation)<br />
dw Undefined_IRQ ; $FFF6 - IRQRVD(816Emulation)<br />
dw Undefined_IRQ ; $FFF8 - ABORT(816Emulation)<br />
<br />
; Common Vectors for all CPUs<br />
dw Undefined_IRQ ; $FFFA - NMIRQ (ALL)<br />
dw START ; $FFFC - RESET (ALL)<br />
dw Undefined_IRQ ; $FFFE - IRQBRK (ALL)<br />
<br />
ends<br />
<br />
<br />
end<br />
<br />
;**********************************************************************<br />
; End of WDC_CSTARTUP_C.ASM<br />
;**********************************************************************<br />
<br />
</pre></div>
Bzuidgeest