home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
GEOSApps
/
RPN128-SRC.SFX
/
rpntables
(
.txt
)
< prev
next >
Wrap
GEOS ConVerT
|
1990-02-12
|
25KB
|
691 lines
RPNtables
SEQ formatted GEOS file V1.0
Star NX-10
OP V2.0 or higher
;"RPNconst
BLASTER'S CONVERTER V2.5
geosSym.RPN
geosMac
Write Image V2.1
geoWrite V1.1
Initialization, Icon definitions, key handler for RPN 64
; *****************************************************************
; RPN 128
; initialization routine, icon definitions
; by Robert A Knop Jr.
; based very strongly on RPN 64
;Using SamDA code from GeoProgrammer by Berkeley Softworks.
; ***************************************************************
.noeqin ;during assembler's first pass.
@.include geosSym
;get GEOS definitions
@.include geosMac
;get GEOS macro definitions
@.include RPNconst
config == $ff00
;A couple of defs. for the 128
graphicsMode == $003f
.eqin
; The source code for
@RPN 128
is broken into 7 files:
; RPN128.lnk Linker Command File
; RPNHdr Header Record
; RPNtables Icon Definition, Key Handler, Init. Routine
; RPNroutines Routines called by Icons et. al.
; RPNsupport More routines, of a "supporteseque" nature
; RPNram .ramsect
; RPNconst Equates included into several of the above
;This code also includes the files geosSym and geosMac, which come with geoProgrammer
; Hopefully, this source will serve as an example of how one may call BASIC's floating
; point routines from GEOS. An indispensable reference for the 128 version of the
; program was Otis Cowper's book, below. Thanks also to Jim Collette and Dave
; Ferguson for random help with and suggestions about debugging problems.
REFERENCES
; Andrews, Mark,
Commodore 128 Assembly Language Programming
. Sams, 1986.
; Berkeley Softworks,
The Official GEOS Programmer's Reference Guide
. Bantam, 1987.
; CBM,
Commodore 64 Programmer's Reference Guide
. Commodore, 1982.
; Cowper, Otis,
Mapping the Commodore 128
. COMPUTE! Books, 1986.
; Heeb, Dan,
COMPUTE!'s Vic-20 and C-64 Tool Kit: BASIC
. COMPUTE! Books, 1984.
; Leemon, Sheldon,
Mapping The Commodore 64 & 64C
. COMPUTE! Books, 1987.
;**********************************************************************; ;
Initialization routine
; Save application's foreground sreen
; Draw RPN screen
; Initialize icons
;**********************************************************************
@.psect
;Beginning of program
DAStart:
LoadB dispBufferOn,#(ST_WR_FORE) ;allow writes to FG only
LoadW keyVector,Keypress ;Set up keypress handling routine
LoadW r0,(DAEnd-F_ENTRY) ;Clear all of .ramsect after GEOSzero
LoadW r1,F_ENTRY
jsr ClearRam
LoadW leftMargin,#$00
jsr i_MoveData ;Save Applications zero page space so I can use it
.word $0061 ;(also GEOS space under the FAC's)
.word appzpage
.word $009e
LoadW r0,#DrawBox ;point to graphics string to draw RPN screen
jsr GraphicsString
bit graphicsMode ;Check bit 7 of graphicsMode; if set, we are in 80
bmi 20$ ; columns, so don't do colors
LoadW r0,COLOR_MATRIX+(DA_TOP*40)
lda COLOR_MATRIX+$27 ;Pick color from upper right card
ldx #$00
5$ ldy #(DA_LEFT) ;Fill DA with this color
10$ sta (r0),y
cpy #(DA_LEFT+DA_WIDTH)
bne 10$
cpx #(DA_HEIGHT)
beq 20$
AddVW $28,r0
bra 5$
20$ LoadW r0,#IconTable ;point to icon definition table
jsr DoIcons
jsr Welcome ;Print opening message on screen
@rts
;Jump to GEOS main loop
@DrawBox:
;graphics string table to clear screen
.byte NEWPATTERN,0 ;set new pattern value (white)
.byte MOVEPENTO ;move pen to:
@DrawBox:
;graphics string table to clear screen
.byte NEWPATTERN,0 ;set new pattern value (white)
.byte MOVEPENTO ;move pen to:
.word $8000+DA_LEFT*8 ;top left corner of DB (in pixels)
.byte DA_TOP*8
.byte RECTANGLETO ;draw filled rectangle to bottom right corner
.word $8000+(DA_LEFT+DA_WIDTH)*8 - 1
.byte (DA_TOP+DA_HEIGHT)*8 - 1
;bottom right corner of DB (in pixels)
.byte NEWPATTERN,1 ;set new pattern value (black)
.byte FRAME_RECTO ;draw frame to...
.word $8000+DA_LEFT*8 ;top left corner of DB (in pixels)
.byte DA_TOP*8
.byte MOVEPENTO
.word $8000+(DA_LEFT+1)*8
.byte (DA_TOP+2)*8
.byte FRAME_RECTO ;Data Screen
.word $8000+(DA_LEFT+12)*8-1
.byte (DA_TOP+DA_HEIGHT-2)*8
.byte LINETO
.word $8000+(DA_LEFT+12)*8-1
.byte DA_TOP*8
.byte MOVEPENTO
.word $8000+(DA_LEFT+12)*8-1
.byte (DA_TOP+DA_HEIGHT-2)*8
.byte FRAME_RECTO ;Entry line
.word $8000+(DA_LEFT+1)*8
.byte (DA_TOP+DA_HEIGHT)*8-1
.byte NULL ;End of graphic string
@Welcome:
LoadW leftMargin,$8000+DATA_LEFT*8+4
LoadW r0,HiThere
LoadB r1H,DATA_TOP*8+12
LoadW r11,$8000+DATA_LEFT*8+4
jsr PutString
10$ CmpBI mouseData,%10000000 ;Wait for click
bne 20$
bra 10$
20$ LoadW leftMargin,#$00
jsr ClearData
jsr PrintRegs
@ rts
HiThere: .byte 26,"RPN 128",27,13,13,"by",13,24,"Robert Knop Jr.",27
.byte 13,13,"For useful info.,"
.byte 13,"hit INV-Enter",13,13
.byte "(Click to begin)",0
Keypress:
lda keyData ;first, check if i
Keypress:
lda keyData ;first, check if it is a number
cmp #'0'
bcc 5$ ;If ASCII is < '0' , go to normal handler
cmp #('9'+1)
bcs 5$ ;If ASCII is > '9', go to normal handler
sub #$30
jsr FlashIcon ;Flash this Icon
sta r0L ;Stick "icon" number in r0L to select icon
@jmp Number
5$ sta temp ;Put ASCII of keypress to temp
ldy #$00
10$ lda keytable,y
cmp temp ;Compare keytable entry to key pressed
beq 20$ ;If match, jump to pointed routine
cmp #$00
beq 90$ ;If zero, there was no match
iny ;set y to point to next entry
bra 10$ ;End of Loop
20$ iny ;Number of the icon this key corresponds to
lda keytable,y
sty temp
jsr FlashIcon ;Flash this Icon
ldy temp
lda keytable,y ;put routine vector @ temp (lb) & temp2 (hb)
sta temp
lda keytable,y
sta temp2
@jmp (temp)
;Jump to appropriate routine
@rts
look4key: .byte "looking for key",0
abt2flash: .byte "about to flash",0
;didFlash:
@FlashIcon:
sta r0L
LoadB r0H,$00
ldx #r0
ldy #$03
jsr DShiftLeft ;Multiply by 8
AddVW $06,r0
clc ;Add IconTable to r0
lda #<IconTable
adc r0L
sta r0L
lda #>IconTable
adc r0H
sta r0H ;Now r0 points to Left
ldy #$00
lda (r0),y ;Left in Bytes
and #%01111111 ;(Turn off high bit)
sta r3L
LoadB r3H,$00
ldx #r3
ldy #$03
jsr DShiftLeft ;Multiply by 8 to get pixels
ldy #$02
lda (r0),y ;Width in Bytes -- multiplty this by 8 too
and #%01111111 ;(After turning off high bit)
sta r4L
LoadB r4H,$00
ldx #r4
ldy #$03
jsr DShiftLeft
AddW r3,r4 ;Add left to width -> right
AddVW $8000,r3 ;Set high bit of left and right
AddVW $8000,r4
ldy #$01
lda (r0),y ;Top in Scanlines
sta r2L
ldy #$03
lda (r0),y ;Height in Scanlines
add r2L
sta r2H ;Bottom in scanlines
jsr InvertRectangle
ldx #$00
ldy #$00
10$ inx ;Count to 16*256 as a pause
cpx #$00
bne 10$
cpy #$10
bne 10$
jsr InvertRectangle
@rts
; table of keys (byte), icons to flash (byte), and routines which should be called when
; said key is pressed (word)
@keytable:
.byte $0d,17 ;Return
.word Enter
.byte 11,17 ;ENTER-- same as return (or vica versa)
.word Enter
.byte ".",10
.word DecimalPoint
.byte "e",11
.word Scinot
.byte KEY_DELETE,16
.word Delete
.byte "+",12
.word AddNums
.byte "-",13
.word SubNums
.byte "*",14
.word MultNums
.byte "/",15
.word DivNums
.byte "^",19
.word Expo
.byte "s",23
.word Sin
.byte "c",24
.word Cos
.byte "t",25
.word Tan
.byte "r",20 ;Reciprocal
.word Recip
.byte "l",21
.word Ln
.byte "m",26
.word Memin
.byte "v",18 ;"v" is Square Root for lack of anything better
.word Sqrt
.byte KEY_F1,29 ;f1 is Inverse
.word Inverse
.byte KEY_F3,27 ;f3 is Swap
.word Swap
.byte KEY_F5,28 ;f5 is Drop
.word Drop
.byte KEY_F7,22 ;f7 is +/-
.word SignChange
.byte "q",30
.word QuitRPN
@.byte 0
;End of table
;icon definition table
PADLEFT = DA_LEFT+12 ;left edge of keypad
;(in cards)
IconTable:
.byte 31 ;number of icons
.word $8000+PADLEFT*8 ;x position to place mouse at when done
.byte DA_TOP*8 ;y position to place mouse at when done
; ***
@ICON 0 - 0
.word Pic0 ;pointer to compacted bitmap for icon
.byte $80+PADLEFT+3 ;x position in bytes
.byte (DA_TOP+16)*8 ;y position in scanlines
.byte $80+ICON0_WIDTH ;width of icon in bytes
.byte ICON0_HEIGHT ;height of icon in scanlines
.word Number ;pointer to handler routine
; ***
@ICON 1 - 1
.word Pic1
.byte $80+PADLEFT+1
.byte (DA_TOP+14)*8
.byte $80+ICON1_WIDTH
.byte ICON1_HEIGHT
.word Number
; ***
@ICON 2 - 2
.word Pic2
.byte $80+PADLEFT+3
.byte (DA_TOP+14)*8
.byte $80+ICON2_WIDTH
.byte ICON2_HEIGHT
.word Number
; ***
@ICON 3 - 3
.word Pic3
.byte $80+PADLEFT+5
.byte (DA_TOP+14)*8
.byte $80+ICON3_WIDTH
.byte ICON3_HEIGHT
.word Number
; ***
@ICON 4 - 4
.word Pic4
.byte $80+PADLEFT+1
.byte (DA_TOP+12)*8
.byte $80+ICON4_WIDTH
.byte ICON4_HEIGHT
.word Number
; ***
@ICON 5 - 5
.word Pic5
.byte $80+PADLEFT+3
.byte (DA_TOP+12)*8
.byte $80+ICON5_WIDTH
.byte ICON5_HEIGHT
.word Number
; ***
@ICON 6 - 6
.word Pic6
.byte $80+PADLEFT+5
.byte (DA_TOP+12)*8
.byte $80+ICON6_WIDTH
.byte ICON6_HEIGHT
.word Number
; ***
@ICON 7 -7
.word Pic7
.byte $80+PADLEFT+1
.byte (DA_TOP+10)*8
.byte $80+ICON7_
; ***
@ICON 7 -7
.word Pic7
.byte $80+PADLEFT+1
.byte (DA_TOP+10)*8
.byte $80+ICON7_WIDTH
.byte ICON7_HEIGHT
.word Number
; ***
@ICON 8 - 8
.word Pic8
.byte $80+PADLEFT+3
.byte (DA_TOP+10)*8
.byte $80+ICON8_WIDTH
.byte ICON8_HEIGHT
.word Number
; ***
@ICON 9 - 9
.word Pic9
.byte $80+PADLEFT+5
.byte (DA_TOP+10)*8
.byte $80+ICON9_WIDTH
.byte ICON9_HEIGHT
.word Number
; ***
@ICON 10 - DECIMAL POINT
.word PicPoint
.byte $80+PADLEFT+5
.byte (DA_TOP+16)*8
.byte $80+ICON10_WIDTH
.byte ICON10_HEIGHT
.word DecimalPoint
; ***
@ICON 11 - SCINOT
.word PicE
.byte $80+PADLEFT+1
.byte (DA_TOP+16)*8
.byte $80+ICON11_WIDTH
.byte ICON11_HEIGHT
.word Scinot
; ***
@ICON 12 - PLUS
.word PicPlus
.byte $80+PADLEFT+7
.byte (DA_TOP+10)*8
.byte $80+ICON12_WIDTH
.byte ICON12_HEIGHT
.word AddNums
; ***
@ICON 13 - MINUS
.word PicMinus
.byte $80+PADLEFT+7
.byte (DA_TOP+12)*8
.byte $80+ICON13_WIDTH
.byte ICON13_HEIGHT
.word SubNums
; ***
@ICON 14 - MULTIPLY
.word PicMult
.byte $80+PADLEFT+7
.byte (DA_TOP+14)*8
.byte $80+ICON14_WIDTH
.byte ICON14_HEIGHT
.word MultNums
; ***
@ICON 15 - DIVIDE
.word P
; ***
@ICON 15 - DIVIDE
.word PicDiv
.byte $80+PADLEFT+7
.byte (DA_TOP+16)*8
.byte $80+ICON15_WIDTH
.byte ICON15_HEIGHT
.word DivNums
; ***
@ICON 16 - DELETE
.word PicDelete
.byte $80+PADLEFT+9
.byte (DA_TOP+10)*8
.byte $80+ICON16_WIDTH
.byte ICON16_HEIGHT
.word Delete
; ***
@ICON 17 - ENTER
.word PicEnter
.byte $80+PADLEFT+9
.byte (DA_TOP+12)*8
.byte $80+ICON17_WIDTH
.byte ICON17_HEIGHT
.word Enter
; ***
@ICON 18 - SQRT
.word PicSqrt
.byte $80+PADLEFT+1
.byte (DA_TOP+7)*8
.byte $80+ICON18_WIDTH
.byte ICON18_HEIGHT
.word Sqrt
; ***
@ICON 19 - EXPONENTIATION
.word PicExpo
.byte $80+PADLEFT+3
.byte (DA_TOP+7)*8
.byte $80+ICON19_WIDTH
.byte ICON19_HEIGHT
.word Expo
; ***
@ICON 20 - RECIPROCAL
.word PicRecip
.byte $80+PADLEFT+5
.byte (DA_TOP+7)*8
.byte $80+ICON20_WIDTH
.byte ICON20_HEIGHT
.word Recip
; ***
@ICON 21 - LN
.word PicLn
.byte $80+PADLEFT+7
.byte (DA_TOP+7)*8
.byte $80+ICON21_WIDTH
.byte ICON21_HEIGHT
.word Ln
; ***
@ICON 22 - SIGN CHANGE
.word PicSignChange
.byte $80+PADLEFT+9
.byte (DA_TOP+7)*8
.byte $80+ICON22_WIDTH
.byte ICON22_HEIGHT
.word SignChange
; ***
@IC
; ***
@ICON 23 - SIN
.word PicSin
.byte $80+PADLEFT+1
.byte (DA_TOP+5)*8
.byte $80+ICON23_WIDTH
.byte ICON23_HEIGHT
.word Sin
; ***
@ICON 24 - COS
.word PicCos
.byte $80+PADLEFT+4
.byte (DA_TOP+5)*8
.byte $80+ICON24_WIDTH
.byte ICON24_HEIGHT
.word Cos
; ***
@ICON 25 - TAN
.word PicTan
.byte $80+PADLEFT+7
.byte (DA_TOP+5)*8
.byte $80+ICON25_WIDTH
.byte ICON25_HEIGHT
.word Tan
; ***
@ICON 26 - MEMIN
.word PicMemin
.byte $80+PADLEFT+1
.byte (DA_TOP+3)*8
.byte $80+ICON26_WIDTH
.byte ICON26_HEIGHT
.word Memin
; ***
@ICON 27 - SWAP
.word PicSwap
.byte $80+PADLEFT+4
.byte (DA_TOP+3)*8
.byte $80+ICON27_WIDTH
.byte ICON27_HEIGHT
.word Swap
; ***
@ICON 28 - DROP
.word PicDrop
.byte $80+PADLEFT+7
.byte (DA_TOP+3)*8
.byte $80+ICON28_WIDTH
.byte ICON28_HEIGHT
.word Drop
; ***
@ICON 29 - INVERSE
.word PicInverse
.byte $80+PADLEFT+1
.byte (DA_TOP+1)*8
.byte $80+ICON29_WIDTH
.byte ICON29_HEIGHT
.word Inverse
; ***
@ICON 30 - QUIT
.word PicQuit
.byte $80+PADLEFT+9
.byte (DA_TOP+1)*8
.byte $80+ICON30_WIDTH
.byte ICON30_HEIGHT
.word QuitRPN
Pic0: ;assembler will place compacted bitmap data
Pic0: ;assembler will place compacted bitmap data
;here for this picture:
@ICON0_WIDTH = picW ;store bitmap size values for use in above
ICON0_HEIGHT = picH ;table on pass 2. (picW and picH are set by
;the assembler.)
Pic1:
AICON1_WIDTH = picW
ICON1_HEIGHT = picH
Pic2:
BICON2_WIDTH = picW
ICON2_HEIGHT = picH
Pic3:
CICON3_WIDTH = picW
ICON3_HEIGHT = picH
Pic4:
DICON4_WIDTH = picW
ICON4_HEIGHT = picH
Pic5:
EICON5_WIDTH = picW
ICON5_HEIGHT = picH
Pic6:
FICON6_WIDTH = picW
ICON6_HEIGHT = picH
Pic7:
GICON7_WIDTH = picW
ICON7_HEIGHT = picH
Pic8:
HICON8_WIDTH = picW
ICON8_HEIGHT = picH
Pic9:
IICON9_WIDTH = picW
ICON9_HEIGHT = picH
PicPoint:
^ICON10_WIDTH = picW
ICON10_HEIGHT = picH
PicE:
`ICON11_WIDTH = picW
ICON11_HEIGHT = picH
PicPlus:
JICON12_WIDTH = picW
ICON12_HEIGHT = picH
PicMinus:
KICON13_WIDTH = picW
ICON13_HEIGHT = picH
PicMult:
LICON14_WIDTH = picW
PicPlus:
JICON12_WIDTH = picW
ICON12_HEIGHT = picH
PicMinus:
KICON13_WIDTH = picW
ICON13_HEIGHT = picH
PicMult:
LICON14_WIDTH = picW
ICON14_HEIGHT = picH
PicDiv:
MICON15_WIDTH = picW
ICON15_HEIGHT = picH
PicDelete:
NICON16_WIDTH = picW
ICON16_HEIGHT = picH
PicEnter:
OICON17_WIDTH = picW
ICON17_HEIGHT = picH
PicSqrt:
PICON18_WIDTH = picW
ICON18_HEIGHT = picH
PicExpo:
RICON19_WIDTH = picW
ICON19_HEIGHT = picH
PicRecip:
SICON20_WIDTH = picW
ICON20_HEIGHT = picH
PicLn:
TICON21_WIDTH = picW
ICON21_HEIGHT = picH
PicSignChange:
QICON22_WIDTH = picW
ICON22_HEIGHT = picH
PicSin:
XICON23_WIDTH = picW
ICON23_HEIGHT = picH
PicCos:
PicSin:
XICON23_WIDTH = picW
ICON23_HEIGHT = picH
PicCos:
YICON24_WIDTH = picW
ICON24_HEIGHT = picH
PicTan:
ZICON25_WIDTH = picW
ICON25_HEIGHT = picH
PicMemin:
UICON26_WIDTH = picW
ICON26_HEIGHT = picH
PicSwap:
\ICON27_WIDTH = picW
ICON27_HEIGHT = picH
PicDrop:
]ICON28_WIDTH = picW
ICON28_HEIGHT = picH
PicInverse:
VICON29_WIDTH = picW
ICON29_HEIGHT = picH
PicQuit:
_ICON30_WIDTH = picW
ICON30_HEIGHT = picH
.word DivNums
; ***
@ICON 16 - DELETE
.word DivNums
; ***
@ICON 16 - DELETE
.word PicDelete
.byte $80+PADLEFT+9
.byte (DA_TOP+
.word DivNums
; ***
@ICON 16 - DELETE
.word PicDelete
.byte $80+PADLEFT+9
.byte (DA_TOP+10)*8
.byte $80+ICON16_WIDTH
.byte ICON16_HEIGHT
.word
.word DivNums
; ***
@ICON 16 - DELETE
.word PicDelete
.byte $80+PADLEFT+9
.byte (DA_TOP+10)*8
.byte $80+ICON16_WIDTH
.byte ICON16_HEIGHT
.word Delete
; ***
@ICON 17 - ENTER