mirror of
https://github.com/marketideas/qasm.git
synced 2026-10-24 22:02:28 +00:00
Move the assembler to src/qasm. qlink links OMF 1.0 and 2.0 from a script. makeBin flattens a load file, qomf dumps OMF, and qpro builds ProDOS volumes. APW and MPW assemble through the ORCA front end. Relocatable modules emit OMF objects. Listings stay off unless -l is set. make boot assembles the GS/OS 6.0.1 ProDOS 8 kernel and BASIC.SYSTEM into an 800K volume. BASIC.SYSTEM accepts ls and pfx, and its splash reports PRODOS BASIC 2.0, copyright 1983-2026. IIGS.601.SRC is the source and the BASIC.SYSTEM oracle that image is built from.
1 line
3.5 KiB
Plaintext
1 line
3.5 KiB
Plaintext
*************************************************************************
|
|
* *
|
|
* System Loader Macros *
|
|
* by *
|
|
* Lou Infeld *
|
|
* *
|
|
* Copyright Apple Computer, Inc. 1986-1992 *
|
|
* All Rights Reserved *
|
|
* *
|
|
*************************************************************************
|
|
|
|
;...............................................................
|
|
;
|
|
; Stack Cleanup
|
|
;
|
|
; Returns stack to the original state that existed before
|
|
; the internal function was called. In addition, the
|
|
; Carry is set according to the status in the A register.
|
|
;
|
|
; The macro call looks like this:
|
|
;
|
|
; Stack_Cleanup param_bytes
|
|
;
|
|
; where 'param_bytes' is the number of bytes on the stack
|
|
; that represent input parameters.
|
|
;
|
|
; NOTE: The function must have been called with a JSR
|
|
; (i.e. there's a two-byte return address on the stack)
|
|
;
|
|
;...............................................................
|
|
MACRO
|
|
Stack_Cleanup ¶m_bytes
|
|
|
|
lcla &count
|
|
tay
|
|
pla
|
|
sta ¶m_bytes-1,s
|
|
IF &s2i(¶m_bytes)>4 OR (&s2i(¶m_bytes) MOD 2)<>0 then
|
|
tsc
|
|
clc
|
|
adc #¶m_bytes-2
|
|
tcs
|
|
ELSE
|
|
&count seta &s2i(¶m_bytes)-2
|
|
while &count > 0 do
|
|
pla
|
|
&count seta &count-2
|
|
endwhile
|
|
ENDIF
|
|
tya
|
|
cmp #1
|
|
MEND
|
|
|
|
;...............................................................
|
|
;
|
|
; Define a sequence of hexadecimal bytes
|
|
;
|
|
; Usage:
|
|
;
|
|
; [label] hex hexstring
|
|
;
|
|
; hexstring must consist of hexadecimal digits ONLY (0..9, A..F, a..f)
|
|
; and must contain an even number of digits. No spaces, commas, or
|
|
; other characters are allowed.
|
|
;
|
|
; The macro's primary purpose is to allow the definition of pixel
|
|
; maps (such as icons or cursors) while still allowing the programmer
|
|
; to "see" the defined image at the source code level.
|
|
;
|
|
;...............................................................
|
|
MACRO
|
|
hex &arg
|
|
lclc &bytes,&hexStr
|
|
; put the arg into a local variable
|
|
&hexStr setc &arg
|
|
; make sure we've got an even # of bytes
|
|
if (&len(&hexStr) AND 1) <> 0 then
|
|
aerror 'Odd number of bytes in HEX directive'
|
|
&hexStr setc &concat(&hexstr,'0')
|
|
endif
|
|
; start the dc.b argument string
|
|
&bytes setc &concat('$',&substr(&hexStr,1,2))
|
|
&hexStr setc &substr(&hexStr,3, &len(&hexStr)-2)
|
|
; while there's something in the supplied argument string...
|
|
while &len(&hexStr)>0 do
|
|
; copy 2 digits from the string to the dc.b string...
|
|
&bytes setc &concat(&bytes,',$',&substr(&hexStr,1,2))
|
|
; then remove the first two digits from the supplied string
|
|
&hexStr setc &substr(&hexStr,3, &len(&hexStr)-2)
|
|
endwhile
|
|
; produce the actual bytes
|
|
dc.b &bytes
|
|
MEND
|
|
|
|
|
|
Macro
|
|
&label PointAddress &y,&x ;macro generates memory address equate for given point
|
|
lcla &lineBase, &pixOffset
|
|
&lineBase seta &y*$a0 ;each line is $A0 bytes
|
|
&pixOffset seta &x/4 ;640 mode, 4 pixels per byte
|
|
&label equ $E12000+&lineBase+&pixOffset
|
|
EndM
|
|
|
|
|
|
Macro
|
|
LoadSegCheck
|
|
;ensure this segment resides in non-bank-switched memory
|
|
if &SysSeg <> 'Loader ' then
|
|
AError &concat(&SysMod, ' does not reside in "Loader" segment')
|
|
endif
|
|
EndM
|