Skip to content

Commit

Permalink
Relocation tables moved into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
TechCowboy committed Mar 18, 2023
1 parent ef0398b commit c6be4fc
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 37 deletions.
Binary file modified apple2/FUJIAPPLE
Binary file not shown.
Binary file modified apple2/dist/FUJIAPPLE.po
Binary file not shown.
5 changes: 5 additions & 0 deletions apple2/src/FAKESMARTPORT_RELOC.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.IF .NOT STRIP_TRACE

.WORD trace050,trace051,trace052

.ENDIF
24 changes: 11 additions & 13 deletions apple2/src/FUJIAPPLE.S
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,17 @@ NEXT_NETWORK_CACHE:
;.ENDIF

.IF RELOCATE
JSR CLEAR_CMD_LIST ; clear the data so we can relocate code/data together
JSR RELOCATE_TO_HIMEM ; copy the code and data, adjust all absolute addresses


.ENDIF

; let's fix all the smartport data now that
; everything has been relocated

relocate006: JSR FILL_CMD_LIST

.IF RELOCATE

.IF .NOT STRIP_TRACE
Expand Down Expand Up @@ -249,10 +257,7 @@ relocate005: STA SIGNATURE,X
LDA #SIG_SIZE
STA SIGNATURE,X

; let's fix all the cmd list's now that
; everything has been relocated

relocate006: JSR FILL_CMD_LIST

.IF RELOCATE
.IF WIPE_AFTER
Expand Down Expand Up @@ -1456,7 +1461,6 @@ STR_DSC_HI: .BYTE 0
.include "SMARTPORT_DATA.S"
.include "FUJINET_DATA.S"


RELOCATE_DATA_END:

; Anything here is only used during setup and doesn't need to be relocated.
Expand All @@ -1465,16 +1469,10 @@ RELOCATE_DATA_END:
.include "RELOCATION.S"

RELOCATION_TABLE:
; in FUJIAPPLE.S
.WORD relocate000+1,relocate001+1,relocate002+1,relocate003+1,relocate004+1,relocate005+1,relocate006+1,relocate007,relocate008,relocate009
.WORD relocate010,relocate011,relocate012,relocate013,relocate014,relocate015,relocate016,relocate017,relocate018,relocate019
.WORD relocate020;,relocate021,relocate022,relocate023,relocate024,relocate025,relocate026,relocate027,relocate028,relocate029

.include "FUJIAPPLE_RELOC.S"
.include "STR_RELOC.S"

.WORD relocatesp00,relocatesp01,relocatesp02,relocatesp03;,relocatesp04,relocatesp05,relocatesp06,relocatesp07;,relocatesp08,relocatesp09
; .WORD relocatesp10,relocatesp11,relocatesp12,relocatesp13,relocatesp14,relocatesp15,relocatesp16,relocatesp17,relocatesp18,relocatesp19

.include "SMARTPORT_RELOC.S"
.include "FAKESMARTPORT_RELOC.S"
END_RELOCATION_TABLE:
.WORD 0 ; end of table

Expand Down
4 changes: 4 additions & 0 deletions apple2/src/FUJIAPPLE_RELOC.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; in FUJIAPPLE.S
.WORD relocate000+1,relocate001+1,relocate002+1,relocate003+1,relocate004+1,relocate005+1,relocate006+1,relocate007,relocate008,relocate009
.WORD relocate010,relocate011,relocate012,relocate013,relocate014,relocate015,relocate016,relocate017,relocate018,relocate019
.WORD relocate020;,relocate021,relocate022,relocate023,relocate024,relocate025,relocate026,relocate027,relocate028,relocate029
13 changes: 12 additions & 1 deletion apple2/src/RELOCATION.S
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,15 @@ TABLE_EXHAUSTED:
; AND PROBABLY MIXED YOUR DATA WITH YOUR CODE
; THE ILLEGAL INSTRUCTION IS AT SRC_ADDR
ILLEGAL_INSTRUCTION:
.IF APPLEII
LDA #<ILLEGAL_INSTRUCTION_STR
LDY #>ILLEGAL_INSTRUCTION_STR
JSR STROUT
LDX SRC_ADDR
LDA SRC_ADDR+1
JSR PRTAX
JSR CROUT
.ENDIF
BRK

;====================================
Expand Down Expand Up @@ -498,7 +507,7 @@ ADJUST_HIMEM:
; Each entry is points to the instruction
; (not the address) we need to relocate

INSTRUCTION_SIZE: .BYTE $02 ; $00 BRK
INSTRUCTION_SIZE: .BYTE $01 ; $00 BRK
.BYTE $02 ; $01 ORA X,IND
.BYTE 0,0,0
.BYTE $02 ; $05 ORA ZPG
Expand Down Expand Up @@ -757,4 +766,6 @@ DIFF_HI: .BYTE $00

MOVE_HIGHER: .BYTE $00

