mirror of
https://github.com/marketideas/qasm.git
synced 2026-10-25 13:02:45 +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
2.6 KiB
Plaintext
1 line
2.6 KiB
Plaintext
; include 'all.macros'
|
|
include 'equates.i'
|
|
|
|
MSB ON
|
|
|
|
EXPORT GetDec32
|
|
EXPORT GetHex32
|
|
|
|
************************************************************
|
|
*
|
|
GetHex32 PROC EXPORT
|
|
*
|
|
* Get a 32-bit hexadecimal number from the input buffer.
|
|
*
|
|
* Inputs:
|
|
* InputBuffer input buffer
|
|
* BUFLEN length of input
|
|
* y current buf position
|
|
*
|
|
* Outputs:
|
|
* AL/AH/AB/T1 number
|
|
* y new buf position
|
|
*
|
|
* External Refs:
|
|
IMPORT InputBuffer
|
|
IMPORT BUFLEN
|
|
IMPORT SkipSpace
|
|
IMPORT DIGITCNT
|
|
import UPSHIFT
|
|
*
|
|
* Entry State:
|
|
longa off
|
|
longi off
|
|
*
|
|
************************************************************
|
|
|
|
stz AL ; zero the value
|
|
stz AH
|
|
stz AB
|
|
stz T1
|
|
|
|
jsr SkipSpace
|
|
bcs @Error
|
|
|
|
; Do all of the digits.
|
|
|
|
@Loop lda InputBuffer,y
|
|
cmp #' '
|
|
beq @Done
|
|
|
|
cmp #'0'
|
|
blt @Error
|
|
cmp #'9'+1
|
|
bge @CheckHex
|
|
sec
|
|
sbc #'0'
|
|
bra @GotDigit
|
|
|
|
@CheckHex jsr UPSHIFT
|
|
cmp #'A'
|
|
blt @Error
|
|
cmp #'F'+1
|
|
bge @Error
|
|
sec
|
|
sbc #'A'-10
|
|
|
|
@GotDigit ldx #$04 ; shift value left 4 bits
|
|
@ShiftLoop asl AL
|
|
rol AH
|
|
rol AB
|
|
rol T1
|
|
dex
|
|
bne @ShiftLoop
|
|
|
|
ora AL ; or in the new digit
|
|
sta AL
|
|
|
|
inc DIGITCNT
|
|
|
|
iny
|
|
cpy BUFLEN ; Are there any more digits?
|
|
blt @Loop
|
|
|
|
@Done clc
|
|
rts
|
|
|
|
@Error sec
|
|
rts
|
|
|
|
|
|
|
|
************************************************************
|
|
*
|
|
GetDec32 PROC EXPORT
|
|
*
|
|
* Get a 32-bit decimal number from the input buffer.
|
|
*
|
|
* Inputs:
|
|
* InputBuffer input buffer
|
|
* BUFLEN length of input
|
|
* y current buf position
|
|
*
|
|
* Outputs:
|
|
* AL/AH/AB/T1 number
|
|
* y new buf position
|
|
*
|
|
* External Refs:
|
|
IMPORT InputBuffer
|
|
IMPORT BUFLEN
|
|
IMPORT SkipSpace
|
|
IMPORT DIGITCNT
|
|
*
|
|
* Entry State:
|
|
longa off
|
|
longi off
|
|
*
|
|
************************************************************
|
|
|
|
stz AL ; zero the value
|
|
stz AH
|
|
stz AB
|
|
stz T1
|
|
|
|
jsr SkipSpace
|
|
bcs @Error
|
|
|
|
; Do all of the digits.
|
|
|
|
@Loop lda InputBuffer,y
|
|
cmp #' '
|
|
beq @Done
|
|
|
|
cmp #'0'
|
|
blt @Error
|
|
cmp #'9'+1
|
|
bge @Error
|
|
sec
|
|
sbc #'0'
|
|
|
|
pha ; save the value of the digit
|
|
|
|
lda T1 ; save the current value
|
|
pha
|
|
lda AB
|
|
pha
|
|
lda AH
|
|
pha
|
|
lda AL
|
|
|
|
; Multiply the current value by 10.
|
|
|
|
asl AL ; shift
|
|
rol AH
|
|
rol AB
|
|
rol T1
|
|
|
|
asl AL ; shift
|
|
rol AH
|
|
rol AB
|
|
rol T1
|
|
|
|
clc ; add
|
|
adc AL
|
|
sta AL
|
|
pla
|
|
adc AH
|
|
sta AH
|
|
pla
|
|
adc AB
|
|
sta AB
|
|
pla
|
|
adc T1
|
|
sta T1
|
|
|
|
asl AL ; shift
|
|
rol AH
|
|
rol AB
|
|
rol T1
|
|
|
|
; Add in the new digit.
|
|
|
|
clc
|
|
pla
|
|
adc AL
|
|
sta AL
|
|
bcc @Next
|
|
inc AH
|
|
bne @Next
|
|
inc AB
|
|
bne @Next
|
|
inc T1
|
|
|
|
@Next inc DIGITCNT
|
|
|
|
iny
|
|
cpy BUFLEN ; Are there any more digits?
|
|
blt @Loop
|
|
|
|
@Done clc
|
|
rts
|
|
|
|
@Error sec
|
|
rts
|
|
|
|
|
|
|
|
|
|
SkipSpace PROC EXPORT
|
|
IMPORT InputBuffer
|
|
IMPORT BUFLEN
|
|
import START
|
|
|
|
lda InputBuffer,y
|
|
cmp #' '
|
|
bne @Done
|
|
iny
|
|
cpy BUFLEN
|
|
blt SkipSpace
|
|
sec
|
|
rts
|
|
@Done clc
|
|
rts
|
|
|
|
EndP
|
|
END |