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
7.5 KiB
Plaintext
1 line
7.5 KiB
Plaintext
**********************************************************************
|
|
*
|
|
* GSTextEdit Version 1.0
|
|
* File: format.aii
|
|
*
|
|
* Copyright Apple Computer, Inc. 1988-89
|
|
* All rights reserved
|
|
*
|
|
*
|
|
*
|
|
*
|
|
* Notes
|
|
*
|
|
* All the routines in GSTextEdit must be called in full native mode and
|
|
* return that way.
|
|
*
|
|
* All the files in GSTextEdit must be assembled with the "-unsafe"
|
|
* option to pass unresolved references to the linker.
|
|
*
|
|
*
|
|
*
|
|
*
|
|
* Change History
|
|
*
|
|
* 30 May 89 Dave Good
|
|
*
|
|
* Cleaned up comments for final release.
|
|
*
|
|
**********************************************************************
|
|
|
|
|
|
INCLUDE 'GlobalIncludes'
|
|
INCLUDE 'E16.Font'
|
|
|
|
|
|
****************************************************************
|
|
* This routine takes a pointer to the new style block in A,X
|
|
****************************************************************
|
|
AddToStyleList PROCNAME Export
|
|
|
|
;---------------------------------------------------------------
|
|
stax MemoryPtr ;save our input pointer
|
|
|
|
ldy #TERecord.StyleList
|
|
jsr GetRecordLong
|
|
jsr DerefAX
|
|
stax TempPtr
|
|
|
|
stzl TextStyleOffset
|
|
|
|
scanLoop ldy #2
|
|
lda [TempPtr],y
|
|
and [TempPtr]
|
|
cmp #$FFFF
|
|
beq atEnd
|
|
checkItem ldy #TEStyle.fontID
|
|
@loop lda [TempPtr],y
|
|
cmp [MemoryPtr],y
|
|
bne noMatch
|
|
iny
|
|
iny
|
|
cpy #TEStyle.RecordSize
|
|
blt @loop
|
|
|
|
bra allDone
|
|
;---------------------------------------------------------------
|
|
noMatch lda #TEStyle.RecordSize
|
|
addl TextStyleOffset
|
|
lda TempPtr
|
|
clc
|
|
adc #TEStyle.RecordSize
|
|
sta TempPtr
|
|
bcc scanLoop
|
|
inc TempPtr+2
|
|
bra scanLoop
|
|
;---------------------------------------------------------------
|
|
atEnd ldy #TERecord.StyleList
|
|
jsr GetRecordLong
|
|
PushAX
|
|
PushAX
|
|
PushAX
|
|
jsr GetHandleSize
|
|
stax MoveLength
|
|
clc
|
|
adc #TEStyle.RecordSize
|
|
bcc @1
|
|
inx
|
|
@1 jsr SetHandleSize
|
|
bcs memoryError
|
|
jsr DerefHandle
|
|
clc
|
|
adc MoveLength
|
|
sta TempPtr
|
|
txa
|
|
adc MoveLength+2
|
|
sta TempPtr+2
|
|
|
|
lda TempPtr ;move back before the terminator.
|
|
sec
|
|
sbc #4
|
|
sta TempPtr
|
|
bcs @2
|
|
dec TempPtr+2
|
|
@2
|
|
ldy #TEStyle.fontID
|
|
@loop lda [MemoryPtr],y
|
|
sta [TempPtr],y
|
|
iny
|
|
iny
|
|
cpy #TEStyle.RecordSize
|
|
blt @loop
|
|
|
|
jsr TerminateTempPtr
|
|
|
|
ldy #TEStyle.fontID ;force an install font to calculate the
|
|
lda [TempPtr],y ;..height and ascent fields of the
|
|
dec a ;..TextEdit record
|
|
ldy #GrafPort.FontID
|
|
sta [DrawPortPtr],y
|
|
;---------------------------------------------------------------
|
|
allDone jsr GetPort
|
|
jsr SetDrawPort
|
|
jsr InstallFontAndColor
|
|
jsr ReleaseFont
|
|
jsr SetPort
|
|
clc
|
|
rts
|
|
;---------------------------------------------------------------
|
|
memoryError pla ;cleanup the stack
|
|
pla
|
|
stzl TextStyleOffset ;return the initial style for this item
|
|
rts ;the carry is SET and the error is in X-Reg
|
|
;---------------------------------------------------------------
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
InstallFontAndColor PROCNAME Export
|
|
|
|
;---------------------------------------------------------------
|
|
jsr SetupStylePtr ;the port must be set to the draw port
|
|
|
|
ldy #TEStyle.foreColor ;set the foreground color
|
|
lda [TempPtr],y
|
|
ldy #GrafPort.FGColor
|
|
sta [DrawPortPtr],y
|
|
|
|
ldy #TEStyle.backColor ;set the background color
|
|
lda [TempPtr],y
|
|
ldy #GrafPort.BGColor
|
|
sta [DrawPortPtr],y
|
|
|
|
ldy #TEStyle.fontID+2 ;push the fontID
|
|
lda [TempPtr],y
|
|
pha
|
|
dey
|
|
dey
|
|
lda [TempPtr],y
|
|
pha
|
|
PushWord #$0000 ;push the scale word (yes, scale)
|
|
PushZPtr TempPtr ;push a pointer to the FntStatRec
|
|
_InstallWithStats
|
|
ldy #TERecord.theFontToRelease ;save the font to release
|
|
lda TempPtr
|
|
sta [RecordPtr],y
|
|
iny
|
|
iny
|
|
lda TempPtr+2
|
|
sta [RecordPtr],y
|
|
ldy #TERecord.theFontStats ;save the fontStatBits
|
|
lda TempWord
|
|
sta [RecordPtr],y
|
|
|
|
jsr SetupStylePtr ;reset the style pointer
|
|
ldy #GrafPort.fontID+2 ;reset the font ID in the style list
|
|
lda [DrawPortPtr],y
|
|
tax
|
|
dey
|
|
dey
|
|
lda [DrawPortPtr],y
|
|
ldy #TEStyle.fontID
|
|
sta [TempPtr],y
|
|
iny
|
|
iny
|
|
txa
|
|
sta [TempPtr],y
|
|
|
|
rts
|
|
;---------------------------------------------------------------
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
ReleaseFont PROCNAME Export
|
|
|
|
ldy #TERecord.theFontStats ;save the fontStatBits
|
|
lda [RecordPtr],y
|
|
and #purgeBit
|
|
beq @skip
|
|
|
|
ldy #TERecord.theFontToRelease+2
|
|
lda [RecordPtr],y
|
|
pha
|
|
dey
|
|
dey
|
|
lda [RecordPtr],y
|
|
pha
|
|
ldy #TERecord.theFontStats ;save the fontStatBits
|
|
lda [RecordPtr],y
|
|
pha
|
|
_SetPurgeStat
|
|
|
|
@skip rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
Format1Proc PROC
|
|
|
|
;---------------------------------------------------------------
|
|
EXPORT GetLeftEdge
|
|
EXPORT GetLeftMargin
|
|
EXPORT GetLeftIndent
|
|
;---------------------------------------------------------------
|
|
|
|
;---------------------------------------------------------------
|
|
GetLeftEdge lda TextOffset
|
|
ora TextOffset+2
|
|
beq GetLeftIndent
|
|
|
|
decl TextOffset
|
|
jsr FindTextPtr
|
|
incl TextOffset
|
|
|
|
lda [TextPtr]
|
|
and #$00FF
|
|
cmp #CR
|
|
beq GetLeftIndent
|
|
;---------------------------------------------------------------
|
|
GetLeftMargin jsr SetupRulerPtr
|
|
ldy #TERuler.leftMargin
|
|
lda [TempPtr],y
|
|
rts
|
|
;---------------------------------------------------------------
|
|
GetLeftIndent jsr SetupRulerPtr
|
|
ldy #TERuler.leftIndent
|
|
lda [TempPtr],y
|
|
rts
|
|
;---------------------------------------------------------------
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetRightMargin PROCNAME Export
|
|
|
|
jsr SetupRulerPtr
|
|
ldy #TERuler.rightMargin
|
|
lda [TempPtr],y
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetJust PROCNAME Export
|
|
|
|
jsr SetupRulerPtr
|
|
ldy #TERuler.just
|
|
lda [TempPtr],y
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetTabType PROCNAME Export
|
|
|
|
jsr SetupRulerPtr
|
|
ldy #TERuler.tabType
|
|
lda [TempPtr],y
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetTabNumber PROCNAME Export
|
|
|
|
jsr SetupRulerPtr
|
|
ldy #TERuler.numberOfTabs
|
|
lda [TempPtr],y
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetTabPtr PROCNAME Export
|
|
|
|
jsr SetupRulerPtr
|
|
lda #TERuler.numberOfTabs
|
|
addl TempPtr
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
SetupStylePtr PROCNAME Export
|
|
|
|
ldy #TERecord.StyleList
|
|
lda [RecordPtr],y
|
|
sta TempPtr
|
|
ldy #TERecord.StyleList+2
|
|
lda [RecordPtr],y
|
|
sta TempPtr+2
|
|
ldy #2
|
|
lda [TempPtr]
|
|
clc
|
|
adc TextStyleOffset
|
|
tax
|
|
lda [TempPtr],y
|
|
adc TextStyleOffset+2
|
|
sta TempPtr+2
|
|
stx TempPtr
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
SetupRulerPtr PROCNAME Export
|
|
|
|
ldy #TERecord.RulerList
|
|
lda [RecordPtr],y
|
|
sta TempPtr
|
|
ldy #TERecord.RulerList+2
|
|
lda [RecordPtr],y
|
|
sta TempPtr+2
|
|
ldy #2
|
|
lda [TempPtr],y
|
|
tax
|
|
lda [TempPtr]
|
|
stax TempPtr
|
|
rts
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
GetTextHeightAndAscent PROCNAME Export
|
|
|
|
;---------------------------------------------------------------
|
|
jsr SetupWidthTable ;this sets up the correct width table
|
|
|
|
jsr SetupRulerPtr ;cache the height of the font
|
|
ldy #TERuler.extraLS
|
|
lda [TempPtr],y
|
|
sta TempWord ;save the extra line spaceing
|
|
|
|
ldy #WidthTable.ascent ;as long as we don't allocate memory, we
|
|
lda [WidthTablePtr],y ;..are OK here
|
|
clc
|
|
adc TempWord
|
|
pha
|
|
ldy #WidthTable.height
|
|
lda [WidthTablePtr],y
|
|
clc
|
|
adc TempWord
|
|
pha
|
|
|
|
jsr FreeWidthTable
|
|
|
|
PullAX
|
|
rts
|
|
;---------------------------------------------------------------
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
|
|
END
|