Linker/linker.asm

1 line
14 KiB
NASM
Raw Normal View History

mcopy linker.mac keep obj/linker **************************************************************** * * Linker 2.0 * * Link editor for ORCA/M. * **************************************************************** * * Linker 2.0.3 prepared Mar 96 by Mike Westerfield * **************************************************************** * * Linker 2.0.2 prepared Jul 94 by Mike Westerfield * **************************************************************** * Linker start using Common phk use our data bank plb tsx save the stack register stx sreg ora #$0100 set our user ID sta userID jsl SysIOStartup start the I/O system jsr Initialize set up the linker bcs exit jsr DoPass1 do pass 1 bcs exit jsr DoPass2 do pass 2 bcs exit lda kflag if kflag then beq lb1 jsr KeepFile write the keep file lb1 jsr Terminate do final processing exit entry jsr PurgePlusM purge memory only files jsr SetLInfo pass parameters back to the shell jsl SysIOShutdown shut down the I/O system lda #0 return to the caller rtl end **************************************************************** * * Common - global data * **************************************************************** * copy DirectPage Common data ; ; Memory locations ; keyboard equ $C000 keyboard value strobe equ $C010 keyboard strobe kflags equ $C025 keyboard flags ; ; Constants ; flagB equ %01000000000000000000000000000000 command line flag masks flagC equ %00100000000000000000000000000000 flagL equ %00000000000100000000000000000000 flagM equ %00000000000010000000000000000000 flagP equ %00000000000000010000000000000000 flagS equ %00000000000000000010000000000000 flagW equ %00000000000000000000001000000000 flagX equ %00000000000000000000000100000000 flagAll equ flagB+flagC+flagL+flagM+flagP+flagS+flagW+flagX RETURN equ $0D key codes TAB equ $09 ; ; Symbol flags (bit masks for symFlag) ; pass1Resolved equ 1 label defined on pass 1 pass2Resolved equ 2 label defined on pass 2 pass1Requested equ 4 label has been requested on pass1 pass2Requested equ 8 label has been requested on pass2 ! (see also, subroutine Reference2) isConstant equ 16 is the value a constant? isDataArea equ 32 is the symbol a data area? isSegmentFlag equ 64 is the symbol a segment name? ; ; global scalars ; bankOrg ds 2 bank org the program? compact ds 2 compact the object files? dataAreas ds 256 data area array dpReg ds 2 default DP register eoln ds 2 script end of line flag express ds 2 expressload the file? length ds 4 length of the output file libFromShell ds 2 did the shell have a variable? libIndex ds 2 next library index libSeg ds 4 pointer to the current library segment lineNumber ds 2 script line number list ds 2 list segment info? memory ds 2 is this a +m link? numerror ds 2 number of linker errors found pass ds 2 pass number (1 or 2) pause ds 2 pause on error? progress ds 2 write progress info? sreg ds 2 stack register in main symbols ds 2 list the symbol table? userID ds 2 user ID; for memory manager calls ; ; Current code segment information ; segLength ds 4 length of the code in the segment segDisp ds 4 disp to the next segment in the file segSpace ds 4 reserved space at the end of the segment segType ds 2 segment type segName ds 4 pointer to the name of the segment segEntry ds 4 disp to entry point in segment segAlign ds 4 segment alignment factor segVersion ds 2 segment version number segOrg ds 4 origin for this segment segBanksize ds 4 banksize for this segment startpc ds 4 pc at the start of the segment fileNumber ds 2 source file number dataNumber ds 2 data area number (0 for code segments) lastDataNumber ds 2 last data area number used lastFileNumber ds 2 last file number used ; ; Scalars passed to and from the shell ; merr ds 2 maximum error level allowed merrf ds 2 maxiumum error level found so far lops ds 2 language operations kflag ds 2 keep flag mflags ds 4 minus flags pflags ds 4 plus flags org ds 4 origin end **************************************************************** * * GetCh - get the current character from the script * * Inputs: * r0 -