Files
Shawn Quick dfcaae62dd Add qlink, the disk tools, and a bootable ProDOS 8 image.
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.
2026-10-16 14:41:55 -07:00

1 line
10 KiB
Plaintext

;
;
;===========================================================
; Set flag to show or not show GSOS calls.
;===========================================================
;
; IN: PUSH:WORD - TRUE to display calls to GS/OS, FALSE to not show.
;
ResourceShowGSOS
;
@showFlag equ inputs Input parameter.
;
;
jsr startCall Allocate direct page, set <data.
;
lda <@showFlag
sta showGSOS
;
brl pop2_NoErr Fix stack, return no error, exit tool.
;
;
;==================================================
; Check parameters to BlockMove.
;==================================================
;
checkBlockMove
;
@saveWork equ 1
@retAddr equ @saveWork+4
@size equ @retAddr+3
@des equ @size+4
@src equ @des+4
;
pei <work+2 Save.
pei <work
;
pha
pha
lda @src+6,s
pha
lda @src+6,s
pha
_FindHandle
pla
sta <work
pla
sta <work+2
;
ldy #2
lda [<work],y
sta @ptr+2
lda [<work]
sta @ptr
;
ldy #handSize
lda [<work],y
clc
adc @ptr
sta @endBlk
iny
iny
lda [<work],y
adc @ptr+2
sta @endBlk+2
;
lda @des,s
clc
adc @size,s
sta @endDes
lda @des+2,s
adc @size+2,s
sta @endDes+2
;
lda @src,s
clc
adc @size,s
sta @endSrc
lda @src+2,s
adc @size+2,s
sta @endSrc+2
;
;
; --- Check bounds.
;
lda @src+2,s
tax
lda @src,s
jsr @ckBounds
bcs @debugErr
;
lda @des+2,s
tax
lda @des,s
jsr @ckBounds
bcs @debugErr
;
ldx @endDes+2
lda @endDes
jsr @ckBounds
bcs @debugErr
;
ldx @endSrc+2
lda @endSrc
jsr @ckBounds
bcs @debugErr
;
pla Restore.
sta <work
pla
sta <work+2
;
ldx #$2B02 Call BlockMove.
jml $E10000
;
@debugErr brk 0
;
@endBlk dc.l 0
@endDes dc.l 0
@endSrc dc.l 0
@ptr dc.l 0
;
;
;
;---------------------------------------------------
; Check if address is inside handle.
;---------------------------------------------------
;
; IN: x/a = address to check.
;
; OUT: Carry set if not inside.
;
@ckBounds
;
; --- Check if less than start.
;
cpx @ptr+2
bcc @bad
bne @ok100
cmp @ptr
bcc @bad
@ok100
;
;
; --- Check if greater than end.
;
cpx @endBlk+2
bcc @good
bne @bad
cmp @endBlk
bcc @good
beq @good
@bad sec
rts
;
@good clc
rts
;
;
;=================================
; Dump GS/OS calls.
;=================================
;
STRING PASCAL
showGSOS dc.w 0 TRUE to show GS/OS calls.
;
debugOScall
;
@work1 equ 1
@window equ @work1+4
;
@savePort equ @window+4
@savebank equ @savePort+4
@savePage equ @saveBank+1
@returnAddr equ @savePage+2
@callNum equ @returnAddr+3
@paramTable equ @callNum+2
;
lda showGSOS
bne @ok2
brl @exit
;
@ok2 phd
phb
phk
plb
;
pha
pha
_GetPort
;
tsc
sec
sbc #@savePort-1
tcs
tcd
;
pha Space for result.
pha
pea @windParam>>16 Pass pointer to window parameter list.
pea @windParam
_NewWindow
pla
plx
sta <@window
stx <@window+2
;
phx
pha
_SetPort
;
;
; --- Display OS call.
;
pea 10
pea 10
_MoveTo
;
lda <@callNum
cmp #$2000
bcs @ok1
;
@outOfRange pea @rangeErr>>16
pea @rangeErr
_DrawString
;
pea 140
pea 10
_MoveTo
;
lda <@callNum
jsr printWord
brl @wait
@rangeErr dc.b 'Bad call number:'
;
;
@ok1 and #$DFFF
cmp #$0019
bcs @outOfRange
asl a
tax
pea @callList>>16
lda @callList,x
pha
_DrawString
;
;
ldx #-2
lda <@callNum
@lop1 inx
inx
cmp @calls,x
bne @lop1
;
lda #20
sta <@work1
stz <@work1+2
;
lda @callTemplates,x Get index to form table.
tax
@lop2 phx
;
pea 10
pei <@work1
_MoveTo
;
plx
phx
pea @callTemplates>>16
lda |2,x
pha
_DrawString
;
pea 200
pei <@work1
_MoveTo
;
ldy <@work1+2
plx
phx
lda |0,x
bne @doLong
;
lda [<@paramTable],y
iny
iny
sty <@work1+2
jsr printWord
bra @next1
;
@doLong lda [<@paramTable],y
pha
iny
iny
lda [<@paramTable],y
iny
iny
sty <@work1+2
tax
pla
jsr printLong
;
plx
phx
lda |0,x
cmp #1
beq @next1
;
ldy <@work1+2
lda [<@paramTable],y
pha
iny
iny
lda [<@paramTable],y
iny
iny
sty <@work1+2
tax
pla
jsr printLong
;
@next1 lda <@work1
clc
adc #10
sta <@work1
;
plx
inx
inx
inx
inx
lda |0,x
bpl @lop2
;
;
; --- Wait for user to continue.
;
@wait pha Space for result.
pea %0000010000101110 Pass event mask.
pea @eventRec>>16 Pass event record.
pea @eventRec
_GetNextEvent
pla
beq @wait
;
;
; --- Close window and make the OS call.
;
pei <@window+2
pei <@window
_CloseWindow
;
tsc
clc
adc #@savePort-1
tcs
;
_SetPort Restore port.
plb Restore data bank.
pld
@exit jml >$E100B0 GS/OS stack entry point.
;
@eventRec dcb.b 16,0
;
@callList dc.w @call00
dc.w @call01
dc.w @call02
dc.w @call03
dc.w @call04
dc.w @call05
dc.w @call06
dc.w @call07
dc.w @call08
dc.w @call09
dc.w @call0A
dc.w @call0B
dc.w @call0C
dc.w @call0D
dc.w @call0E
dc.w @call0F
dc.w @call10
dc.w @call11
dc.w @call12
dc.w @call13
dc.w @call14
dc.w @call15
dc.w @call16
dc.w @call17
dc.w @call18
;
@call00 dc.w 'Call 00'
@call01 dc.w 'Call 01, CREATE'
@call02 dc.w 'Call 02'
@call03 dc.w 'Call 03'
@call04 dc.w 'Call 04'
@call05 dc.w 'Call 05'
@call06 dc.w 'Call 06'
@call07 dc.w 'Call 07'
@call08 dc.w 'Call 08'
@call09 dc.w 'Call 09'
@call0A dc.w 'Call 0A'
@call0B dc.w 'Call 0B'
@call0C dc.w 'Call 0C'
@call0D dc.w 'Call 0D'
@call0E dc.w 'Call 0E'
@call0F dc.w 'Call 0F'
@call10 dc.w 'Call 10, OPEN'
@call11 dc.w 'Call 11'
@call12 dc.w 'Call 12, READ'
@call13 dc.w 'Call 13, WRITE'
@call14 dc.w 'Call 14, CLOSE'
@call15 dc.w 'Call 15'
@call16 dc.w 'Call 16, SET MARK'
@call17 dc.w 'Call 17'
@call18 dc.w 'Call 18, SET EOF'
;
@calls dc.w CREATE
dc.w OPEN
dc.w READ
dc.w WRITE
dc.w CLOSE
dc.w SET_MARK
dc.w SET_EOF
;
@callTemplates dc.w @createForm
dc.w @openForm
dc.w @readForm
dc.w @writeForm
dc.w @closeForm
dc.w @markForm
dc.w @EOFform
;
@createForm dc.w 0,@crePCountStrg
dc.w 1,@crePathnameStrg
dc.w 0,@creAccessStrg
dc.w 0,@creFileTypeStrg
dc.w 1,@creAuxTypeStrg
dc.w 0,@creStorageTypeStrg
dc.w 1,@creDataEOFStrg
dc.w 1,@creResEOFStrg
dc.w $FFFF
;
@crePCountStrg dc.b 'crePCount'
@crePathnameStrg dc.b 'crePathname'
@creAccessStrg dc.b 'creAccess'
@creFileTypeStrg dc.b 'creFileType'
@creAuxTypeStrg dc.b 'creAuxType'
@creStorageTypeStrg dc.b 'creStorageType'
@creDataEOFStrg dc.b 'creDataEOF'
@creResEOFStrg dc.b 'creResEOF'
;
@openForm dc.w 0,@openPCountStrg
dc.w 0,@openRefNumStrg
dc.w 1,@openPathnameStrg
dc.w 0,@openRequestAccStrg
dc.w 0,@openForkNumStrg
dc.w 0,@openAccessStrg
dc.w 0,@openFileTypeStrg
dc.w 1,@openAuxTypeStrg
dc.w 0,@openStorageTypeStrg
dc.w 2,@openCreateTimeStrg
dc.w 2,@openModTimeStrg
dc.w 1,@openOptionsStrg
dc.w 1,@openDataEOFStrg
dc.w 1,@openDataBlocksStrg
dc.w 1,@openResEOFStrg
dc.w 1,@openResBlocksStrg
dc.w $FFFF
;
@openPCountStrg dc.b 'openPCount'
@openRefNumStrg dc.b 'openRefNum'
@openPathnameStrg dc.b 'openPathname'
@openRequestAccStrg dc.b 'openRequestAcc'
@openForkNumStrg dc.b 'openForkNum'
@openAccessStrg dc.b 'openAccess'
@openFileTypeStrg dc.b 'openFileTypeStrg'
@openAuxTypeStrg dc.b 'openAuxTypeStrg'
@openStorageTypeStrg dc.b 'openStorageTypeStrg'
@openCreateTimeStrg dc.b 'openCreateTimeStrg'
@nullStrg dc.b ''
@openModTimeStrg dc.b 'openModTimeStrg'
@openOptionsStrg dc.b 'openOptionsStrg'
@openDataEOFStrg dc.b 'openDataEOFStrg'
@openDataBlocksStrg dc.b 'openDataBlocksStrg'
@openResEOFStrg dc.b 'openResEOFStrg'
@openResBlocksStrg dc.b 'openResBlocksStrg'
;
;
@readForm dc.w 0,@readPCountStrg
dc.w 0,@readRefNumStrg
dc.w 1,@readDataStrg
dc.w 1,@readSizeStrg
dc.w 1,@readTransferStrg
dc.w $FFFF
;
@readPCountStrg dc.b 'readPCountStrg'
@readRefNumStrg dc.b 'readRefNumStrg'
@readDataStrg dc.b 'readDataStrg'
@readSizeStrg dc.b 'readSizeStrg'
@readTransferStrg dc.b 'readTransferStrg'
;
;
@writeForm dc.w 0,@writePCountStrg
dc.w 0,@writeRefNumStrg
dc.w 1,@writeDataStrg
dc.w 1,@writeSizeStrg
dc.w 1,@writeTransferStrg
dc.w $FFFF
;
@writePCountStrg dc.b 'writePCountStrg'
@writeRefNumStrg dc.b 'writeRefNumStrg'
@writeDataStrg dc.b 'writeDataStrg'
@writeSizeStrg dc.b 'writeSizeStrg'
@writeTransferStrg dc.b 'writeTransferStrg'
;
;
@closeForm dc.w 0,@closePCountStrg
dc.w 0,@closeRefNumStrg
dc.w $FFFF
;
@closePCountStrg dc.b 'closePCountStrg'
@closeRefNumStrg dc.b 'closeRefNumStrg'
;
;
@markForm dc.w 0,@markPCountStrg
dc.w 0,@markRefNumStrg
dc.w 0,@markBaseStrg
dc.w 1,@markPositionStrg
dc.w $FFFF
;
@markPCountStrg dc.b 'markPCountStrg'
@markRefNumStrg dc.b 'markRefNumStrg'
@markBaseStrg dc.b 'markBaseStrg'
@markPositionStrg dc.b 'markPositionStrg'
;
;
@EOFform dc.w 0,@EOFPCountStrg
dc.w 0,@EOFRefNumStrg
dc.w 0,@EOFBaseStrg
dc.w 1,@EOFPositionStrg
dc.w $FFFF
;
@EOFPCountStrg dc.b 'EOFPCountStrg'
@EOFRefNumStrg dc.b 'EOFRefNumStrg'
@EOFBaseStrg dc.b 'EOFBaseStrg'
@EOFPositionStrg dc.b 'EOFPositionStrg'
;
;
@windParam dc.w @endParam-@windParam Size of list.
dc.w %0010000001100101 Frame.
dc.l 0 Pointer to window's title.
dc.l 0 RefCon
dc.w 0,0,0,0 Full Size (0= default)
dc.l 0 Color Table Pointer
dc.w 0,0 Origin.
dc.w 0,0 Data area size.
dc.w 0,0 Maximum content size.
dc.w 0,0 Amount to scroll.
dc.w 0,0 Amount to page.
dc.l 0 Infomation bar refCon.
dc.w 0 Info bar height
dc.l 0,0,0 Frame, info bar, content defProcs.
dc.w 15,30,190,380 Position and size.
dc.l $FFFFFFFF Plane to put window up in.
dc.l 0 Window record address (allocate).
@endParam
;
STRING ASIS
;
;
;----------------------------------
; Print long value.
;----------------------------------
;
; IN: x/a = long value to print.
; Pen position set at place to print.
;
printLong phx Pass value.
pha
pea @strg>>16
pea @strg+2
pea 8
_Long2Hex
;
pea @strg>>16
pea @strg
_DrawString
rts
;
@strg dc.b 9,'$00000000'
;
;
;----------------------------------
; Print word value.
;----------------------------------
;
; IN: a = long value to print.
; Pen position set at place to print.
;
printWord pha Pass value.
pea @strg>>16
pea @strg+2
pea 4
_Int2Hex
;
pea @strg>>16
pea @strg
_DrawString
rts
;
@strg dc.b 5,'$0000'
;