ILLEGAL_INSTRUCTION_STR: .ASCIIZ "RELOCATE ERROR, ILLEGAL INSTRUCTION AT: "


38 changes: 30 additions & 8 deletions apple2/src/SMARTPORTCMDS.S
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,49 @@ SLOT_ADDR_LO = ZP2_LO
SLOT_ADDR_HI = ZP2_HI


CLEAR_CMD_LIST:
LDA #$EA

STA cmd_list0
STA cmd_list1
STA cmd_list2
STA cmd_list3
STA cmd_list4
STA cmd_list5

STA cmd_list0+1
STA cmd_list1+1
STA cmd_list2+1
STA cmd_list3+1
STA cmd_list4+1
STA cmd_list5+1

STA cmd_open
STA cmd_close
STA cmd_control
STA cmd_read
STA cmd_write
STA cmd_status

RTS


FILL_CMD_LIST:
LDA CMD_LIST_ADDR
STA cmd_list0
STA cmd_list1
STA cmd_list2
STA cmd_list3
STA cmd_list4
STA cmd_list5

LDA CMD_LIST_ADDR+1
STA cmd_list0+1
STA cmd_list1+1
STA cmd_list2+1
STA cmd_list3+1
STA cmd_list4+1
STA cmd_list5+1

LDA #SP_CMD_OPEN
STA cmd_open
Expand All @@ -106,9 +135,6 @@ FILL_CMD_LIST:
LDA #SP_CMD_STATUS
STA cmd_status




RTS

;*******************************
Expand Down Expand Up @@ -517,9 +543,8 @@ NO_TRACE12:
cmd_open: .BYTE $EA ; SP_CMD_OPEN
cmd_list0: .WORD $EAEA ; CMD_LIST

BCS OPEN_ERROR

BCC SP_OPEN_DONE

OPEN_ERROR:
.IF EXT2_TRACE
PHA
Expand Down Expand Up @@ -573,8 +598,6 @@ NO_TRACE13:
cmd_close: .BYTE $EA ; SP_CMD_CLOSE
cmd_list1: .WORD $EAEA ; CMD_LIST

BCS CLOSE_ERROR

BCC SP_CLOSE_DONE
CLOSE_ERROR:
.IF EXT2_TRACE
Expand Down Expand Up @@ -1050,7 +1073,6 @@ SP_STATUS_DONE:
CALL_DISPATCHER:
JMP (SMARTPORT_DISPATCHER)


;*******************************
; DISPLAY_SP_STATUS
; Displays the device count,
Expand Down
2 changes: 2 additions & 0 deletions apple2/src/SMARTPORT_RELOC.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.WORD relocatesp00,relocatesp01,relocatesp02,relocatesp03;,relocatesp04,relocatesp05,relocatesp06,relocatesp07;,relocatesp08,relocatesp09
; .WORD relocatesp10,relocatesp11,relocatesp12,relocatesp13,relocatesp14,relocatesp15,relocatesp16,relocatesp17,relocatesp18,relocatesp19
8 changes: 1 addition & 7 deletions apple2/src/STR_RELOC.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
.WORD str000,str001,str002,str003,str004,str005,str006,str007,str008,str009
.WORD str010,str011,str012,str013,str014,str015,str016,str017,str018;,str019
; .WORD str020,str021,str022,str023,str024,str025,str026,str027,str028,str029
; .WORD str030,str031,str032,str033,str034,str035,str036,str037,str038,str039
; .WORD str040,str041,str042,str043,str044,str045,str046,str047,str048,str049



.IF .NOT STRIP_TRACE
Expand All @@ -15,9 +14,4 @@
.WORD trace040,trace041,trace042,trace043,trace044,trace045,trace046,trace047,trace048,trace049
.WORD trace053,trace054;,trace055,trace056,trace057,trace058,trace059

.IF .NOT USE_SP
.WORD trace050,trace051,trace052
.ENDIF
; .WORD trace060, trace061,trace062,trace063,trace064,trace065,trace066,trace067,trace068,trace069
; .WORD trace070, trace071
.ENDIF
16 changes: 8 additions & 8 deletions apple2/src/ZEROPAGE.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ ZP5 = $EF

.IF .DEFINED(ATARI)

ZP1 = $A2
ZP1 = $A2
ZP1_LO = $A2
ZP1_HI = $A3

ZP2 = $A4
ZP2_LO = $A4
ZP2_HI = $A5
ZP2_LO = $A4
ZP2_HI = $A5

ZP3 = $A6
ZP3_LO = $A6
ZP3_HI = $A7
ZP3_LO = $A6
ZP3_HI = $A7

ZP4 = $A8
ZP4_LO = $A8
ZP4_HI = $A9
ZP4_LO = $A8
ZP4_HI = $A9

ZP5 = $AA
ZP5 = $AA
.ENDIF


Expand Down

0 comments on commit c6be4fc

Please sign in to comment.