home *** CD-ROM | disk | FTP | other *** search
- ;Compiled code conventions ;
- ;Registers:
- ;
- ;RB 8 Called address ;can be used without saving
- ;RL 12 Caller's static
- ;RTS 11 Top of stack (empty word above)
- ;RP 10 Frame pointer
- ;RG 9 Global base
- ;RGB 7 Special global base
- ;
- ;There is an upwards-growing stack, addressed by two registers. R(F)P is the
- ;frame pointer, RTS the top of stack+1 free word pointer.
- ;RG points at the base of the global vector; RGB addresses a set of subroutines
- ;within the library.
- ;
- ;On procedure entry, RB holds the address of the called procedure. It need not
- ;be preserved. RL holds the address of the caller's static data, and must be
- ;preserved. R14 holds the link: this must be written to both PC and PSR on
- ;return. R1 to R4 hold the first four arguments, with others on the stack
- ;above RTS in the usual way. Thus, a general procedure would look like:
- ; STMEA rts!, {rb, rp, rl, r14} ; save linkage
- ; SUB rp, rts, #16 ; new frame pointer
- ; STMEA rts!, {a1, ...} ; arguments
- ; ...
- ; MOV rts, rp ; unwind our frame
- ; LDMIB rp, {rp, rl, pc}^ ; no need to restore RB
- ;
- ;R0 to R6 and RB(8) may be used without saving their values; so may R13 and
- ;moreover it is accessible from BCPL through the name NIL (assignment to NIL
- ;from BCPL has the side-effect of updating R6). R6 and R13 are guaranteed
- ;untouched by the library, and by BCPL code which does not update NIL.
- ;
- ;On return, a1 holds value received.
-
-
- .include "regnames"
- .include "swinames"
- Result2 = 52
- Wb = 150
-
- .AREA Code
- Start: .ascii "BCPL"
- .LONG Globinits-Start
- .ascii "WimpSWIs"
- .ASCII "25 Dec 89 00-00-00 "
- .LONG 0
- .LONG -1
- .ascic "WimInit"
- WimpInitialise:
- mov r0, a1 ; Wimp Version Required
- ldr a1, Task ;
- ; mov a2, a2 ; BcToC0( WimpTaskName )
- mov a3, a3, lsl #2 ; Message Vec (0 all)
- Wswi: swi Wimp_Initialise ;
- str r0, [rg, #Result2] ; Current Wimp Version
- mov pc, lr ; Resultis Task Handle
- Task: .ascii "TASK"
-
- ; mov a2, #1
- ; add a2, a2, a1, lsl #2 ; bug if string not zero-terminated.
- ; ldr a1, Task
- ; ldr r0, RiscNo
- ;Wswi: swi Wimp_Initialise
- ; str r0, [rg, #Result2]
- ; mov r0, #0xc0
- ; mov a4, a1
- ; ldr a1, fl
- ; swi OS_Find
- ; str r0, fl
- ; mov a1, a4
- ; mov pc, lr
- ;Task: .ascii "TASK"
- ;RiscNo: .long 200
- ;
- .long -1
- .ascic "WCreWin"
- WimpCreateWindow:
- mov r5, #Wimp_CreateWindow-Wimp_Initialise
- Wswic: ldr rb, [pc, #Wswi-$-8]
- add r5, r5, rb
- str r5, [pc, #Wswid-$-8]
- mov a2, a2 ;allow for pipelining
- mov a1, a1, lsl #2
- Wswid: .blkl 1
- mov a1, r0
- ; mov a4, a1
- ; ldr r0, [a1]
- ; ldr a1, tmp
- ; mov a2, #12
- ; swi OS_ConvertInteger4
- ; mov a1, r0
- ; mov r0, #2
- ; ldr a2, tmp
- ; mov r3, #12
- ; swi OS_GBPB
- ;
- ; mov a1, a4
- mov pc,lr
- ;
- .long -1
- .ascic "WCrIcon"
- WimpCreateIcon:
- mov r5, #Wimp_CreateIcon-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WDelWin"
- WimpDeleteWindow:
- mov r5, #Wimp_DeleteWindow-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WDeIcon"
- WimpDeleteIcon:
- mov r5, #Wimp_DeleteIcon-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WiOpenW"
- WimpOpenWindow:
- mov r5, #Wimp_OpenWindow-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WCloseW"
- WimpCloseWindow:
- mov r5, #Wimp_CloseWindow-Wimp_Initialise
- b Wswic
- ;
- .long -1
- .ascic "WimPoll"
- WimpPoll: mov r0, a1
- mov a1, a2, lsl #2
- swi Wimp_Poll
- mov a1, r0
- mov pc, lr
- ;
- .long -1
- .ascic "WRedraw"
- WimpRedrawWindow:
- mov r5, #Wimp_RedrawWindow-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WUpdate"
- WimpUpdateWindow:
- mov r5, #Wimp_UpdateWindow-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WGtRect"
- WimpGetRectangle:
- mov r5, #Wimp_GetRectangle-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WGtWsta"
- WimpGetWindowState:
- mov r5, #Wimp_GetWindowState-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WgtWinf"
- WimpGetWindowInfo:
- mov r5, #Wimp_GetWindowInfo-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WSIconS"
- WimpSetIconState:
- mov r5, #Wimp_SetIconState-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WGIconS"
- WimpGetIconState:
- mov r5, #Wimp_GetIconState-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WGtPtIn"
- WimpGetPointerInfo:
- mov r5, #Wimp_GetPointerInfo-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WDragBx"
- WimpDragBox:
- mov r5, #Wimp_DragBox-Wimp_Initialise
- b Wswic
- ;
- .long -1
- .ascic "WFRedra"
- WimpForceRedraw:
- mov r0, a1
- mov rb, a2, lsl #2
- ldmia rb, {a1-a4}
- swi Wimp_ForceRedraw
- mov pc, lr
- .long -1
- .ascic "WSCaret"
- WimpSetCaretPosition:
- mov r0, a1
- mov a1, a2
- mov rb, a3, lsl #2
- ldmia rb, {a2-r5}
- swi Wimp_SetCaretPosition
- mov pc, lr
- ;
- .long -1
- .ascic "CreMenu"
- WimpCreateMenu:
- cmn a1, #1
- movne a1, a1, lsl #2
- swi Wimp_CreateMenu
- mov pc, lr
- ;
- .long -1
- .ascic "MenuDec"
- WimpDecodeMenu:
- mov a1, a1, lsl #2
- mov a2, a2, lsl #2
- mov a3, a3, lsl #2
- swi Wimp_DecodeMenu
- mov pc, lr
- ;
- .long -1
- .ascic "WiWIcon"
- WimpWhichIcon:
- mov r0, a1
- mov a1, a2, lsl #2
- mov a2, a3
- mov a3, a4
- swi Wimp_WhichIcon
- mov pc, lr
- ;
- .long -1
- .ascic "WSetExt"
- WimpSetExtent:
- mov r0, a1
- mov a1, a2, lsl #2
- swi Wimp_SetExtent
- mov pc, lr
- ;
- .long -1
- .ascic "OpTempl"
- WimpOpenTemplate:
- swi Wimp_OpenTemplate
- mov pc, lr
- .long -1
- .ascic "ClTempl"
- WimpCloseTemplate:
- swi Wimp_CloseTemplate
- mov pc, lr
- .long -1
- .ascic "LdTempl"
- WimpLoadTemplate:
- mov a1, a1, lsl #2
- mov rb, a2, lsl #2
- ldmia rb, {a2-v3}
- swi Wimp_LoadTemplate
- stmea rb, {a2-v3}
- str v3, [rg, #Result2]
- ; mov a2, rb, lsr #2
- mov a1, a1, lsr #2
- mov pc, lr
- ;
- .long -1
- .ascic "WProKey"
- WimpProcessKey:
- mov r0, a1
- swi Wimp_ProcessKey
- mov pc, lr
- .long -1
- .ascic "WGCaret"
- WimpGetCaretPosition:
- mov r5, #Wimp_GetCaretPosition-Wimp_Initialise
- b Wswic
- ;
- .long -1
- .ascic "WCloseD"
- WimpCloseDown:
- ; mov r0, a1
- ; ldr a1, Task
- swi Wimp_CloseDown
- mov pc, lr
- .long -1
- .ascic "WStTask"
- WimpStartTask:
- mov r0, a1
- swi Wimp_StartTask
- mov a1, r0
- Mov pc, lr
- ;
- .long -1
- .ascic "WRepErr"
- WimpReportError:
- cmp a1, #0
- movgt r0, a1, lsl #2
- movle r0, a1
- mov a1, a2
- mov a2, a3
- swi Wimp_ReportError
- mov pc, lr
- ;
- .long -1
- .ascic "Windout"
- WimpGetWindowOutline:
- mov r5, #Wimp_GetWindowOutline-Wimp_Initialise
- b Wswic
- ;
- .long -1
- .ascic "WPollid"
- WimpPollIdle:
- mov r0, a1
- mov a1, a2, lsl #2
- mov a2, a3
- swi Wimp_PollIdle
- mov a1, r0
- mov pc, lr
- ;
- .long -1
- .ascic "WPlIcon"
- WimpPlotIcon:
- mov r5, #Wimp_PlotIcon-Wimp_Initialise
- b Wswic
- ;
- .long -1
- .ascic "SetMode"
- WimpSetMode:
- mov r0, a1
- swi Wimp_SetMode
- mov pc, lr
- ;
- .long -1
- .ascic "SetPalt"
- WimpSetPalette:
- mov r5, #Wimp_SetPalette-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "ReadPal"
- WimpReadPalette:
- mov r5, #Wimp_ReadPalette-Wimp_Initialise
- b Wswic
- .long -1
- .ascic "WSetCol"
- WimpSetColour:
- mov r0, a1
- swi Wimp_SetColour
- mov pc, lr
- ;
- .long -1
- .ascic "SendMes"
- WimpSendMessage:
- mov r0, a1
- mov a1, a2, lsl #2
- mov a2, a3
- mov a3, a4
- swi Wimp_SendMessage
- mov a1, a2
- mov pc, lr
- ;
- .long -1
- .ascic "CrSuMen"
- WimpCreateSubMenu:
- mov a1, a1, lsl #2
- swi Wimp_CreateSubMenu
- mov pc, lr
- ;
- .long -1
- .ascic "WSpriOp"
- WimpSpriteOp:
- mov r0, a1
- mov a1, rgb
- mov a2, a2, lsl #2
- add a2, a2, #1
- mov rb, a3, lsl #2
- ldmia rb, {a3-rgb}
- swi Wimp_SpriteOp
- stmea rb, {a3-rgb}
- mov rgb, a1
- mov a1, a2
- mov pc, lr
- ;
- .long -1
- .ascic "WSlotSz"
- WimpSlotSize:
- mov r0, a1
- mov a1, a2
- mov rb, a3, lsl #2
- swi Wimp_SlotSize
- str a2, [rb]
- str a1, [rg, #Result2]
- mov a1, r0
- mov pc, lr
- ;
- .long -1
- .ascic "WClFMem"
- WimpClaimFreeMemory:
- mov r0, a1
- mov a1, a2
- swi Wimp_ClaimFreeMemory
- str a2, [rg, #Result2]
- mov pc, lr
- ;
- .long -1
- .ascic "WCommdW"
- WimpCommandWindow:
- cmp a1, #1
- movgt r0, #1
- addgt r0, r0, a1, lsl #2
- mvnle r0, a1
- swi Wimp_CommandWindow
- mov pc, lr
- .long -1
- .ascic "WTextCl"
- WimpTextColour:
- mov r0, a1
- swi Wimp_TextColour
- mov pc, lr
- .long -1
- .ascic "WSysInf"
- WimpReadSysInfo:
- mov r0, a1
- swi Wimp_ReadSysInfo
- mov a1, r0
- mov pc, lr
- .long -1
- .ascic "WGtMenS"
- WimpGetMenuState:
- mov r0, a1
- mov a1, a2, lsl #2
- mov a2, a3
- mov a3, a4
- swi Wimp_GetMenuState
- mov pc, lr
- Globinits:
- .long Wb+0
- .long WimpInitialise - Start
- .long Wb+1
- .long WimpCreateWindow - Start
- .long Wb+2
- .long WimpCreateIcon -Start
- .long Wb+3
- .long WimpDeleteWindow -Start
- .long Wb+4
- .long WimpDeleteIcon - Start
- .long Wb+5
- .long WimpOpenWindow - Start
- .long Wb+6
- .long WimpCloseWindow - Start
- .long Wb+7
- .long WimpPoll - Start
- .long Wb+8
- .long WimpRedrawWindow - Start
- .long Wb+9
- .long WimpUpdateWindow - Start
- .long Wb+10
- .long WimpGetRectangle - Start
- .long Wb+11
- .long WimpGetWindowState - Start
- .long Wb+12
- .long WimpGetWindowInfo - Start
- .long Wb+13
- .long WimpSetIconState - Start
- .long Wb+14
- .long WimpGetIconState - Start
- .long Wb+15
- .long WimpGetPointerInfo - Start
- .long Wb+16
- .long WimpDragBox - Start
- .long Wb+17
- .long WimpForceRedraw - Start
- .long Wb+18
- .long WimpSetCaretPosition - Start
- .long Wb+19
- .long WimpGetCaretPosition - Start
- .long Wb+20
- .long WimpCreateMenu - Start
- .long Wb+21
- .long WimpDecodeMenu - Start
- .long Wb+22
- .long WimpWhichIcon - Start
- .long Wb+23
- .long WimpSetExtent - Start
- .long Wb+25
- .long WimpOpenTemplate - Start
- .long Wb+26
- .long WimpCloseTemplate - Start
- .long Wb+27
- .long WimpLoadTemplate - Start
- .long Wb+28
- .long WimpProcessKey - Start
- .long Wb+29
- .long WimpCloseDown - Start
- .long Wb+30
- .long WimpStartTask - Start
- .long Wb+31
- .long WimpReportError - Start
- .long Wb+32
- .long WimpGetWindowOutline -Start
- .long Wb+33
- .long WimpPollIdle -Start
- .long Wb+34
- .long WimpPlotIcon -Start
- .long Wb+35
- .long WimpSetMode - Start
- .long Wb+36
- .long WimpSetPalette - Start
- .long Wb+37
- .long WimpReadPalette - Start
- .long Wb+38
- .long WimpSetColour - Start
- .long Wb+39
- .long WimpSendMessage - Start
- .long Wb+40
- .long WimpCreateSubMenu - Start
- .long Wb+41
- .long WimpSpriteOp - Start
- .long Wb+44
- .long WimpSlotSize - Start
- .long Wb+46
- .long WimpClaimFreeMemory - Start
- .long Wb+47
- .long WimpCommandWindow - Start
- .long Wb+48
- .long WimpTextColour - Start
- .long Wb+50
- .long WimpReadSysInfo - Start
- .long Wb+70 ; rearrange
- .long WimpGetMenuState - Start
- .long Wb+52
- .long 0
- ;cs;dc;tb;i/.long/;tb;e/_//;nw;dc;i/ - Start/;s;i/.long/;tb;tu;2n
- .LONG 0x12345678
- .LONG Globinits + 4 - Start
- .LONG Globinits + 12 - Start
- .LONG Globinits + 20 - Start
- .LONG Globinits + 28 - Start
- .LONG Globinits + 36 - Start
- .LONG Globinits + 44 - Start
- .LONG Globinits + 52 - Start
- .LONG Globinits + 60 - Start
- .LONG Globinits + 68 - Start
- .LONG Globinits + 76 - Start
- .LONG Globinits + 84 - Start
- .LONG Globinits + 92 - Start
- .LONG Globinits + 100 - Start
- .LONG Globinits + 108 - Start
- .LONG Globinits + 116 - Start
- .LONG Globinits + 124 - Start
- .LONG Globinits + 132 - Start
- .LONG Globinits + 140 - Start
- .LONG Globinits + 148 - Start
- .LONG Globinits + 156 - Start
- .LONG Globinits + 164 - Start
- .LONG Globinits + 172 - Start
- .LONG Globinits + 180 - Start
- .LONG Globinits + 188 - Start
- .LONG Globinits + 196 - Start
- .LONG Globinits + 204 - Start
- .LONG Globinits + 212 - Start
- .LONG Globinits + 220 - Start
- .LONG Globinits + 228 - Start
- .LONG Globinits + 236 - Start
- .LONG Globinits + 244 - Start
- .LONG Globinits + 252 - Start
- .LONG Globinits + 260 - Start
- .LONG Globinits + 268 - Start
- .LONG Globinits + 276 - Start
- .LONG Globinits + 284 - Start
- .LONG Globinits + 292 - Start
- .LONG Globinits + 300 - Start
- .LONG Globinits + 308 - Start
- .LONG Globinits + 316 - Start
- .LONG Globinits + 324 - Start
- .LONG Globinits + 332 - Start
- .LONG Globinits + 340 - Start
- .LONG Globinits + 348 - Start
- .LONG Globinits + 356 - Start
- .LONG Globinits + 364 - Start
- .LONG Globinits + 372 - Start
- .LONG 0x87654321
- ;Wimp_SetPointerShape : Wb + 24
- ;Wimp_BaseOfSprites : Wb + 42
- ;Wimp_BlockCopy : Wb + 43
- ;Wimp_ReadPixTrans : Wb + 45
- ;Wimp_TransferBlock : Wb + 49
- ;Wimp_SetFontColours : Wb + 51
-